ReactOS  0.4.14-dev-583-g2a1ba2c
system.c File Reference
#include <stdarg.h>
#include "windows.h"
#include "vfwmsgs.h"
#include "uxtheme.h"
#include "wine/test.h"
Include dependency graph for system.c:

Go to the source code of this file.

Macros

#define UXTHEME_GET_PROC(func)   p ## func = (void*)GetProcAddress(hUxtheme, #func)
 

Functions

static HTHEME (WINAPI *pOpenThemeDataEx)(HWND
 
static HPAINTBUFFER (WINAPI *pBeginBufferedPaint)(HDC
 
static const RECT BP_PAINTPARAMS HDC *static HRESULT (WINAPI *pBufferedPaintClear)(HPAINTBUFFER
 
static RGBQUAD int *static HDC (WINAPI *pGetBufferedPaintDC)(HPAINTBUFFER)
 
static RECT *static void init_funcs (void)
 
static void test_IsThemed (void)
 
static void test_GetWindowTheme (void)
 
static void test_SetWindowTheme (void)
 
static void test_OpenThemeData (void)
 
static void test_OpenThemeDataEx (void)
 
static void test_GetCurrentThemeName (void)
 
static void test_CloseThemeData (void)
 
static void test_buffer_dc_props (HDC hdc, const RECT *rect)
 
static void test_buffered_paint (void)
 
 START_TEST (system)
 

Variables

static LPCWSTR
 
static DWORD
 
static const RECT BP_BUFFERFORMAT
 
static const RECT BP_PAINTPARAMS HDC *static const RECT *static BOOL
 

Macro Definition Documentation

◆ UXTHEME_GET_PROC

#define UXTHEME_GET_PROC (   func)    p ## func = (void*)GetProcAddress(hUxtheme, #func)

Function Documentation

◆ HDC()

static RGBQUAD int* static HDC ( WINAPI pGetBufferedPaintDC)
static

Referenced by test_buffered_paint().

◆ HPAINTBUFFER()

static HPAINTBUFFER ( WINAPI pBeginBufferedPaint)
static

Referenced by test_buffered_paint().

◆ HRESULT()

static const RECT BP_PAINTPARAMS HDC* static HRESULT ( WINAPI pBufferedPaintClear)
static

◆ HTHEME()

◆ init_funcs()

static RECT* static void init_funcs ( void  )
static

Definition at line 38 of file system.c.

39 {
40  HMODULE hUxtheme = GetModuleHandleA("uxtheme.dll");
41 
42 #define UXTHEME_GET_PROC(func) p ## func = (void*)GetProcAddress(hUxtheme, #func)
51 
53 #undef UXTHEME_GET_PROC
54 }
HRESULT WINAPI EndBufferedPaint(HPAINTBUFFER hPaintBuffer, BOOL fUpdateTarget)
Definition: buffer.c:65
#define UXTHEME_GET_PROC(func)
HDC WINAPI GetBufferedPaintTargetDC(HPAINTBUFFER hBufferedPaint)
Definition: buffer.c:113
HRESULT WINAPI GetBufferedPaintTargetRect(HPAINTBUFFER hBufferedPaint, RECT *prc)
Definition: buffer.c:122
HRESULT WINAPI BufferedPaintClear(HPAINTBUFFER hBufferedPaint, const RECT *prc)
Definition: buffer.c:76
HRESULT WINAPI GetBufferedPaintBits(HPAINTBUFFER hBufferedPaint, RGBQUAD **ppbBuffer, int *pcxRow)
Definition: buffer.c:94
HTHEME WINAPI OpenThemeDataEx(HWND hwnd, LPCWSTR pszClassList, DWORD flags)
Definition: system.c:819
HDC WINAPI GetBufferedPaintDC(HPAINTBUFFER hBufferedPaint)
Definition: buffer.c:104
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
HPAINTBUFFER WINAPI BeginBufferedPaint(HDC hdcTarget, const RECT *prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS *pPaintParams, HDC *phdc)
Definition: buffer.c:44

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( system  )

Definition at line 735 of file system.c.

736 {
737  init_funcs();
738 
739  /* No real functional theme API tests will be done (yet). The current tests
740  * only show input/return behaviour
741  */
742 
743  test_IsThemed();
751 }
static void test_GetCurrentThemeName(void)
Definition: system.c:416
static void test_IsThemed(void)
Definition: system.c:56
static void test_SetWindowTheme(void)
Definition: system.c:103
static void test_buffered_paint(void)
Definition: system.c:537
static void test_OpenThemeDataEx(void)
Definition: system.c:275
static void test_CloseThemeData(void)
Definition: system.c:500
static void test_OpenThemeData(void)
Definition: system.c:122
static void test_GetWindowTheme(void)
Definition: system.c:76
static RECT *static void init_funcs(void)
Definition: system.c:38

◆ test_buffer_dc_props()

static void test_buffer_dc_props ( HDC  hdc,
const RECT rect 
)
static

Definition at line 510 of file system.c.

511 {
512  static const XFORM ident = { 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f };
513  XFORM xform;
514  POINT org;
515  RECT box;
516  BOOL ret;
517 
518  ret = GetWorldTransform(hdc, &xform);
519  ok(ret, "Failed to get world transform\n");
520  ok(!memcmp(&xform, &ident, sizeof(xform)), "Unexpected world transform\n");
521 
523  ok(ret, "Failed to get vport origin\n");
524  ok(org.x == 0 && org.y == 0, "Unexpected vport origin\n");
525 
526  ret = GetWindowOrgEx(hdc, &org);
527  ok(ret, "Failed to get vport origin\n");
528  ok(org.x == rect->left && org.y == rect->top, "Unexpected window origin\n");
529 
530  ret = GetClipBox(hdc, &box);
531  ok(ret, "Failed to get clip box\n");
532  ok(box.left == rect->left && box.top == rect->top, "Unexpected clip box\n");
533 
534  ok(GetGraphicsMode(hdc) == GM_COMPATIBLE, "wrong graphics mode\n");
535 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
BOOL WINAPI GetWindowOrgEx(_In_ HDC, _Out_ LPPOINT)
Definition: coord.c:439
& rect
Definition: startmenu.cpp:1413
static char org[]
Definition: encode.c:7456
unsigned int BOOL
Definition: ntddk_ex.h:94
_In_ ULONG _In_ ULONG_PTR ident
Definition: winddi.h:3993
BOOL WINAPI GetWorldTransform(_In_ HDC, _Out_ LPXFORM)
Definition: coord.c:278
int WINAPI GetGraphicsMode(_In_ HDC)
BOOL WINAPI GetViewportOrgEx(_In_ HDC, _Out_ LPPOINT)
Definition: coord.c:383
int WINAPI GetClipBox(_In_ HDC, _Out_ LPRECT)
#define GM_COMPATIBLE
Definition: wingdi.h:863
int ret
HDC hdc
Definition: main.c:9
#define ok(value,...)
Definition: atltest.h:57
Definition: palette.c:467

Referenced by test_buffered_paint().

◆ test_buffered_paint()

static void test_buffered_paint ( void  )
static

Definition at line 537 of file system.c.

538 {
539  HDC target, src, hdc, screen_dc;
540  BP_PAINTPARAMS params = { 0 };
543  RECT rect, rect2;
544  RGBQUAD *bits;
545  HBITMAP hbm;
546  HRESULT hr;
547  int row;
548 
549  if (!pBeginBufferedPaint)
550  {
551  win_skip("Buffered painting API is not supported.\n");
552  return;
553  }
554 
555  buffer = pBeginBufferedPaint(NULL, NULL, BPBF_COMPATIBLEBITMAP,
556  NULL, NULL);
557  ok(buffer == NULL, "Unexpected buffer %p\n", buffer);
558 
560  buffer = pBeginBufferedPaint(target, NULL, BPBF_COMPATIBLEBITMAP,
561  NULL, NULL);
562  ok(buffer == NULL, "Unexpected buffer %p\n", buffer);
563 
564  params.cbSize = sizeof(params);
565  buffer = pBeginBufferedPaint(target, NULL, BPBF_COMPATIBLEBITMAP,
566  &params, NULL);
567  ok(buffer == NULL, "Unexpected buffer %p\n", buffer);
568 
569  src = (void *)0xdeadbeef;
570  buffer = pBeginBufferedPaint(target, NULL, BPBF_COMPATIBLEBITMAP,
571  &params, &src);
572  ok(buffer == NULL, "Unexpected buffer %p\n", buffer);
573  ok(src == NULL, "Unexpected buffered dc %p\n", src);
574 
575  /* target rect is mandatory */
576  SetRectEmpty(&rect);
577  src = (void *)0xdeadbeef;
578  buffer = pBeginBufferedPaint(target, &rect, BPBF_COMPATIBLEBITMAP,
579  &params, &src);
580  ok(buffer == NULL, "Unexpected buffer %p\n", buffer);
581  ok(src == NULL, "Unexpected buffered dc %p\n", src);
582 
583  /* inverted rectangle */
584  SetRect(&rect, 10, 0, 5, 5);
585  src = (void *)0xdeadbeef;
586  buffer = pBeginBufferedPaint(target, &rect, BPBF_COMPATIBLEBITMAP,
587  &params, &src);
588  ok(buffer == NULL, "Unexpected buffer %p\n", buffer);
589  ok(src == NULL, "Unexpected buffered dc %p\n", src);
590 
591  SetRect(&rect, 0, 10, 5, 0);
592  src = (void *)0xdeadbeef;
593  buffer = pBeginBufferedPaint(target, &rect, BPBF_COMPATIBLEBITMAP,
594  &params, &src);
595  ok(buffer == NULL, "Unexpected buffer %p\n", buffer);
596  ok(src == NULL, "Unexpected buffered dc %p\n", src);
597 
598  /* valid rectangle, no target dc */
599  SetRect(&rect, 0, 0, 5, 5);
600  src = (void *)0xdeadbeef;
601  buffer = pBeginBufferedPaint(NULL, &rect, BPBF_COMPATIBLEBITMAP,
602  &params, &src);
603  ok(buffer == NULL, "Unexpected buffer %p\n", buffer);
604  ok(src == NULL, "Unexpected buffered dc %p\n", src);
605 
606  SetRect(&rect, 0, 0, 5, 5);
607  src = NULL;
608  buffer = pBeginBufferedPaint(target, &rect, BPBF_COMPATIBLEBITMAP,
609  &params, &src);
610  ok(buffer != NULL, "Unexpected buffer %p\n", buffer);
611  ok(src != NULL, "Expected buffered dc\n");
612  hr = pEndBufferedPaint(buffer, FALSE);
613  ok(hr == S_OK, "Unexpected return code %#x\n", hr);
614 
615  SetRect(&rect, 0, 0, 5, 5);
616  buffer = pBeginBufferedPaint(target, &rect, BPBF_COMPATIBLEBITMAP,
617  &params, &src);
618  ok(buffer != NULL, "Unexpected buffer %p\n", buffer);
619 
620  /* clearing */
621  hr = pBufferedPaintClear(NULL, NULL);
622 todo_wine
623  ok(hr == E_FAIL, "Unexpected return code %#x\n", hr);
624 
625  hr = pBufferedPaintClear(buffer, NULL);
626 todo_wine
627  ok(hr == S_OK, "Unexpected return code %#x\n", hr);
628 
629  /* access buffer attributes */
630  hdc = pGetBufferedPaintDC(buffer);
631  ok(hdc == src, "Unexpected hdc, %p, buffered dc %p\n", hdc, src);
632 
633  hdc = pGetBufferedPaintTargetDC(buffer);
634  ok(hdc == target, "Unexpected target hdc %p, original %p\n", hdc, target);
635 
636  hr = pGetBufferedPaintTargetRect(NULL, NULL);
637  ok(hr == E_POINTER, "Unexpected return code %#x\n", hr);
638 
639  hr = pGetBufferedPaintTargetRect(buffer, NULL);
640  ok(hr == E_POINTER, "Unexpected return code %#x\n", hr);
641 
642  hr = pGetBufferedPaintTargetRect(NULL, &rect2);
643  ok(hr == E_FAIL, "Unexpected return code %#x\n", hr);
644 
646  hr = pGetBufferedPaintTargetRect(buffer, &rect2);
647  ok(hr == S_OK, "Unexpected return code %#x\n", hr);
648  ok(EqualRect(&rect, &rect2), "Wrong target rect\n");
649 
650  hr = pEndBufferedPaint(buffer, FALSE);
651  ok(hr == S_OK, "Unexpected return code %#x\n", hr);
652 
653  /* invalid buffer handle */
654  hr = pEndBufferedPaint(NULL, FALSE);
655  ok(hr == E_INVALIDARG, "Unexpected return code %#x\n", hr);
656 
657  hdc = pGetBufferedPaintDC(NULL);
658  ok(hdc == NULL, "Unexpected hdc %p\n", hdc);
659 
660  hdc = pGetBufferedPaintTargetDC(NULL);
661  ok(hdc == NULL, "Unexpected target hdc %p\n", hdc);
662 
663  hr = pGetBufferedPaintTargetRect(NULL, &rect2);
664  ok(hr == E_FAIL, "Unexpected return code %#x\n", hr);
665 
666  hr = pGetBufferedPaintTargetRect(NULL, NULL);
667  ok(hr == E_POINTER, "Unexpected return code %#x\n", hr);
668 
669  bits = (void *)0xdeadbeef;
670  row = 10;
671  hr = pGetBufferedPaintBits(NULL, &bits, &row);
672  ok(hr == E_FAIL, "Unexpected return code %#x\n", hr);
673  ok(row == 10, "Unexpected row count %d\n", row);
674  ok(bits == (void *)0xdeadbeef, "Unexpected data pointer %p\n", bits);
675 
676  hr = pGetBufferedPaintBits(NULL, NULL, NULL);
677  ok(hr == E_POINTER, "Unexpected return code %#x\n", hr);
678 
679  hr = pGetBufferedPaintBits(NULL, &bits, NULL);
680  ok(hr == E_POINTER, "Unexpected return code %#x\n", hr);
681 
682  hr = pGetBufferedPaintBits(NULL, NULL, &row);
683  ok(hr == E_POINTER, "Unexpected return code %#x\n", hr);
684 
685  screen_dc = GetDC(0);
686 
687  hdc = CreateCompatibleDC(screen_dc);
688  ok(hdc != NULL, "Failed to create a DC\n");
689  hbm = CreateCompatibleBitmap(screen_dc, 64, 64);
690  ok(hbm != NULL, "Failed to create a bitmap\n");
691  SelectObject(hdc, hbm);
692 
693  ReleaseDC(0, screen_dc);
694 
695  SetRect(&rect, 1, 2, 34, 56);
696 
697  buffer = pBeginBufferedPaint(hdc, &rect, BPBF_COMPATIBLEBITMAP, NULL, &src);
699  hr = pEndBufferedPaint(buffer, FALSE);
700  ok(hr == S_OK, "Unexpected return code %#x\n", hr);
701 
702  DeleteObject(hbm);
703  DeleteDC(hdc);
704 
705  buffer = pBeginBufferedPaint(target, &rect, BPBF_COMPATIBLEBITMAP, NULL, &src);
707  hr = pEndBufferedPaint(buffer, FALSE);
708  ok(hr == S_OK, "Unexpected return code %#x\n", hr);
709 
710  /* access buffer bits */
711  for (format = BPBF_COMPATIBLEBITMAP; format <= BPBF_TOPDOWNMONODIB; format++)
712  {
713  buffer = pBeginBufferedPaint(target, &rect, format, &params, &src);
714 
715  /* only works for DIB buffers */
716  bits = NULL;
717  row = 0;
718  hr = pGetBufferedPaintBits(buffer, &bits, &row);
720  ok(hr == E_FAIL, "Unexpected return code %#x\n", hr);
721  else
722  {
723  ok(hr == S_OK, "Unexpected return code %#x\n", hr);
724  ok(bits != NULL, "Bitmap bits %p\n", bits);
725  ok(row >= (rect.right - rect.left), "format %d: bitmap width %d\n", format, row);
726  }
727 
728  hr = pEndBufferedPaint(buffer, FALSE);
729  ok(hr == S_OK, "Unexpected return code %#x\n", hr);
730  }
731 
732  DeleteDC(target);
733 }
RECT rect2
Definition: edittest.c:51
HRESULT hr
Definition: shlfolder.c:183
static const RECT BP_BUFFERFORMAT
Definition: system.c:30
HDC WINAPI GetDC(_In_opt_ HWND)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLuint buffer
Definition: glext.h:5915
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
static HPAINTBUFFER(WINAPI *pBeginBufferedPaint)(HDC
#define E_FAIL
Definition: ddrawi.h:102
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
& rect
Definition: startmenu.cpp:1413
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLenum const GLfloat * params
Definition: glext.h:5645
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static RGBQUAD int *static HDC(WINAPI *pGetBufferedPaintDC)(HPAINTBUFFER)
LONG HRESULT
Definition: typedefs.h:77
#define todo_wine
Definition: test.h:163
HDC hdc
Definition: main.c:9
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
GLenum src
Definition: glext.h:6340
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
BOOL WINAPI DeleteDC(_In_ HDC)
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
#define ok(value,...)
Definition: atltest.h:57
GLenum target
Definition: glext.h:7315
#define BPBF_COMPATIBLEBITMAP
Definition: treelist.c:133
static HBITMAP
Definition: button.c:44
#define E_POINTER
Definition: winerror.h:2365
static void test_buffer_dc_props(HDC hdc, const RECT *rect)
Definition: system.c:510
#define win_skip
Definition: test.h:150
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78

Referenced by START_TEST().

◆ test_CloseThemeData()

static void test_CloseThemeData ( void  )
static

Definition at line 500 of file system.c.

501 {
502  HRESULT hRes;
503 
504  hRes = CloseThemeData(NULL);
505  ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", hRes);
507  ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", hRes);
508 }
#define E_HANDLE
Definition: winerror.h:2850
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define ok(value,...)
Definition: atltest.h:57
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950

Referenced by START_TEST().

◆ test_GetCurrentThemeName()

static void test_GetCurrentThemeName ( void  )
static

Definition at line 416 of file system.c.

417 {
419  HRESULT hRes;
420  WCHAR currentTheme[MAX_PATH];
421  WCHAR currentColor[MAX_PATH];
422  WCHAR currentSize[MAX_PATH];
423 
425 
426  /* All NULLs */
427  hRes = GetCurrentThemeName(NULL, 0, NULL, 0, NULL, 0);
428  if (bThemeActive)
429  ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
430  else
431  ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
432 
433  /* Number of characters given is 0 */
434  hRes = GetCurrentThemeName(currentTheme, 0, NULL, 0, NULL, 0);
435  if (bThemeActive)
436  ok( hRes == S_OK || broken(hRes == E_FAIL /* WinXP SP1 */), "Expected S_OK, got 0x%08x\n", hRes);
437  else
438  ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
439 
440  hRes = GetCurrentThemeName(currentTheme, 2, NULL, 0, NULL, 0);
441  if (bThemeActive)
442  todo_wine
443  ok(hRes == E_NOT_SUFFICIENT_BUFFER ||
444  broken(hRes == E_FAIL /* WinXP SP1 */),
445  "Expected E_NOT_SUFFICIENT_BUFFER, got 0x%08x\n", hRes);
446  else
447  ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
448 
449  /* The same is true if the number of characters is too small for Color and/or Size */
450  hRes = GetCurrentThemeName(currentTheme, ARRAY_SIZE(currentTheme), currentColor, 2,
451  currentSize, ARRAY_SIZE(currentSize));
452  if (bThemeActive)
453  todo_wine
454  ok(hRes == E_NOT_SUFFICIENT_BUFFER ||
455  broken(hRes == E_FAIL /* WinXP SP1 */),
456  "Expected E_NOT_SUFFICIENT_BUFFER, got 0x%08x\n", hRes);
457  else
458  ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
459 
460  /* Given number of characters is correct */
461  hRes = GetCurrentThemeName(currentTheme, ARRAY_SIZE(currentTheme), NULL, 0, NULL, 0);
462  if (bThemeActive)
463  ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
464  else
465  ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
466 
467  /* Given number of characters for the theme name is too large */
468  hRes = GetCurrentThemeName(currentTheme, sizeof(currentTheme), NULL, 0, NULL, 0);
469  if (bThemeActive)
470  ok( hRes == E_POINTER || hRes == S_OK, "Expected E_POINTER or S_OK, got 0x%08x\n", hRes);
471  else
472  ok( hRes == E_PROP_ID_UNSUPPORTED ||
473  hRes == E_POINTER, /* win2k3 */
474  "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
475 
476  /* The too large case is only for the theme name, not for color name or size name */
477  hRes = GetCurrentThemeName(currentTheme, ARRAY_SIZE(currentTheme), currentColor,
478  sizeof(currentTheme), currentSize, ARRAY_SIZE(currentSize));
479  if (bThemeActive)
480  ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
481  else
482  ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
483 
484  hRes = GetCurrentThemeName(currentTheme, ARRAY_SIZE(currentTheme), currentColor,
485  ARRAY_SIZE(currentTheme), currentSize, sizeof(currentSize));
486  if (bThemeActive)
487  ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
488  else
489  ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
490 
491  /* Correct call */
492  hRes = GetCurrentThemeName(currentTheme, ARRAY_SIZE(currentTheme), currentColor,
493  ARRAY_SIZE(currentColor), currentSize, ARRAY_SIZE(currentSize));
494  if (bThemeActive)
495  ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
496  else
497  ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
498 }
#define E_FAIL
Definition: ddrawi.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
#define todo_wine
Definition: test.h:163
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:2345
#define broken(x)
Definition: _sntprintf.h:21
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI GetCurrentThemeName(LPWSTR pszThemeFileName, int dwMaxNameChars, LPWSTR pszColorBuff, int cchMaxColorChars, LPWSTR pszSizeBuff, int cchMaxSizeChars)
Definition: system.c:894
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI IsThemeActive(void)
Definition: system.c:606
#define E_POINTER
Definition: winerror.h:2365
static BOOL bThemeActive
Definition: scroll.c:29

Referenced by START_TEST().

◆ test_GetWindowTheme()

static void test_GetWindowTheme ( void  )
static

Definition at line 76 of file system.c.

77 {
78  HTHEME hTheme;
79  HWND hWnd;
80 
81  SetLastError(0xdeadbeef);
82  hTheme = GetWindowTheme(NULL);
83  ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
84  todo_wine
85  ok( GetLastError() == E_HANDLE,
86  "Expected E_HANDLE, got 0x%08x\n",
87  GetLastError());
88 
89  /* Only do the bare minimum to get a valid hwnd */
90  hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
91  ok(hWnd != NULL, "Failed to create a test window.\n");
92 
93  SetLastError(0xdeadbeef);
94  hTheme = GetWindowTheme(hWnd);
95  ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
96  ok( GetLastError() == 0xdeadbeef,
97  "Expected 0xdeadbeef, got 0x%08x\n",
98  GetLastError());
99 
101 }
#define E_HANDLE
Definition: winerror.h:2850
HWND hWnd
Definition: settings.c:17
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DestroyWindow(_In_ HWND)
smooth NULL
Definition: ftsmooth.c:416
#define SetLastError(x)
Definition: compat.h:417
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
#define todo_wine
Definition: test.h:163
#define ok(value,...)
Definition: atltest.h:57
#define WS_POPUP
Definition: pedump.c:616
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR 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)

Referenced by START_TEST().

◆ test_IsThemed()

static void test_IsThemed ( void  )
static

Definition at line 56 of file system.c.

57 {
59  BOOL bAppThemed;
60  BOOL bTPDefined;
61 
63  trace("Theming is %s\n", (bThemeActive) ? "active" : "inactive");
64 
65  bAppThemed = IsAppThemed();
66  trace("Test executable is %s\n", (bAppThemed) ? "themed" : "not themed");
67 
68  SetLastError(0xdeadbeef);
69  bTPDefined = IsThemePartDefined(NULL, 0 , 0);
70  ok( bTPDefined == FALSE, "Expected FALSE\n");
71  ok( GetLastError() == E_HANDLE,
72  "Expected E_HANDLE, got 0x%08x\n",
73  GetLastError());
74 }
#define E_HANDLE
Definition: winerror.h:2850
BOOL WINAPI IsThemePartDefined(HTHEME hTheme, int iPartId, int iStateId)
Definition: system.c:987
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI IsAppThemed(void)
Definition: system.c:596
smooth NULL
Definition: ftsmooth.c:416
#define trace
Definition: atltest.h:70
#define SetLastError(x)
Definition: compat.h:417
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI IsThemeActive(void)
Definition: system.c:606
static BOOL bThemeActive
Definition: scroll.c:29

Referenced by START_TEST().

◆ test_OpenThemeData()

static void test_OpenThemeData ( void  )
static

Definition at line 122 of file system.c.

123 {
124  HTHEME hTheme, hTheme2;
125  HWND hWnd;
127  HRESULT hRes;
128  BOOL bTPDefined;
129 
130  WCHAR szInvalidClassList[] = {'D','E','A','D','B','E','E','F', 0 };
131  WCHAR szButtonClassList[] = {'B','u','t','t','o','n', 0 };
132  WCHAR szButtonClassList2[] = {'b','U','t','T','o','N', 0 };
133  WCHAR szClassList[] = {'B','u','t','t','o','n',';','L','i','s','t','B','o','x', 0 };
134 
136 
137  /* All NULL */
138  SetLastError(0xdeadbeef);
139  hTheme = OpenThemeData(NULL, NULL);
140  ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
141  ok( GetLastError() == E_POINTER,
142  "Expected GLE() to be E_POINTER, got 0x%08x\n",
143  GetLastError());
144 
145  /* A NULL hWnd and an invalid classlist */
146  SetLastError(0xdeadbeef);
147  hTheme = OpenThemeData(NULL, szInvalidClassList);
148  ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
149  todo_wine
151  "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
152  GetLastError());
153 
154  SetLastError(0xdeadbeef);
155  hTheme = OpenThemeData(NULL, szClassList);
156  if (bThemeActive)
157  {
158  ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
159  todo_wine
161  "Expected ERROR_SUCCESS, got 0x%08x\n",
162  GetLastError());
163  }
164  else
165  {
166  ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
167  todo_wine
169  "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
170  GetLastError());
171  }
172 
173  /* Only do the bare minimum to get a valid hdc */
174  hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
175  if (!hWnd) return;
176 
177  SetLastError(0xdeadbeef);
178  hTheme = OpenThemeData(hWnd, NULL);
179  ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
180  ok( GetLastError() == E_POINTER,
181  "Expected GLE() to be E_POINTER, got 0x%08x\n",
182  GetLastError());
183 
184  SetLastError(0xdeadbeef);
185  hTheme = OpenThemeData(hWnd, szInvalidClassList);
186  ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
187  todo_wine
189  "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
190  GetLastError());
191 
192  /* Close invalid handle */
193  hRes = CloseThemeData((HTHEME)0xdeadbeef);
194  ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", hRes);
195 
196  if (!bThemeActive)
197  {
198  SetLastError(0xdeadbeef);
199  hTheme = OpenThemeData(hWnd, szButtonClassList);
200  ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
201  todo_wine
203  "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
204  GetLastError());
205  skip("No active theme, skipping rest of OpenThemeData tests\n");
206  return;
207  }
208 
209  /* Only do the next checks if we have an active theme */
210 
211  SetLastError(0xdeadbeef);
212  hTheme = OpenThemeData(hWnd, szButtonClassList);
213  ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
214  todo_wine
216  "Expected ERROR_SUCCESS, got 0x%08x\n",
217  GetLastError());
218 
219  /* Test with bUtToN instead of Button */
220  SetLastError(0xdeadbeef);
221  hTheme = OpenThemeData(hWnd, szButtonClassList2);
222  ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
223  todo_wine
225  "Expected ERROR_SUCCESS, got 0x%08x\n",
226  GetLastError());
227 
228  SetLastError(0xdeadbeef);
229  hTheme = OpenThemeData(hWnd, szClassList);
230  ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
231  todo_wine
233  "Expected ERROR_SUCCESS, got 0x%08x\n",
234  GetLastError());
235 
236  /* GetWindowTheme should return the last handle opened by OpenThemeData */
237  SetLastError(0xdeadbeef);
238  hTheme2 = GetWindowTheme(hWnd);
239  ok( hTheme == hTheme2, "Expected the same HTHEME handle (%p<->%p)\n",
240  hTheme, hTheme2);
241  ok( GetLastError() == 0xdeadbeef,
242  "Expected 0xdeadbeef, got 0x%08x\n",
243  GetLastError());
244 
245  hRes = CloseThemeData(hTheme);
246  ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
247 
248  /* Close a second time */
249  hRes = CloseThemeData(hTheme);
250  ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
251 
252  /* See if closing makes a difference for GetWindowTheme */
253  SetLastError(0xdeadbeef);
254  hTheme2 = NULL;
255  hTheme2 = GetWindowTheme(hWnd);
256  ok( hTheme == hTheme2, "Expected the same HTHEME handle (%p<->%p)\n",
257  hTheme, hTheme2);
258  ok( GetLastError() == 0xdeadbeef,
259  "Expected 0xdeadbeef, got 0x%08x\n",
260  GetLastError());
261 
262  SetLastError(0xdeadbeef);
263  bTPDefined = IsThemePartDefined(hTheme, 0 , 0);
264  todo_wine
265  {
266  ok( bTPDefined == FALSE, "Expected FALSE\n");
268  "Expected ERROR_SUCCESS, got 0x%08x\n",
269  GetLastError());
270  }
271 
273 }
#define E_HANDLE
Definition: winerror.h:2850
#define ERROR_SUCCESS
Definition: deptool.c:10
HWND hWnd
Definition: settings.c:17
BOOL WINAPI IsThemePartDefined(HTHEME hTheme, int iPartId, int iStateId)
Definition: system.c:987
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DestroyWindow(_In_ HWND)
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define SetLastError(x)
Definition: compat.h:417
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
#define todo_wine
Definition: test.h:163
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
#define WS_POPUP
Definition: pedump.c:616
#define skip(...)
Definition: atltest.h:64
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR 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)
BOOL WINAPI IsThemeActive(void)
Definition: system.c:606
#define E_POINTER
Definition: winerror.h:2365
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
static BOOL bThemeActive
Definition: scroll.c:29

