From 81c662ef3d8abfc4c427555ce996145cd39edae0 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Sat, 12 Feb 2022 12:51:01 -0800 Subject: [PATCH] Enable a11y unittests on Windows (flutter/engine#31387) This enables accessibility unittests on Windows as part of our CI testing. It also corrects two unit tests which were fixed by https://github.com/flutter/engine/pull/29773, which fixed https://github.com/flutter/flutter/issues/78460. Finally it disables an AXFragmentRoot test that times out. We don't use AXFragmentRoot in Flutter as it's only used with UI Automation APIs, which Flutter does not use (we use MSAA). Issue: https://github.com/flutter/flutter/issues/98225 --- engine/src/flutter/testing/run_tests.py | 4 ++-- .../ax/platform/ax_fragment_root_win_unittest.cc | 2 +- .../ax/platform/ax_platform_node_win_unittest.cc | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engine/src/flutter/testing/run_tests.py b/engine/src/flutter/testing/run_tests.py index ec205eac6c..332820611b 100755 --- a/engine/src/flutter/testing/run_tests.py +++ b/engine/src/flutter/testing/run_tests.py @@ -215,8 +215,8 @@ def RunCCTests(build_dir, filter, coverage, capture_core_dump): RunEngineExecutable(build_dir, 'testing_unittests', filter, shuffle_flags, coverage=coverage) - # The accessibility library only supports Mac for now. - if IsMac(): + # The accessibility library only supports Mac and Windows. + if IsMac() or IsWindows(): RunEngineExecutable(build_dir, 'accessibility_unittests', filter, shuffle_flags, coverage=coverage) # These unit-tests are Objective-C and can only run on Darwin. diff --git a/engine/src/flutter/third_party/accessibility/ax/platform/ax_fragment_root_win_unittest.cc b/engine/src/flutter/third_party/accessibility/ax/platform/ax_fragment_root_win_unittest.cc index 5892045908..683d0d76de 100644 --- a/engine/src/flutter/third_party/accessibility/ax/platform/ax_fragment_root_win_unittest.cc +++ b/engine/src/flutter/third_party/accessibility/ax/platform/ax_fragment_root_win_unittest.cc @@ -277,7 +277,7 @@ TEST_F(AXFragmentRootTest, TestUIAGetFragmentRoot) { EXPECT_EQ(expected_fragment_root.Get(), actual_fragment_root.Get()); } -TEST_F(AXFragmentRootTest, TestUIAElementProviderFromPoint) { +TEST_F(AXFragmentRootTest, DISABLED_TestUIAElementProviderFromPoint) { AXNodeData root_data; root_data.id = 1; root_data.relative_bounds.bounds = gfx::RectF(0, 0, 80, 80); diff --git a/engine/src/flutter/third_party/accessibility/ax/platform/ax_platform_node_win_unittest.cc b/engine/src/flutter/third_party/accessibility/ax/platform/ax_platform_node_win_unittest.cc index 387435c584..f1a209da90 100644 --- a/engine/src/flutter/third_party/accessibility/ax/platform/ax_platform_node_win_unittest.cc +++ b/engine/src/flutter/third_party/accessibility/ax/platform/ax_platform_node_win_unittest.cc @@ -446,7 +446,8 @@ TEST_F(AXPlatformNodeWinTest, IAccessibleDetachedObject) { EXPECT_EQ(E_FAIL, root_obj->get_accName(SELF, name2.Receive())); } -TEST_F(AXPlatformNodeWinTest, IAccessibleHitTest) { +// TODO(cbracken): Flaky https://github.com/flutter/flutter/issues/98302 +TEST_F(AXPlatformNodeWinTest, DISABLED_IAccessibleHitTest) { AXNodeData root; root.id = 1; root.relative_bounds.bounds = gfx::RectF(0, 0, 40, 40); @@ -4473,8 +4474,7 @@ TEST_F(AXPlatformNodeWinTest, IValueProvider_GetValue) { EXPECT_HRESULT_SUCCEEDED( QueryInterfaceFromNode(GetRootAsAXNode()->children()[0]) ->get_Value(bstr_value.Receive())); - // TODO(gw280): https://github.com/flutter/flutter/issues/78460 - EXPECT_STREQ(L"3.000000", bstr_value.Get()); + EXPECT_STREQ(L"3", bstr_value.Get()); bstr_value.Reset(); EXPECT_HRESULT_SUCCEEDED( @@ -4533,7 +4533,7 @@ TEST_F(AXPlatformNodeWinTest, IValueProvider_SetValue) { EXPECT_UIA_ELEMENTNOTENABLED(provider1->SetValue(L"2")); EXPECT_HRESULT_SUCCEEDED(provider1->get_Value(bstr_value.Receive())); - EXPECT_STREQ(L"3.000000", bstr_value.Get()); + EXPECT_STREQ(L"3", bstr_value.Get()); bstr_value.Reset(); EXPECT_HRESULT_SUCCEEDED(provider2->SetValue(L"changed"));