Added SelectContextMenuId Command, increasing uiabridge speeds, reliability

This commit is contained in:
Edward Jakubowski
2014-05-02 22:01:43 -04:00
parent ce78f9c084
commit 4258d0977f
19 changed files with 185 additions and 65 deletions

View File

@@ -25,32 +25,67 @@ void outputResults(array<System::String ^> ^winInfo)
}
void runBasicTests(AutomationBridge ^ab, System::String ^propList)
{
array<System::String ^> ^winInfo = nullptr;
System::DateTime start;
System::Double seconds = 0;
start = System::DateTime::Now;
ab->clearEnumFilters();
ab->addEnumFilter("Parent/FrameworkIdProperty", "WinForm");
winInfo = ab->enumWindowInfo(propList);
//outputResults(winInfo);
seconds = System::Math::Round(System::DateTime::Now.Subtract(start).TotalSeconds, 4);
Console::WriteLine(L"Total WinForm Elements: {0} in {1} seconds", winInfo->Length, seconds);
start = System::DateTime::Now;
ab->clearEnumFilters();
ab->addEnumFilter("Parent/FrameworkIdProperty", "WPF");
winInfo = ab->enumWindowInfo(propList);
//outputResults(winInfo);
seconds = System::Math::Round(System::DateTime::Now.Subtract(start).TotalSeconds, 4);
Console::WriteLine(L"Total WPF Elements: {0} in {1} seconds", winInfo->Length, seconds);
start = System::DateTime::Now;
ab->clearEnumFilters();
winInfo = ab->enumWindowInfo(propList);
//outputResults(winInfo);
seconds = System::Math::Round(System::DateTime::Now.Subtract(start).TotalSeconds, 4);
Console::WriteLine(L"Total All Elements: {0} in {1} seconds", winInfo->Length, seconds);
Console::WriteLine(L"---------------------------------------");
}
int main(array<System::String ^> ^args)
{
Console::WriteLine(L"UI Automation Bridge Test");
AutomationBridge ^ab = gcnew AutomationBridge();
System::String ^propList = L"RuntimeIdProperty,ParentRuntimeIdProperty,NativeWindowHandleProperty,ProcessIdProperty,FrameworkIdProperty,LocalizedControlTypeProperty,ClassNameProperty,NameProperty";
//System::String ^propList = L"RuntimeIdProperty,ProcessIdProperty,FrameworkIdProperty,LocalizedControlTypeProperty,ClassNameProperty,NameProperty";
System::String ^propList = L"RuntimeIdProperty,ParentRuntimeIdProperty,NativeWindowHandleProperty,ProcessIdProperty,FrameworkIdProperty,LocalizedControlTypeProperty,ControlTypeProperty,ClassNameProperty,NameProperty,BoundingRectangleProperty";
AutomationBridge ^ab = gcnew AutomationBridge(propList);
//System::String ^propList = L"RuntimeIdProperty,BoundingRectangleProperty";
Console::WriteLine(propList);
//System::String ^winInfo1 = ab->getWindowInfo(System::IntPtr(3409618), propList);
System::DateTime start = System::DateTime::Now;
runBasicTests(ab, propList);
runBasicTests(ab, propList);
runBasicTests(ab, propList);
//System::String ^winInfo1 = ab->getWindowInfo(System::IntPtr(3409618), propList);
//ab->addEnumFilter("Parent/ClassNameProperty", "Notepad");
//ab->addEnumFilter("First/RuntimeIdProperty", "42-4784952");
//ab->addEnumFilter("ClassNameProperty", "Notepad");
//ab->addEnumFilter("All/ClassNameProperty", "Edit");
//ab->addEnumFilter("All/LocalizedControlTypeProperty", "menu item");
ab->addEnumFilter("Parent/FrameworkIdProperty", "WinForm");
//ab->addEnumFilter("Parent/FrameworkIdProperty", "WinForm");
//ab->addEnumFilter("Parent/FrameworkIdProperty", "WPF");
//ab->addEnumFilter("Parent/ClassNameProperty", "WindowsForms10.Window.8.app.0.2bf8098_r13_ad1");
array<System::String ^> ^winInfo = ab->enumWindowInfo(propList); //L"*"
//array<System::String ^> ^winInfo = ab->enumWindowInfo(propList); //L"*"
//ab->clearEnumFilters();
//ab->addEnumFilter("Parent/FrameworkIdProperty", "WinForm");
//array<System::String ^> ^winInfo = ab->enumWindowInfo(System::IntPtr(3409618), propList); //L"*"
//array<System::String ^> ^winInfo = ab->enumWindowInfo(System::IntPtr(12977932), propList); //L"*"
//Console::WriteLine("enumWindowInfo x,y: {0}", ab->getWindowInfo(100,100, propList); //L"*"
outputResults(winInfo);
//outputResults(winInfo);
//Globals::Global::AUTO_BRIDGE->clearEnumFilters();
//winInfo = nullptr;
//winInfo = Globals::Global::AUTO_BRIDGE->enumWindowInfo(System::IntPtr(7603636), propList);
@@ -64,8 +99,9 @@ int main(array<System::String ^> ^args)
//array<System::String ^> ^winInfo2 = ab->enumWindowInfo(propList); //L"*"
//outputResults(winInfo2);
System::Double seconds = System::Math::Round(System::DateTime::Now.Subtract(start).TotalSeconds, 4);
Console::WriteLine(L"Total Elements: {0} in {1} seconds", winInfo->Length, seconds);
//System::Double seconds = System::Math::Round(System::DateTime::Now.Subtract(start).TotalSeconds, 4);
//Console::WriteLine(L"Total Elements: {0} in {1} seconds", winInfo->Length, seconds);
Console::WriteLine(L"press any key to exit");
getch();//wait for user input
return 0;
}