Referenced by START_TEST().

◆ test_OpenThemeDataEx()

static void test_OpenThemeDataEx ( void  )
static

Definition at line 275 of file system.c.

276 {
277  HTHEME hTheme;
278  HWND hWnd;
280 
281  WCHAR szInvalidClassList[] = {'D','E','A','D','B','E','E','F', 0 };
282  WCHAR szButtonClassList[] = {'B','u','t','t','o','n', 0 };
283  WCHAR szButtonClassList2[] = {'b','U','t','T','o','N', 0 };
284  WCHAR szClassList[] = {'B','u','t','t','o','n',';','L','i','s','t','B','o','x', 0 };
285 
286  if (!pOpenThemeDataEx)
287  {
288  win_skip("OpenThemeDataEx not available\n");
289  return;
290  }
291 
293 
294  /* All NULL */
295  SetLastError(0xdeadbeef);
296  hTheme = pOpenThemeDataEx(NULL, NULL, 0);
297  ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
298  ok( GetLastError() == E_POINTER,
299  "Expected GLE() to be E_POINTER, got 0x%08x\n",
300  GetLastError());
301 
302  /* A NULL hWnd and an invalid classlist without flags */
303  SetLastError(0xdeadbeef);
304  hTheme = pOpenThemeDataEx(NULL, szInvalidClassList, 0);
305  ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
306  todo_wine
308  "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
309  GetLastError());
310 
311  SetLastError(0xdeadbeef);
312  hTheme = pOpenThemeDataEx(NULL, szClassList, 0);
313  if (bThemeActive)
314  {
315  ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
316  todo_wine
318  "Expected ERROR_SUCCESS, got 0x%08x\n",
319  GetLastError());
320  }
321  else
322  {
323  ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
324  todo_wine
326  "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
327  GetLastError());
328  }
329 
330  /* Only do the bare minimum to get a valid hdc */
331  hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
332  if (!hWnd) return;
333 
334  SetLastError(0xdeadbeef);
335  hTheme = pOpenThemeDataEx(hWnd, NULL, 0);
336  ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
337  ok( GetLastError() == E_POINTER,
338  "Expected GLE() to be E_POINTER, got 0x%08x\n",
339  GetLastError());
340 
341  SetLastError(0xdeadbeef);
342  hTheme = pOpenThemeDataEx(hWnd, szInvalidClassList, 0);
343  ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
344  todo_wine
346  "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
347  GetLastError());
348 
349  if (!bThemeActive)
350  {
351  SetLastError(0xdeadbeef);
352  hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, 0);
353  ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
354  todo_wine
356  "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
357  GetLastError());
358  skip("No active theme, skipping rest of OpenThemeDataEx tests\n");
359  return;
360  }
361 
362  /* Only do the next checks if we have an active theme */
363 
364  SetLastError(0xdeadbeef);
365  hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, 0);
366  ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
367  todo_wine
369  "Expected ERROR_SUCCESS, got 0x%08x\n",
370  GetLastError());
371 
372  SetLastError(0xdeadbeef);
373  hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, OTD_FORCE_RECT_SIZING);
374  ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
375  todo_wine
377  "Expected ERROR_SUCCESS, got 0x%08x\n",
378  GetLastError());
379 
380  SetLastError(0xdeadbeef);
381  hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, OTD_NONCLIENT);
382  ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
383  todo_wine
385  "Expected ERROR_SUCCESS, got 0x%08x\n",
386  GetLastError());
387 
388  SetLastError(0xdeadbeef);
389  hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, 0x3);
390  ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
391  todo_wine
393  "Expected ERROR_SUCCESS, got 0x%08x\n",
394  GetLastError());
395 
396  /* Test with bUtToN instead of Button */
397  SetLastError(0xdeadbeef);
398  hTheme = pOpenThemeDataEx(hWnd, szButtonClassList2, 0);
399  ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
400  todo_wine
402  "Expected ERROR_SUCCESS, got 0x%08x\n",
403  GetLastError());
404 
405  SetLastError(0xdeadbeef);
406  hTheme = pOpenThemeDataEx(hWnd, szClassList, 0);
407  ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
408  todo_wine
410  "Expected ERROR_SUCCESS, got 0x%08x\n",
411  GetLastError());
412 
414 }
#define ERROR_SUCCESS
Definition: deptool.c:10
HWND hWnd
Definition: settings.c:17
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DestroyWindow(_In_ HWND)
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SetLastError(x)
Definition: compat.h:417
#define todo_wine
Definition: test.h:163
#define ok(value,...)
Definition: atltest.h:57
#define WS_POPUP
Definition: pedump.c:616
#define skip(...)
Definition: atltest.h:64
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR 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)
BOOL WINAPI IsThemeActive(void)
Definition: system.c:606
#define E_POINTER
Definition: winerror.h:2365
#define win_skip
Definition: test.h:150
static BOOL bThemeActive
Definition: scroll.c:29

