Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Expect call to wrapper
  • Loading branch information
yaakovschectman committed Oct 26, 2022
commit 0c43076a3884504b712dd156bb8d362e071e4222
5 changes: 4 additions & 1 deletion shell/platform/windows/flutter_window_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,13 @@ class TestFlutterWindowsView : public FlutterWindowsView {
public:
TestFlutterWindowsView(std::unique_ptr<WindowBindingHandler> window_binding)
: FlutterWindowsView(std::move(window_binding)) {}
~TestFlutterWindowsView() {}

SpyKeyboardKeyHandler* key_event_handler;
SpyTextInputPlugin* text_input_plugin;

MOCK_METHOD4(NotifyWinEventWrapper, void(DWORD, HWND, LONG, LONG));

protected:
std::unique_ptr<KeyboardHandlerBase> CreateKeyboardKeyHandler(
flutter::BinaryMessenger* messenger,
Expand Down Expand Up @@ -406,10 +409,10 @@ TEST(FlutterWindowTest, InitialAccessibilityFeatures) {
TEST(FlutterWindowTest, AlertNode) {
std::unique_ptr<MockFlutterWindow> win32window =
std::make_unique<MockFlutterWindow>();
;
ON_CALL(*win32window, GetPlatformWindow()).WillByDefault(Return(nullptr));
AccessibilityRootNode* root_node = win32window->GetAccessibilityRootNode();
TestFlutterWindowsView view(std::move(win32window));
EXPECT_CALL(view, NotifyWinEventWrapper(EVENT_SYSTEM_ALERT, nullptr, OBJID_CLIENT, AccessibilityRootNode::kAlertChildId)).Times(1);
std::wstring message = L"Test alert";
view.AnnounceAlert(message);
IAccessible* alert = root_node->GetOrCreateAlert();
Expand Down
4 changes: 4 additions & 0 deletions shell/platform/windows/flutter_windows_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,10 @@ void FlutterWindowsView::AnnounceAlert(const std::wstring& text) {
binding_handler_->GetAccessibilityRootNode()->GetOrCreateAlert();
alert->SetText(text);
HWND hwnd = GetPlatformWindow();
NotifyWinEventWrapper(EVENT_SYSTEM_ALERT, hwnd, OBJID_CLIENT, AccessibilityRootNode::kAlertChildId);
}

void FlutterWindowsView::NotifyWinEventWrapper(DWORD event, HWND hwnd, LONG idObject, LONG idChild) {
if (hwnd) {
NotifyWinEvent(EVENT_SYSTEM_ALERT, hwnd, OBJID_CLIENT,
AccessibilityRootNode::kAlertChildId);
Expand Down
2 changes: 2 additions & 0 deletions shell/platform/windows/flutter_windows_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ class FlutterWindowsView : public WindowBindingHandlerDelegate,
virtual std::unique_ptr<TextInputPlugin> CreateTextInputPlugin(
BinaryMessenger* messenger);

virtual void NotifyWinEventWrapper(DWORD event, HWND hwnd, LONG idObject, LONG idChild);

private:
// Struct holding the state of an individual pointer. The engine doesn't keep
// track of which buttons have been pressed, so it's the embedding's
Expand Down