|
| 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: |
| 16 | + MockWin32Window(); |
| 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)); |
| 36 | + MOCK_METHOD0(OnPointerLeave, void()); |
| 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 | + MOCK_METHOD0(OnFontChange, void()); |
| 42 | +}; |
| 43 | + |
| 44 | +} // namespace testing |
| 45 | +} // namespace flutter |
0 commit comments