xref: /aosp_15_r20/external/webrtc/modules/desktop_capture/win/test_support/test_window.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 #ifndef MODULES_DESKTOP_CAPTURE_WIN_TEST_SUPPORT_TEST_WINDOW_H_
11 #define MODULES_DESKTOP_CAPTURE_WIN_TEST_SUPPORT_TEST_WINDOW_H_
12 
13 #ifndef WIN32_LEAN_AND_MEAN
14 #define WIN32_LEAN_AND_MEAN
15 #endif
16 #include <windows.h>
17 
18 namespace webrtc {
19 
20 typedef unsigned char uint8_t;
21 
22 // Define an arbitrary color for the test window with unique R, G, and B values
23 // so consumers can verify captured content in tests.
24 const uint8_t kTestWindowRValue = 191;
25 const uint8_t kTestWindowGValue = 99;
26 const uint8_t kTestWindowBValue = 12;
27 
28 struct WindowInfo {
29   HWND hwnd;
30   HINSTANCE window_instance;
31   ATOM window_class;
32 };
33 
34 WindowInfo CreateTestWindow(const WCHAR* window_title,
35                             int height = 0,
36                             int width = 0,
37                             LONG extended_styles = 0);
38 
39 void ResizeTestWindow(HWND hwnd, int width, int height);
40 
41 void MoveTestWindow(HWND hwnd, int x, int y);
42 
43 void MinimizeTestWindow(HWND hwnd);
44 
45 void UnminimizeTestWindow(HWND hwnd);
46 
47 void DestroyTestWindow(WindowInfo info);
48 
49 }  // namespace webrtc
50 
51 #endif  // MODULES_DESKTOP_CAPTURE_WIN_TEST_SUPPORT_TEST_WINDOW_H_
52