Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
windows_lifecycle_manager_unittests.cc
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 "flutter/shell/platform/windows/windows_lifecycle_manager.h"
6
7#include "flutter/shell/platform/windows/testing/windows_test.h"
8#include "gtest/gtest.h"
9
10namespace flutter {
11namespace testing {
12
14
17 HWND win1 = reinterpret_cast<HWND>(1);
18 HWND win2 = reinterpret_cast<HWND>(2);
19
20 // Hidden to inactive upon window shown.
21 manager.SetLifecycleState(AppLifecycleState::kHidden);
22 manager.OnWindowStateEvent(win1, WindowStateEvent::kShow);
23 EXPECT_EQ(manager.GetLifecycleState(), AppLifecycleState::kInactive);
24
25 // Showing a second window does not change state.
26 manager.OnWindowStateEvent(win2, WindowStateEvent::kShow);
27 EXPECT_EQ(manager.GetLifecycleState(), AppLifecycleState::kInactive);
28
29 // Inactive to resumed upon window focus.
30 manager.OnWindowStateEvent(win2, WindowStateEvent::kFocus);
31 EXPECT_EQ(manager.GetLifecycleState(), AppLifecycleState::kResumed);
32
33 // Showing a second window does not change state.
34 manager.OnWindowStateEvent(win1, WindowStateEvent::kFocus);
35 EXPECT_EQ(manager.GetLifecycleState(), AppLifecycleState::kResumed);
36
37 // Unfocusing one window does not change state while another is focused.
38 manager.OnWindowStateEvent(win1, WindowStateEvent::kUnfocus);
39 EXPECT_EQ(manager.GetLifecycleState(), AppLifecycleState::kResumed);
40
41 // Unfocusing final remaining focused window transitions to inactive.
42 manager.OnWindowStateEvent(win2, WindowStateEvent::kUnfocus);
43 EXPECT_EQ(manager.GetLifecycleState(), AppLifecycleState::kInactive);
44
45 // Hiding one of two visible windows does not change state.
46 manager.OnWindowStateEvent(win2, WindowStateEvent::kHide);
47 EXPECT_EQ(manager.GetLifecycleState(), AppLifecycleState::kInactive);
48
49 // Hiding only visible window transitions to hidden.
50 manager.OnWindowStateEvent(win1, WindowStateEvent::kHide);
51 EXPECT_EQ(manager.GetLifecycleState(), AppLifecycleState::kHidden);
52
53 // Transition directly from resumed to hidden when the window is hidden.
54 manager.OnWindowStateEvent(win1, WindowStateEvent::kShow);
55 manager.OnWindowStateEvent(win1, WindowStateEvent::kFocus);
56 manager.OnWindowStateEvent(win1, WindowStateEvent::kHide);
57 EXPECT_EQ(manager.GetLifecycleState(), AppLifecycleState::kHidden);
58}
59
60} // namespace testing
61} // namespace flutter
TEST_F(DisplayListTest, Defaults)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font manager
Definition switches.h:218