Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
flutter::testing::MockWindow Class Reference

Mock for the |FlutterWindow| base class. More...

#include <mock_window.h>

Inheritance diagram for flutter::testing::MockWindow:
flutter::FlutterWindow flutter::KeyboardManager::WindowDelegate flutter::WindowBindingHandler

Public Member Functions

 MockWindow ()
 
 MockWindow (std::unique_ptr< WindowsProcTable > windows_proc_table, std::unique_ptr< TextInputManager > text_input_manager)
 
virtual ~MockWindow ()
 
UINT GetDpi ()
 
void SetDirectManipulationOwner (std::unique_ptr< DirectManipulationOwner > owner)
 
LRESULT InjectWindowMessage (UINT const message, WPARAM const wparam, LPARAM const lparam)
 
void InjectMessageList (int count, const Win32Message *messages)
 
 MOCK_METHOD (void, OnDpiScale,(unsigned int),(override))
 
 MOCK_METHOD (void, OnResize,(unsigned int, unsigned int),(override))
 
 MOCK_METHOD (void, OnPaint,(),(override))
 
 MOCK_METHOD (void, OnPointerMove,(double, double, FlutterPointerDeviceKind, int32_t, int),(override))
 
 MOCK_METHOD (void, OnPointerDown,(double, double, FlutterPointerDeviceKind, int32_t, UINT),(override))
 
 MOCK_METHOD (void, OnPointerUp,(double, double, FlutterPointerDeviceKind, int32_t, UINT),(override))
 
 MOCK_METHOD (void, OnPointerLeave,(double, double, FlutterPointerDeviceKind, int32_t),(override))
 
 MOCK_METHOD (void, OnSetCursor,(),(override))
 
 MOCK_METHOD (void, OnText,(const std::u16string &),(override))
 
 MOCK_METHOD (void, OnKey,(int, int, int, char32_t, bool, bool, KeyEventCallback),(override))
 
 MOCK_METHOD (void, OnUpdateSemanticsEnabled,(bool),(override))
 
 MOCK_METHOD (gfx::NativeViewAccessible, GetNativeViewAccessible,(),(override))
 
 MOCK_METHOD (void, OnScroll,(double, double, FlutterPointerDeviceKind, int32_t),(override))
 
 MOCK_METHOD (void, OnComposeBegin,(),(override))
 
 MOCK_METHOD (void, OnComposeCommit,(),(override))
 
 MOCK_METHOD (void, OnComposeEnd,(),(override))
 
 MOCK_METHOD (void, OnComposeChange,(const std::u16string &, int),(override))
 
 MOCK_METHOD (void, OnImeComposition,(UINT const, WPARAM const, LPARAM const),(override))
 
 MOCK_METHOD (void, OnThemeChange,(),(override))
 
 MOCK_METHOD (ui::AXFragmentRootDelegateWin *, GetAxFragmentRootDelegate,(),(override))
 
 MOCK_METHOD (LRESULT, OnGetObject,(UINT, WPARAM, LPARAM),(override))
 
 MOCK_METHOD (void, OnWindowStateEvent,(WindowStateEvent),(override))
 
void CallOnImeComposition (UINT const message, WPARAM const wparam, LPARAM const lparam)
 
- Public Member Functions inherited from flutter::FlutterWindow
 FlutterWindow (FlutterDesktopWindowRef window)
 
 ~FlutterWindow ()=default
 
 FlutterWindow (FlutterWindow const &)=delete
 
FlutterWindowoperator= (FlutterWindow const &)=delete
 
void SetHoverEnabled (bool enabled)
 
void SetTitle (const std::string &title)
 
void SetIcon (uint8_t *pixel_data, int width, int height)
 
WindowFrame GetFrame ()
 
void SetFrame (const WindowFrame &frame)
 
double GetScaleFactor ()
 
void SetPixelRatioOverride (double pixel_ratio)
 
void SetSizeLimits (FlutterDesktopSize minimum_size, FlutterDesktopSize maximum_size)
 
 FlutterWindow (int width, int height, std::shared_ptr< WindowsProcTable > windows_proc_table=nullptr, std::unique_ptr< TextInputManager > text_input_manager=nullptr)
 
virtual ~FlutterWindow ()
 
