forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add windows embedding test (flutter#12423)
- Loading branch information
Showing
12 changed files
with
123 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
shell/platform/windows/testing/win32_flutter_window_test.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "flutter/shell/platform/windows/testing/win32_flutter_window_test.h" | ||
#include <iostream> | ||
|
||
namespace flutter { | ||
namespace testing { | ||
|
||
Win32FlutterWindowTest::Win32FlutterWindowTest(int width, int height) | ||
: Win32FlutterWindow(width, height){}; | ||
|
||
Win32FlutterWindowTest::~Win32FlutterWindowTest() = default; | ||
|
||
void Win32FlutterWindowTest::OnFontChange() { | ||
on_font_change_called_ = true; | ||
} | ||
|
||
bool Win32FlutterWindowTest::OnFontChangeWasCalled() { | ||
return on_font_change_called_; | ||
} | ||
} // namespace testing | ||
} // namespace flutter |
31 changes: 31 additions & 0 deletions
31
shell/platform/windows/testing/win32_flutter_window_test.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// 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/fml/macros.h" | ||
#include "flutter/shell/platform/windows/win32_flutter_window.h" | ||
|
||
namespace flutter { | ||
namespace testing { | ||
|
||
class Win32FlutterWindowTest : public Win32FlutterWindow { | ||
public: | ||
Win32FlutterWindowTest(int width, int height); | ||
|
||
~Win32FlutterWindowTest(); | ||
|
||
// |Win32Window| | ||
void OnFontChange() override; | ||
|
||
bool OnFontChangeWasCalled(); | ||
|
||
private: | ||
bool on_font_change_called_ = false; | ||
|
||
FML_DISALLOW_COPY_AND_ASSIGN(Win32FlutterWindowTest); | ||
}; | ||
|
||
} // namespace testing | ||
} // namespace flutter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include "flutter/shell/platform/windows/testing/win32_flutter_window_test.h" | ||
#include "gtest/gtest.h" | ||
|
||
namespace flutter { | ||
namespace testing { | ||
|
||
TEST(Win32FlutterWindowTest, CreateDestroy) { | ||
Win32FlutterWindowTest window(800, 600); | ||
ASSERT_TRUE(TRUE); | ||
} | ||
|
||
TEST(Win32FlutterWindowTest, CanFontChange) { | ||
Win32FlutterWindowTest window(800, 600); | ||
HWND hwnd = window.GetWindowHandle(); | ||
LRESULT result = SendMessage(hwnd, WM_FONTCHANGE, NULL, NULL); | ||
ASSERT_EQ(result, 0); | ||
ASSERT_TRUE(window.OnFontChangeWasCalled()); | ||
ASSERT_TRUE(TRUE); | ||
} | ||
|
||
} // namespace testing | ||
} // namespace flutter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters