Enable UIA in Window (flutter/engine#39513)

* Enable UIA

* Unit test getobject

* Formatting

* Formatting

* Formatting

* Formatting
This commit is contained in:
yaakovschectman
2023-02-09 15:04:07 -05:00
committed by GitHub
parent 52410a75a4
commit 3a963aaf6a
4 changed files with 29 additions and 4 deletions

View File

@@ -122,7 +122,10 @@ source_set("flutter_windows_source") {
public_configs = [ ":relative_angle_headers" ]
defines = [ "FLUTTER_ENGINE_NO_PROTOTYPES" ]
defines = [
"FLUTTER_ENGINE_NO_PROTOTYPES",
"FLUTTER_ENGINE_USE_UIA",
]
public_deps = [
"//flutter/fml:string_conversion",
@@ -227,6 +230,8 @@ executable("flutter_windows_unittests") {
public_configs = [ "//flutter:config" ]
defines = [ "FLUTTER_ENGINE_USE_UIA" ]
deps = [
":flutter_windows_fixtures",
":flutter_windows_headers",

View File

@@ -67,6 +67,8 @@ class MockWindow : public Window {
MOCK_METHOD0(GetAxFragmentRootDelegate, ui::AXFragmentRootDelegateWin*());
MOCK_METHOD3(OnGetObject, LRESULT(UINT, WPARAM, LPARAM));
void CallOnImeComposition(UINT const message,
WPARAM const wparam,
LPARAM const lparam);

View File

@@ -141,9 +141,9 @@ class Window : public KeyboardManager::WindowDelegate {
//
// The primary use of this function is to supply Windows with wrapped
// semantics objects for use by Windows accessibility.
LRESULT OnGetObject(UINT const message,
WPARAM const wparam,
LPARAM const lparam);
virtual LRESULT OnGetObject(UINT const message,
WPARAM const wparam,
LPARAM const lparam);
// Called when IME composing begins.
virtual void OnComposeBegin() = 0;

View File

@@ -360,5 +360,23 @@ TEST(MockWindow, UnknownPointerTypeSkipsDirectManipulation) {
window.InjectWindowMessage(DM_POINTERHITTEST, MAKEWPARAM(pointer_id, 0), 0);
}
// Test that the root UIA object is queried by WM_GETOBJECT.
TEST(MockWindow, GetObjectUia) {
MockWindow window;
bool uia_called = false;
ON_CALL(window, OnGetObject)
.WillByDefault(Invoke([&uia_called](UINT msg, WPARAM wpar, LPARAM lpar) {
#ifdef FLUTTER_ENGINE_USE_UIA
uia_called = true;
#endif // FLUTTER_ENGINE_USE_UIA
return static_cast<LRESULT>(0);
}));
EXPECT_CALL(window, OnGetObject).Times(1);
window.InjectWindowMessage(WM_GETOBJECT, 0, UiaRootObjectId);
EXPECT_TRUE(uia_called);
}
} // namespace testing
} // namespace flutter