void InitializeChild (const char *title, unsigned int width, unsigned int height)
 
virtual BOOL Win32PeekMessage (LPMSG lpMsg, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg) override
 
virtual uint32_t Win32MapVkToChar (uint32_t virtual_key) override
 
virtual UINT Win32DispatchMessage (UINT Msg, WPARAM wParam, LPARAM lParam) override
 
virtual void OnDpiScale (unsigned int dpi)
 
virtual void OnResize (unsigned int width, unsigned int height)
 
virtual void OnPaint ()
 
virtual void OnPointerMove (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, int modifiers_state)
 
virtual void OnPointerDown (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, UINT button)
 
virtual void OnPointerUp (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, UINT button)
 
virtual void OnPointerLeave (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id)
 
virtual void OnSetCursor ()
 
virtual void OnText (const std::u16string &text) override
 
virtual void OnKey (int key, int scancode, int action, char32_t character, bool extended, bool was_down, KeyEventCallback callback) override
 
virtual void OnComposeBegin ()
 
virtual void OnComposeCommit ()
 
virtual void OnComposeEnd ()
 
virtual void OnComposeChange (const std::u16string &text, int cursor_pos)
 
virtual void OnCursorRectUpdated (const Rect &rect) override
 
virtual void OnResetImeComposing () override
 
virtual void OnUpdateSemanticsEnabled (bool enabled)
 
virtual void OnScroll (double delta_x, double delta_y, FlutterPointerDeviceKind device_kind, int32_t device_id)
 
virtual gfx::NativeViewAccessible GetNativeViewAccessible ()
 
virtual void SetView (WindowBindingHandlerDelegate *view) override
 
virtual HWND GetWindowHandle () override
 
virtual float GetDpiScale () override
 
virtual PhysicalWindowBounds GetPhysicalWindowBounds () override
 
virtual void UpdateFlutterCursor (const std::string &cursor_name) override
 
virtual void SetFlutterCursor (HCURSOR cursor) override
 
virtual bool OnBitmapSurfaceCleared () override
 
virtual bool OnBitmapSurfaceUpdated (const void *allocation, size_t row_bytes, size_t height) override
 
virtual PointerLocation GetPrimaryPointerLocation () override
 
virtual void OnThemeChange ()
 
virtual AlertPlatformNodeDelegateGetAlertDelegate () override
 
virtual ui::AXPlatformNodeWin * GetAlert () override
 
virtual ui::AXFragmentRootDelegateWinGetAxFragmentRootDelegate ()
 
virtual void OnWindowStateEvent (WindowStateEvent event)
 
- Public Member Functions inherited from flutter::KeyboardManager::WindowDelegate
virtual ~WindowDelegate ()=default
 
virtual void OnText (const std::u16string &text)=0
 
virtual void OnKey (int key, int scancode, int action, char32_t character, bool extended, bool was_down, KeyEventCallback callback)=0
 
virtual BOOL Win32PeekMessage (LPMSG lpMsg, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg)=0
 
virtual uint32_t Win32MapVkToChar (uint32_t virtual_key)=0
 
virtual UINT Win32DispatchMessage (UINT Msg, WPARAM wParam, LPARAM lParam)=0
 
- Public Member Functions inherited from flutter::WindowBindingHandler
virtual ~WindowBindingHandler ()=default
 
virtual void SetView (WindowBindingHandlerDelegate *view)=0
 
virtual HWND GetWindowHandle ()=0
 
virtual float GetDpiScale ()=0
 
virtual PhysicalWindowBounds GetPhysicalWindowBounds ()=0
 
virtual void UpdateFlutterCursor (const std::string &cursor_name)=0
 
virtual void SetFlutterCursor (HCURSOR cursor)=0
 
virtual void OnCursorRectUpdated (const Rect &rect)=0
 
virtual bool OnBitmapSurfaceCleared ()=0
 
virtual bool OnBitmapSurfaceUpdated (const void *allocation, size_t row_bytes, size_t height)=0
 
virtual void OnResetImeComposing ()=0
 
virtual PointerLocation GetPrimaryPointerLocation ()=0
 
virtual AlertPlatformNodeDelegateGetAlertDelegate ()=0
 
