Flutter Engine
mock_win32_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 #include <windowsx.h>
6 
7 #include "flutter/shell/platform/windows/win32_window.h"
8 #include "gmock/gmock.h"
9 
10 namespace flutter {
11 namespace testing {
12 
13 /// Mock for the Win32Window base class.
14 class MockWin32Window : public Win32Window {
15  public:
17  virtual ~MockWin32Window();
18 
19  // Prevent copying.
20  MockWin32Window(MockWin32Window const&) = delete;
21  MockWin32Window& operator=(MockWin32Window const&) = delete;
22 
23  // Wrapper for GetCurrentDPI() which is a protected method.
24  UINT GetDpi();
25 
26  // Simulates a WindowProc message from the OS.
27  void InjectWindowMessage(UINT const message,
28  WPARAM const wparam,
29  LPARAM const lparam);
30 
31  MOCK_METHOD1(OnDpiScale, void(unsigned int));
32  MOCK_METHOD2(OnResize, void(unsigned int, unsigned int));
33  MOCK_METHOD2(OnPointerMove, void(double, double));
34  MOCK_METHOD3(OnPointerDown, void(double, double, UINT));
35  MOCK_METHOD3(OnPointerUp, void(double, double, UINT));
37  MOCK_METHOD0(OnSetCursor, void());
38  MOCK_METHOD1(OnText, void(const std::u16string&));
39  MOCK_METHOD4(OnKey, void(int, int, int, char32_t));
40  MOCK_METHOD2(OnScroll, void(double, double));
41 };
42 
43 } // namespace testing
44 } // namespace flutter
void InjectWindowMessage(UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual void OnDpiScale(UINT dpi)=0
virtual void OnSetCursor()=0
virtual void OnText(const std::u16string &text)=0
virtual void OnKey(int key, int scancode, int action, char32_t character)=0
MOCK_METHOD3(OnPointerDown, void(double, double, UINT))
virtual void OnPointerUp(double x, double y, UINT button)=0
virtual void OnScroll(double delta_x, double delta_y)=0
MOCK_METHOD0(OnPointerLeave, void())
MOCK_METHOD2(OnResize, void(unsigned int, unsigned int))
MockWin32Window & operator=(MockWin32Window const &)=delete
MOCK_METHOD1(OnDpiScale, void(unsigned int))
virtual void OnPointerLeave()=0
virtual void OnPointerDown(double x, double y, UINT button)=0
MOCK_METHOD4(OnKey, void(int, int, int, char32_t))
virtual void OnResize(UINT width, UINT height)=0
Mock for the Win32Window base class.
virtual void OnPointerMove(double x, double y)=0