Referenced by START_TEST().

◆ test_SetWindowTheme()

static void test_SetWindowTheme ( void  )
static

Definition at line 103 of file system.c.

104 {
105  HRESULT hRes;
106  HWND hWnd;
107 
108  hRes = SetWindowTheme(NULL, NULL, NULL);
109 todo_wine
110  ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", hRes);
111 
112  /* Only do the bare minimum to get a valid hwnd */
113  hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
114  ok(hWnd != NULL, "Failed to create a test window.\n");
115 
116  hRes = SetWindowTheme(hWnd, NULL, NULL);
117  ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
118 
120 }
#define E_HANDLE
Definition: winerror.h:2850
HWND hWnd
Definition: settings.c:17
BOOL WINAPI DestroyWindow(_In_ HWND)
HRESULT WINAPI SetWindowTheme(HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList)
Definition: system.c:869
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define todo_wine
Definition: test.h:163
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
#define WS_POPUP
Definition: pedump.c:616
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR 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)

Referenced by START_TEST().

Variable Documentation

◆ BOOL

const RECT BP_PAINTPARAMS HDC* static const RECT* static BOOL

Definition at line 32 of file system.c.

◆ BP_BUFFERFORMAT

const RECT BP_BUFFERFORMAT

Definition at line 30 of file system.c.

Referenced by test_buffered_paint().

◆ DWORD

Definition at line 29 of file system.c.

◆ LPCWSTR

Definition at line 29 of file system.c.