virtual ui::AXPlatformNodeWin * GetAlert ()=0
 

Protected Member Functions

LRESULT Win32DefWindowProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
- Protected Member Functions inherited from flutter::FlutterWindow
 FlutterWindow ()
 
virtual LRESULT Win32DefWindowProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
std::wstring NarrowToWide (const char *source)
 
LRESULT HandleMessage (UINT const message, WPARAM const wparam, LPARAM const lparam) noexcept
 
virtual LRESULT OnGetObject (UINT const message, WPARAM const wparam, LPARAM const lparam)
 
virtual void OnImeSetContext (UINT const message, WPARAM const wparam, LPARAM const lparam)
 
virtual void OnImeStartComposition (UINT const message, WPARAM const wparam, LPARAM const lparam)
 
virtual void OnImeComposition (UINT const message, WPARAM const wparam, LPARAM const lparam)
 
virtual void OnImeEndComposition (UINT const message, WPARAM const wparam, LPARAM const lparam)
 
virtual void OnImeRequest (UINT const message, WPARAM const wparam, LPARAM const lparam)
 
virtual void AbortImeComposing ()
 
virtual void UpdateCursorRect (const Rect &rect)
 
UINT GetCurrentDPI ()
 
UINT GetCurrentWidth ()
 
UINT GetCurrentHeight ()
 
virtual float GetScrollOffsetMultiplier ()
 

Additional Inherited Members

- Public Types inherited from flutter::KeyboardManager::WindowDelegate
using KeyEventCallback = std::function< void(bool)>
 
- Protected Attributes inherited from flutter::FlutterWindow
std::unique_ptr< AlertPlatformNodeDelegatealert_delegate_
 
std::unique_ptr< ui::AXPlatformNodeWin > alert_node_
 
std::unique_ptr< DirectManipulationOwnerdirect_manipulation_owner_
 

Detailed Description

Mock for the |FlutterWindow| base class.

Definition at line 17 of file mock_window.h.

Constructor & Destructor Documentation

◆ MockWindow() [1/2]

flutter::testing::MockWindow::MockWindow ( )

Definition at line 9 of file mock_window.cc.

◆ MockWindow() [2/2]

flutter::testing::MockWindow::MockWindow ( std::unique_ptr< WindowsProcTable windows_proc_table,
std::unique_ptr< TextInputManager text_input_manager 
)

Definition at line 10 of file mock_window.cc.

12 : FlutterWindow(1,
13 1,
14 std::move(window_proc_table),
15 std::move(text_input_manager)){};

◆ ~MockWindow()

flutter::testing::MockWindow::~MockWindow ( )
virtualdefault

Member Function Documentation

◆ CallOnImeComposition()

void flutter::testing::MockWindow::CallOnImeComposition ( UINT const  message,
WPARAM const  wparam,
LPARAM const  lparam 
)

Definition at line 52 of file mock_window.cc.

54 {
56}
virtual void OnImeComposition(UINT const message, WPARAM const wparam, LPARAM const lparam)
Win32Message message

◆ GetDpi()

UINT flutter::testing::MockWindow::GetDpi ( )

Definition at line 19 of file mock_window.cc.

19 {
20 return GetCurrentDPI();
21}

◆ InjectMessageList()

void flutter::testing::MockWindow::InjectMessageList ( int  count,
const Win32Message messages 
)

Definition at line 41 of file mock_window.cc.

41 {
42 for (int message_id = 0; message_id < count; message_id += 1) {
43 const Win32Message& message = messages[message_id];
45 InjectWindowMessage(message.message, message.wParam, message.lParam);
46 if (message.expected_result != kWmResultDontCheck) {
47 EXPECT_EQ(result, message.expected_result);
48 }
49 }
50}
int count
Definition: FontMgrTest.cpp:50
LRESULT InjectWindowMessage(UINT const message, WPARAM const wparam, LPARAM const lparam)
Definition: mock_window.cc:35
GAsyncResult * result
constexpr LRESULT kWmResultDontCheck
Definition: wm_builders.h:16
LONG_PTR LRESULT
Definition: windows_types.h:61

◆ InjectWindowMessage()

LRESULT flutter::testing::MockWindow::InjectWindowMessage ( UINT const  message,
WPARAM const  wparam,
LPARAM const  lparam 
)

