Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
mock_window.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WINDOW_H_
6#define FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WINDOW_H_
7
8#include "flutter/fml/macros.h"
9#include "flutter/shell/platform/windows/flutter_window.h"
10#include "flutter/shell/platform/windows/testing/test_keyboard.h"
11#include "gmock/gmock.h"
12
13namespace flutter {
14namespace testing {
15
16/// Mock for the |FlutterWindow| base class.
17class MockWindow : public FlutterWindow {
18 public:
19 MockWindow();
20 MockWindow(std::unique_ptr<WindowsProcTable> windows_proc_table,
21 std::unique_ptr<TextInputManager> text_input_manager);
22 virtual ~MockWindow();
23
24 // Wrapper for GetCurrentDPI() which is a protected method.
25 UINT GetDpi();
26
27 // Set the Direct Manipulation owner for testing purposes.
29 std::unique_ptr<DirectManipulationOwner> owner);
30
31 // Simulates a WindowProc message from the OS.
33 WPARAM const wparam,
34 LPARAM const lparam);
35
36 void InjectMessageList(int count, const Win32Message* messages);
37
38 MOCK_METHOD(void, OnDpiScale, (unsigned int), (override));
39 MOCK_METHOD(void, OnResize, (unsigned int, unsigned int), (override));
40 MOCK_METHOD(void, OnPaint, (), (override));
43 (double, double, FlutterPointerDeviceKind, int32_t, int),
44 (override));
47 (double, double, FlutterPointerDeviceKind, int32_t, UINT),
48 (override));
51 (double, double, FlutterPointerDeviceKind, int32_t, UINT),
52 (override));
55 (double, double, FlutterPointerDeviceKind, int32_t),
56 (override));
57 MOCK_METHOD(void, OnSetCursor, (), (override));
58 MOCK_METHOD(void, OnText, (const std::u16string&), (override));
60 OnKey,
61 (int, int, int, char32_t, bool, bool, KeyEventCallback),
62 (override));
63 MOCK_METHOD(void, OnUpdateSemanticsEnabled, (bool), (override));
66 (),
67 (override));
70 (double, double, FlutterPointerDeviceKind, int32_t),
71 (override));
72 MOCK_METHOD(void, OnComposeBegin, (), (override));
73 MOCK_METHOD(void, OnComposeCommit, (), (override));
74 MOCK_METHOD(void, OnComposeEnd, (), (override));
75 MOCK_METHOD(void, OnComposeChange, (const std::u16string&, int), (override));
78 (UINT const, WPARAM const, LPARAM const),
79 (override));
80
81 MOCK_METHOD(void, OnThemeChange, (), (override));
82
85 (),
86 (override));
87
89
91
93 WPARAM const wparam,
94 LPARAM const lparam);
95
96 protected:
97 LRESULT Win32DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
98
99 private:
101};
102
103} // namespace testing
104} // namespace flutter
105
106#endif // FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_MOCK_WINDOW_H_
int count
virtual void OnPointerLeave(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id)
virtual void OnText(const std::u16string &text) override
virtual void OnThemeChange()
virtual ui::AXFragmentRootDelegateWin * GetAxFragmentRootDelegate()
virtual void OnScroll(double delta_x, double delta_y, FlutterPointerDeviceKind device_kind, int32_t device_id)
virtual void OnPointerUp(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, UINT button)
virtual void OnPointerDown(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, UINT button)
virtual void OnComposeCommit()
virtual void OnWindowStateEvent(WindowStateEvent event)
virtual void OnKey(int key, int scancode, int action, char32_t character, bool extended, bool was_down, KeyEventCallback callback) override
virtual void OnPointerMove(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, int modifiers_state)
virtual void OnComposeEnd()
virtual void OnComposeChange(const std::u16string &text, int cursor_pos)
virtual void OnImeComposition(UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual void OnDpiScale(unsigned int dpi)
virtual void OnUpdateSemanticsEnabled(bool enabled)
virtual LRESULT OnGetObject(UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual gfx::NativeViewAccessible GetNativeViewAccessible()
virtual void OnComposeBegin()
virtual void OnResize(unsigned int width, unsigned int height)
std::function< void(bool)> KeyEventCallback
Mock for the |FlutterWindow| base class.
Definition mock_window.h:17
MOCK_METHOD(void, OnComposeBegin,(),(override))
LRESULT InjectWindowMessage(UINT const message, WPARAM const wparam, LPARAM const lparam)
MOCK_METHOD(void, OnPointerLeave,(double, double, FlutterPointerDeviceKind, int32_t),(override))
MOCK_METHOD(void, OnPaint,(),(override))
MOCK_METHOD(void, OnImeComposition,(UINT const, WPARAM const, LPARAM const),(override))
MOCK_METHOD(LRESULT, OnGetObject,(UINT, WPARAM, LPARAM),(override))
MOCK_METHOD(ui::AXFragmentRootDelegateWin *, GetAxFragmentRootDelegate,(),(override))
MOCK_METHOD(void, OnThemeChange,(),(override))
MOCK_METHOD(void, OnPointerMove,(double, double, FlutterPointerDeviceKind, int32_t, int),(override))
void InjectMessageList(int count, const Win32Message *messages)
MOCK_METHOD(void, OnUpdateSemanticsEnabled,(bool),(override))
MOCK_METHOD(void, OnKey,(int, int, int, char32_t, bool, bool, KeyEventCallback),(override))
MOCK_METHOD(void, OnDpiScale,(unsigned int),(override))
MOCK_METHOD(void, OnPointerDown,(double, double, FlutterPointerDeviceKind, int32_t, UINT),(override))
MOCK_METHOD(void, OnWindowStateEvent,(WindowStateEvent),(override))
MOCK_METHOD(void, OnText,(const std::u16string &),(override))
MOCK_METHOD(void, OnResize,(unsigned int, unsigned int),(override))
MOCK_METHOD(void, OnComposeChange,(const std::u16string &, int),(override))
LRESULT Win32DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
MOCK_METHOD(void, OnScroll,(double, double, FlutterPointerDeviceKind, int32_t),(override))
void SetDirectManipulationOwner(std::unique_ptr< DirectManipulationOwner > owner)
MOCK_METHOD(gfx::NativeViewAccessible, GetNativeViewAccessible,(),(override))
MOCK_METHOD(void, OnPointerUp,(double, double, FlutterPointerDeviceKind, int32_t, UINT),(override))
MOCK_METHOD(void, OnSetCursor,(),(override))
MOCK_METHOD(void, OnComposeCommit,(),(override))
MOCK_METHOD(void, OnComposeEnd,(),(override))
void CallOnImeComposition(UINT const message, WPARAM const wparam, LPARAM const lparam)
FlutterPointerDeviceKind
The device type that created a pointer event.
Definition embedder.h:1005
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
Win32Message message
WindowStateEvent
An event representing a change in window state that may update the.
UnimplementedNativeViewAccessible * NativeViewAccessible
LONG_PTR LRESULT
unsigned int UINT
LONG_PTR LPARAM
UINT_PTR WPARAM