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 all commits
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
4 changes: 2 additions & 2 deletions shell/platform/windows/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ executable("flutter_windows_unittests") {
sources = [
"string_conversion_unittests.cc",
"system_utils_unittests.cc",
"testing/mock_win32_window.cc",
"testing/mock_win32_window.h",
"testing/win32_flutter_window_test.cc",
"testing/win32_flutter_window_test.h",
"testing/win32_window_test.cc",
"testing/win32_window_test.h",
"win32_dpi_utils_unittests.cc",
"win32_flutter_window_unittests.cc",
"win32_window_proc_delegate_manager_unittests.cc",
Expand Down
21 changes: 21 additions & 0 deletions shell/platform/windows/testing/mock_win32_window.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "flutter/shell/platform/windows/testing/mock_win32_window.h"

namespace flutter {
namespace testing {

MockWin32Window::MockWin32Window() : Win32Window(){};

MockWin32Window::~MockWin32Window() = default;

UINT MockWin32Window::GetDpi() {
return GetCurrentDPI();
}

void MockWin32Window::InjectWindowMessage(UINT const message,
WPARAM const wparam,
LPARAM const lparam) {
HandleMessage(message, wparam, lparam);
}

} // namespace testing
} // namespace flutter
45 changes: 45 additions & 0 deletions shell/platform/windows/testing/mock_win32_window.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <windowsx.h>

#include "flutter/shell/platform/windows/win32_window.h"
#include "gmock/gmock.h"

namespace flutter {
namespace testing {

/// Mock for the Win32Window base class.
class MockWin32Window : public Win32Window {
public:
MockWin32Window();
virtual ~MockWin32Window();

// Prevent copying.
MockWin32Window(MockWin32Window const&) = delete;
MockWin32Window& operator=(MockWin32Window const&) = delete;

// Wrapper for GetCurrentDPI() which is a protected method.
UINT GetDpi();

// Simulates a WindowProc message from the OS.
void InjectWindowMessage(UINT const message,
WPARAM const wparam,
LPARAM const lparam);

MOCK_METHOD1(OnDpiScale, void(unsigned int));
MOCK_METHOD2(OnResize, void(unsigned int, unsigned int));
MOCK_METHOD2(OnPointerMove, void(double, double));
MOCK_METHOD3(OnPointerDown, void(double, double, UINT));
MOCK_METHOD3(OnPointerUp, void(double, double, UINT));
MOCK_METHOD0(OnPointerLeave, void());
MOCK_METHOD0(OnSetCursor, void());
MOCK_METHOD1(OnText, void(const std::u16string&));
MOCK_METHOD4(OnKey, void(int, int, int, char32_t));
MOCK_METHOD2(OnScroll, void(double, double));
MOCK_METHOD0(OnFontChange, void());
};

} // namespace testing
} // namespace flutter
40 changes: 0 additions & 40 deletions shell/platform/windows/testing/win32_window_test.cc

This file was deleted.

61 changes: 0 additions & 61 deletions shell/platform/windows/testing/win32_window_test.h

This file was deleted.

Loading