Definition at line 35 of file mock_window.cc.

37 {
38 return HandleMessage(message, wparam, lparam);
39}
LRESULT HandleMessage(UINT const message, WPARAM const wparam, LPARAM const lparam) noexcept

◆ MOCK_METHOD() [1/22]

flutter::testing::MockWindow::MOCK_METHOD ( gfx::NativeViewAccessible  ,
GetNativeViewAccessible  ,
()  ,
(override)   
)

◆ MOCK_METHOD() [2/22]

flutter::testing::MockWindow::MOCK_METHOD ( LRESULT  ,
OnGetObject  ,
(UINT, WPARAM, LPARAM ,
(override)   
)

◆ MOCK_METHOD() [3/22]

flutter::testing::MockWindow::MOCK_METHOD ( ui::AXFragmentRootDelegateWin ,
GetAxFragmentRootDelegate  ,
()  ,
(override)   
)

◆ MOCK_METHOD() [4/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnComposeBegin  ,
()  ,
(override)   
)

◆ MOCK_METHOD() [5/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnComposeChange  ,
(const std::u16string &, int ,
(override)   
)

◆ MOCK_METHOD() [6/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnComposeCommit  ,
()  ,
(override)   
)

◆ MOCK_METHOD() [7/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnComposeEnd  ,
()  ,
(override)   
)

◆ MOCK_METHOD() [8/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnDpiScale  ,
(unsigned int ,
(override)   
)

◆ MOCK_METHOD() [9/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnImeComposition  ,
(UINT const, WPARAM const, LPARAM const)  ,
(override)   
)

◆ MOCK_METHOD() [10/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnKey  ,
(int, int, int, char32_t, bool, bool, KeyEventCallback ,
(override)   
)

◆ MOCK_METHOD() [11/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnPaint  ,
()  ,
(override)   
)

◆ MOCK_METHOD() [12/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnPointerDown  ,
(double, double, FlutterPointerDeviceKind, int32_t, UINT ,
(override)   
)

◆ MOCK_METHOD() [13/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnPointerLeave  ,
(double, double, FlutterPointerDeviceKind, int32_t)  ,
(override)   
)

◆ MOCK_METHOD() [14/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnPointerMove  ,
(double, double, FlutterPointerDeviceKind, int32_t, int ,
(override)   
)

◆ MOCK_METHOD() [15/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnPointerUp  ,
(double, double, FlutterPointerDeviceKind, int32_t, UINT ,
(override)   
)

◆ MOCK_METHOD() [16/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnResize  ,
(unsigned int, unsigned int ,
(override)   
)

◆ MOCK_METHOD() [17/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnScroll  ,
(double, double, FlutterPointerDeviceKind, int32_t)  ,
(override)   
)

◆ MOCK_METHOD() [18/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnSetCursor  ,
()  ,
(override)   
)

◆ MOCK_METHOD() [19/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnText  ,
(const std::u16string &)  ,
(override)   
)

◆ MOCK_METHOD() [20/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnThemeChange  ,
()  ,
(override)   
)

◆ MOCK_METHOD() [21/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnUpdateSemanticsEnabled  ,
(bool)  ,
(override)   
)

◆ MOCK_METHOD() [22/22]

flutter::testing::MockWindow::MOCK_METHOD ( void  ,
OnWindowStateEvent  ,
(WindowStateEvent ,
(override)   
)

◆ SetDirectManipulationOwner()

void flutter::testing::MockWindow::SetDirectManipulationOwner ( std::unique_ptr< DirectManipulationOwner owner)

Definition at line 30 of file mock_window.cc.

31 {
32 direct_manipulation_owner_ = std::move(owner);
33}
std::unique_ptr< DirectManipulationOwner > direct_manipulation_owner_

◆ Win32DefWindowProc()

LRESULT flutter::testing::MockWindow::Win32DefWindowProc ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)
protectedvirtual

Reimplemented from flutter::FlutterWindow.

Definition at line 23 of file mock_window.cc.

26 {
27 return kWmResultDefault;
28}
constexpr LRESULT kWmResultDefault
Definition: wm_builders.h:15

The documentation for this class was generated from the following files: