10#include "gtest/gtest.h"
17class TestWindowsApi :
public testing::StubFlutterWindowsApi {
28 void ViewControllerDestroy()
override { view_controller_destroyed_ =
true; }
31 void ViewControllerForceRedraw()
override {
32 view_controller_force_redrawed_ =
true;
42 bool EngineDestroy()
override {
43 engine_destroyed_ =
true;
47 bool engine_destroyed() {
return engine_destroyed_; }
48 bool view_controller_destroyed() {
return view_controller_destroyed_; }
49 bool view_controller_force_redrawed() {
50 return view_controller_force_redrawed_;
54 bool engine_destroyed_ =
false;
55 bool view_controller_destroyed_ =
false;
56 bool view_controller_force_redrawed_ =
false;
62 DartProject project(L
"data");
63 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
64 std::make_unique<TestWindowsApi>());
65 auto test_api =
static_cast<TestWindowsApi*
>(scoped_api_stub.stub());
69 EXPECT_TRUE(test_api->view_controller_destroyed());
72 EXPECT_FALSE(test_api->engine_destroyed());
78 std::make_unique<TestWindowsApi>());
79 auto test_api =
static_cast<TestWindowsApi*
>(scoped_api_stub.
stub());
81 EXPECT_EQ(controller.
view_id(), 1);
87 std::make_unique<TestWindowsApi>());
88 auto test_api =
static_cast<TestWindowsApi*
>(scoped_api_stub.
stub());
90 EXPECT_NE(controller.
engine(),
nullptr);
96 std::make_unique<TestWindowsApi>());
97 auto test_api =
static_cast<TestWindowsApi*
>(scoped_api_stub.
stub());
99 EXPECT_NE(controller.
view(),
nullptr);
105 std::make_unique<TestWindowsApi>());
106 auto test_api =
static_cast<TestWindowsApi*
>(scoped_api_stub.
stub());
110 EXPECT_TRUE(test_api->view_controller_force_redrawed());
FlutterView * view() const
FlutterEngine * engine() const
FlutterViewId view_id() const
StubFlutterWindowsApi * stub()
struct FlutterDesktopViewController * FlutterDesktopViewControllerRef
TEST(FrameTimingsRecorderTest, RecordVsync)