ReactOS 0.4.17-dev-1321-g5c122a9
ThemeRegion.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Test for the theme window region
5 * COPYRIGHT: Copyright 2026 Mark Jansen <mark.jansen@reactos.org>
6 */
7
8#include <apitest.h>
9#include <windows.h>
10#include <uxtheme.h>
11
12static int GetRgnType(HWND hWnd)
13{
14 HRGN hrgn = CreateRectRgn(0, 0, 0, 0);
15 int ret = GetWindowRgn(hWnd, hrgn);
17 return ret;
18}
19
20static void SetCaption(HWND hWnd, BOOL bCaption)
21{
23 style = bCaption ? (style | WS_CAPTION) : (style & ~WS_CAPTION);
26}
27
28static void Resize(HWND hWnd, int size)
29{
31}
32
33START_TEST(ThemeRegion)
34{
35 HWND hWnd;
36
37 if (!IsThemeActive())
38 {
39 skip("No active theme, skipping ThemeRegion tests\n");
40 return;
41 }
42
44 100, 100, 200, 200, NULL, NULL, NULL, NULL);
45 ok(hWnd != NULL, "CreateWindowExW failed\n");
46 if (!hWnd)
47 return;
48
49 Resize(hWnd, 250);
50 if (GetRgnType(hWnd) == ERROR)
51 {
52 skip("No theme region (DWM?), skipping ThemeRegion tests\n");
54 return;
55 }
56
57 /* Removing the caption drops the theme region */
60
61 /* Restoring it brings the region back without a size change */
63 ok(GetRgnType(hWnd) != ERROR, "Expected a theme region\n");
64
65 /* And on the next resize */
66 Resize(hWnd, 260);
67 ok(GetRgnType(hWnd) != ERROR, "Expected a theme region\n");
68
69 /* An app defined region is kept */
70 SetWindowRgn(hWnd, CreateRectRgn(0, 0, 50, 50), TRUE);
73
75}
static HRGN hrgn
static void SetCaption(HWND hWnd, BOOL bCaption)
Definition: ThemeRegion.c:20
static int GetRgnType(HWND hWnd)
Definition: ThemeRegion.c:12
static void Resize(HWND hWnd, int size)
Definition: ThemeRegion.c:28
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define ok_int(expression, result)
Definition: atltest.h:134
HWND hWnd
Definition: settings.c:17
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI IsThemeActive(void)
Definition: system.c:630
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
#define ERROR(name)
Definition: error_private.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
pKey DeleteObject()
GLsizeiptr size
Definition: glext.h:5919
#define WS_CAPTION
Definition: pedump.c:624
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_VISIBLE
Definition: pedump.c:620
long LONG
Definition: pedump.c:60
#define SWP_NOACTIVATE
Definition: winuser.h:1253
#define SWP_FRAMECHANGED
Definition: winuser.h:1251
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
int WINAPI GetWindowRgn(_In_ HWND, _In_ HRGN)
int WINAPI SetWindowRgn(_In_ HWND, _In_opt_ HRGN, _In_ BOOL)
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define SWP_NOMOVE
Definition: winuser.h:1255
#define SWP_NOSIZE
Definition: winuser.h:1256
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define SWP_NOZORDER
Definition: winuser.h:1258
#define GWL_STYLE
Definition: winuser.h:863
BOOL WINAPI DestroyWindow(_In_ HWND)
Definition: style.c:91
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
#define SIMPLEREGION
Definition: wingdi.h:362