|
4 | 4 |
|
5 | 5 | #include "flutter/shell/platform/windows/flutter_windows_view.h"
|
6 | 6 |
|
| 7 | +#include <UIAutomation.h> |
7 | 8 | #include <comdef.h>
|
8 | 9 | #include <comutil.h>
|
9 | 10 | #include <oleacc.h>
|
10 |
| -#include <UIAutomation.h> |
11 | 11 |
|
12 | 12 | #include <future>
|
13 | 13 | #include <iostream>
|
@@ -247,14 +247,16 @@ TEST(FlutterWindowsView, AddSemanticsNodeUpdate) {
|
247 | 247 |
|
248 | 248 | // Verify value property matches our label.
|
249 | 249 | VARIANT varvalue{};
|
250 |
| - ASSERT_EQ(uia_view->GetPropertyValue(UIA_ValueValuePropertyId, &varvalue), S_OK); |
| 250 | + ASSERT_EQ(uia_view->GetPropertyValue(UIA_ValueValuePropertyId, &varvalue), |
| 251 | + S_OK); |
251 | 252 | EXPECT_EQ(varvalue.vt, VT_BSTR);
|
252 | 253 | value = _com_util::ConvertBSTRToString(varvalue.bstrVal);
|
253 | 254 | EXPECT_EQ(value, "value");
|
254 | 255 |
|
255 | 256 | // Verify node control type is text.
|
256 | 257 | varrole = {};
|
257 |
| - ASSERT_EQ(uia_view->GetPropertyValue(UIA_ControlTypePropertyId, &varrole), S_OK); |
| 258 | + ASSERT_EQ(uia_view->GetPropertyValue(UIA_ControlTypePropertyId, &varrole), |
| 259 | + S_OK); |
258 | 260 | EXPECT_EQ(varrole.vt, VT_I4);
|
259 | 261 | EXPECT_EQ(varrole.lVal, UIA_TextControlTypeId);
|
260 | 262 | }
|
@@ -690,10 +692,12 @@ TEST(FlutterWindowsViewTest, CheckboxNativeState) {
|
690 | 692 | // Perform similar tests for UIA value;
|
691 | 693 | IRawElementProviderSimple* uia_node;
|
692 | 694 | native_view->QueryInterface(IID_PPV_ARGS(&uia_node));
|
693 |
| - ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue(UIA_ToggleToggleStatePropertyId, &native_state))); |
| 695 | + ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue( |
| 696 | + UIA_ToggleToggleStatePropertyId, &native_state))); |
694 | 697 | EXPECT_EQ(native_state.lVal, ToggleState_On);
|
695 | 698 |
|
696 |
| - ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue(UIA_AriaPropertiesPropertyId, &native_state))); |
| 699 | + ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue( |
| 700 | + UIA_AriaPropertiesPropertyId, &native_state))); |
697 | 701 | EXPECT_NE(std::wcsstr(native_state.bstrVal, L"checked=true"), nullptr);
|
698 | 702 | }
|
699 | 703 |
|
@@ -729,10 +733,12 @@ TEST(FlutterWindowsViewTest, CheckboxNativeState) {
|
729 | 733 | // Perform similar tests for UIA value;
|
730 | 734 | IRawElementProviderSimple* uia_node;
|
731 | 735 | native_view->QueryInterface(IID_PPV_ARGS(&uia_node));
|
732 |
| - ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue(UIA_ToggleToggleStatePropertyId, &native_state))); |
| 736 | + ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue( |
| 737 | + UIA_ToggleToggleStatePropertyId, &native_state))); |
733 | 738 | EXPECT_EQ(native_state.lVal, ToggleState_Off);
|
734 | 739 |
|
735 |
| - ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue(UIA_AriaPropertiesPropertyId, &native_state))); |
| 740 | + ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue( |
| 741 | + UIA_AriaPropertiesPropertyId, &native_state))); |
736 | 742 | EXPECT_NE(std::wcsstr(native_state.bstrVal, L"checked=false"), nullptr);
|
737 | 743 | }
|
738 | 744 |
|
@@ -769,10 +775,12 @@ TEST(FlutterWindowsViewTest, CheckboxNativeState) {
|
769 | 775 | // Perform similar tests for UIA value;
|
770 | 776 | IRawElementProviderSimple* uia_node;
|
771 | 777 | native_view->QueryInterface(IID_PPV_ARGS(&uia_node));
|
772 |
| - ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue(UIA_ToggleToggleStatePropertyId, &native_state))); |
| 778 | + ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue( |
| 779 | + UIA_ToggleToggleStatePropertyId, &native_state))); |
773 | 780 | EXPECT_EQ(native_state.lVal, ToggleState_Indeterminate);
|
774 | 781 |
|
775 |
| - ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue(UIA_AriaPropertiesPropertyId, &native_state))); |
| 782 | + ASSERT_TRUE(SUCCEEDED(uia_node->GetPropertyValue( |
| 783 | + UIA_AriaPropertiesPropertyId, &native_state))); |
776 | 784 | EXPECT_NE(std::wcsstr(native_state.bstrVal, L"checked=mixed"), nullptr);
|
777 | 785 | }
|
778 | 786 | }
|
@@ -845,11 +853,16 @@ TEST(FlutterWindowsViewTest, SwitchNativeState) {
|
845 | 853 | // Test similarly on UIA node.
|
846 | 854 | IRawElementProviderSimple* uia_node;
|
847 | 855 | native_view->QueryInterface(IID_PPV_ARGS(&uia_node));
|
848 |
| - ASSERT_EQ(uia_node->GetPropertyValue(UIA_ControlTypePropertyId, &varrole), S_OK); |
| 856 | + ASSERT_EQ(uia_node->GetPropertyValue(UIA_ControlTypePropertyId, &varrole), |
| 857 | + S_OK); |
849 | 858 | EXPECT_EQ(varrole.lVal, UIA_ButtonControlTypeId);
|
850 |
| - ASSERT_EQ(uia_node->GetPropertyValue(UIA_ToggleToggleStatePropertyId, &native_state), S_OK); |
| 859 | + ASSERT_EQ(uia_node->GetPropertyValue(UIA_ToggleToggleStatePropertyId, |
| 860 | + &native_state), |
| 861 | + S_OK); |
851 | 862 | EXPECT_EQ(native_state.lVal, ToggleState_On);
|
852 |
| - ASSERT_EQ(uia_node->GetPropertyValue(UIA_AriaPropertiesPropertyId, &native_state), S_OK); |
| 863 | + ASSERT_EQ( |
| 864 | + uia_node->GetPropertyValue(UIA_AriaPropertiesPropertyId, &native_state), |
| 865 | + S_OK); |
853 | 866 | EXPECT_NE(std::wcsstr(native_state.bstrVal, L"pressed=true"), nullptr);
|
854 | 867 | }
|
855 | 868 |
|
@@ -885,9 +898,13 @@ TEST(FlutterWindowsViewTest, SwitchNativeState) {
|
885 | 898 | // Test similarly on UIA node.
|
886 | 899 | IRawElementProviderSimple* uia_node;
|
887 | 900 | native_view->QueryInterface(IID_PPV_ARGS(&uia_node));
|
888 |
| - ASSERT_EQ(uia_node->GetPropertyValue(UIA_ToggleToggleStatePropertyId, &native_state), S_OK); |
| 901 | + ASSERT_EQ(uia_node->GetPropertyValue(UIA_ToggleToggleStatePropertyId, |
| 902 | + &native_state), |
| 903 | + S_OK); |
889 | 904 | EXPECT_EQ(native_state.lVal, ToggleState_Off);
|
890 |
| - ASSERT_EQ(uia_node->GetPropertyValue(UIA_AriaPropertiesPropertyId, &native_state), S_OK); |
| 905 | + ASSERT_EQ( |
| 906 | + uia_node->GetPropertyValue(UIA_AriaPropertiesPropertyId, &native_state), |
| 907 | + S_OK); |
891 | 908 | EXPECT_NE(std::wcsstr(native_state.bstrVal, L"pressed=false"), nullptr);
|
892 | 909 | }
|
893 | 910 | }
|
@@ -935,8 +952,12 @@ TEST(FlutterWindowsViewTest, TooltipNodeData) {
|
935 | 952 | EXPECT_EQ(tooltip, "tooltip");
|
936 | 953 |
|
937 | 954 | // Check that MSAA name contains the tooltip.
|
938 |
| - IAccessible* native_view = bridge->GetFlutterPlatformNodeDelegateFromID(AccessibilityBridge::kRootNodeId).lock()->GetNativeViewAccessible(); |
939 |
| - VARIANT varchild = {.vt=VT_I4, .lVal=CHILDID_SELF}; |
| 955 | + IAccessible* native_view = bridge |
| 956 | + ->GetFlutterPlatformNodeDelegateFromID( |
| 957 | + AccessibilityBridge::kRootNodeId) |
| 958 | + .lock() |
| 959 | + ->GetNativeViewAccessible(); |
| 960 | + VARIANT varchild = {.vt = VT_I4, .lVal = CHILDID_SELF}; |
940 | 961 | BSTR bname;
|
941 | 962 | ASSERT_EQ(native_view->get_accName(varchild, &bname), S_OK);
|
942 | 963 | EXPECT_NE(std::wcsstr(bname, L"tooltip"), nullptr);
|
|
0 commit comments