ReactOS  0.4.13-dev-551-gf37fb1f
status.c File Reference
#include <windows.h>
#include <commctrl.h>
#include "wine/test.h"
Include dependency graph for status.c:

Go to the source code of this file.

Macros

#define SUBCLASS_NAME   "MyStatusBar"
 
#define expect(expected, got)   ok (expected == got,"Expected %d, got %d\n",expected,got)
 
#define expect_rect(_left, _top, _right, _bottom, got)
 
#define X(f)   p##f = (void*)GetProcAddress(hComCtl32, #f);
 

Functions

static BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX *)
 
static HWND create_status_control (DWORD style, DWORD exstyle)
 
static LRESULT WINAPI create_test_wndproc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void register_subclass (void)
 
static void test_create (void)
 
static int CALLBACK check_height_font_enumproc (ENUMLOGFONTEXA *enumlf, NEWTEXTMETRICEXA *ntm, DWORD type, LPARAM lParam)
 
static int CALLBACK check_height_family_enumproc (ENUMLOGFONTEXA *enumlf, NEWTEXTMETRICEXA *ntm, DWORD type, LPARAM lParam)
 
static void test_height (void)
 
static void test_status_control (void)
 
static LRESULT WINAPI ownerdraw_test_wndproc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_status_ownerdraw (void)
 
static void test_gettext (void)
 
static LRESULT WINAPI test_notify_parent_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_notify (void)
 
static void test_sizegrip (void)
 
static void init_functions (void)
 
 START_TEST (status)
 

Variables

static HINSTANCE hinst
 
static WNDPROC g_status_wndproc
 
static RECT g_rcCreated
 
static HWND g_hMainWnd
 
static int g_wmsize_count = 0
 
static INT g_ysize
 
static INT g_dpisize
 
static int g_wmdrawitm_ctr
 
static WNDPROC g_wndproc_saved
 
static BOOL g_got_dblclk
 
static BOOL g_got_click
 
static BOOL g_got_rdblclk
 
static BOOL g_got_rclick
 
static BOOL g_got_contextmenu
 

Macro Definition Documentation

◆ expect

#define expect (   expected,
  got 
)    ok (expected == got,"Expected %d, got %d\n",expected,got)

Definition at line 28 of file status.c.

◆ expect_rect

#define expect_rect (   _left,
  _top,
  _right,
  _bottom,
  got 
)
Value:
do { \
RECT exp = {abs(got.left - _left), abs(got.top - _top), \
abs(got.right - _right), abs(got.bottom - _bottom)}; \
ok(exp.left <= 2 && exp.top <= 2 && exp.right <= 2 && exp.bottom <= 2, \
"Expected rect (%d,%d)-(%d,%d), got %s\n", _left, _top, _right, _bottom, \
wine_dbgstr_rect(&(got))); } while (0)
#define abs(i)
Definition: fconv.c:206
const char * wine_dbgstr_rect(const RECT *rect)
DWORD exp
Definition: msg.c:15681

Definition at line 29 of file status.c.

◆ SUBCLASS_NAME

#define SUBCLASS_NAME   "MyStatusBar"

Definition at line 26 of file status.c.

◆ X

#define X (   f)    p##f = (void*)GetProcAddress(hComCtl32, #f);

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pInitCommonControlsEx) const
static

◆ check_height_family_enumproc()

static int CALLBACK check_height_family_enumproc ( ENUMLOGFONTEXA enumlf,
NEWTEXTMETRICEXA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 159 of file status.c.

160 {
161  HDC hdc = GetDC(NULL);
162  enumlf->elfLogFont.lfHeight = 0;
164  ReleaseDC(NULL, hdc);
165  return 1;
166 }
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
FARPROC FONTENUMPROCA
Definition: wingdi.h:2874
LONG lfHeight
Definition: dimm.idl:42
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
HDC hdc
Definition: main.c:9
static int CALLBACK check_height_font_enumproc(ENUMLOGFONTEXA *enumlf, NEWTEXTMETRICEXA *ntm, DWORD type, LPARAM lParam)
Definition: status.c:116
int WINAPI EnumFontFamiliesExA(_In_ HDC, _In_ PLOGFONTA, _In_ FONTENUMPROCA, _In_ LPARAM, _In_ DWORD)
LPARAM lParam
Definition: combotst.c:139
LOGFONTA elfLogFont
Definition: wingdi.h:2674

Referenced by test_height().

◆ check_height_font_enumproc()

static int CALLBACK check_height_font_enumproc ( ENUMLOGFONTEXA enumlf,
NEWTEXTMETRICEXA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 116 of file status.c.

117 {
119  HDC hdc = GetDC(NULL);
120  static const int sizes[] = { 6, 7, 8, 9, 10, 11, 12, 13, 15, 16,
121  20, 22, 28, 36, 48, 72};
122  DWORD i;
123  INT y;
124  LPSTR facename = (CHAR *)enumlf->elfFullName;
125 
126  /* on win9x, enumlf->elfFullName is only valid for truetype fonts */
128  facename = enumlf->elfLogFont.lfFaceName;
129 
130  for (i = 0; i < ARRAY_SIZE(sizes); i++)
131  {
132  HFONT hFont;
133  TEXTMETRICA tm;
134  HFONT hCtrlFont;
135  HFONT hOldFont;
136  RECT rcCtrl;
137 
138  enumlf->elfLogFont.lfHeight = sizes[i];
141  hOldFont = SelectObject(hdc, hFont);
142 
143  GetClientRect(hwndStatus, &rcCtrl);
145  y = tm.tmHeight + (tm.tmInternalLeading ? tm.tmInternalLeading : 2) + 4;
146 
147  ok( (rcCtrl.bottom == max(y, g_ysize)) || (rcCtrl.bottom == max(y, g_dpisize)),
148  "got %d (expected %d or %d) for %s #%d\n",
149  rcCtrl.bottom, max(y, g_ysize), max(y, g_dpisize), facename, sizes[i]);
150 
151  SelectObject(hdc, hOldFont);
154  }
155  ReleaseDC(NULL, hdc);
156  return 1;
157 }
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
HDC WINAPI GetDC(_In_opt_ HWND)
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
char CHAR
Definition: xmlstorage.h:175
static HDC
Definition: imagelist.c:92
HANDLE HWND
Definition: compat.h:13
static INT g_dpisize
Definition: status.c:42
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
UINT_PTR WPARAM
Definition: windef.h:207
char * LPSTR
Definition: xmlstorage.h:182
int32_t INT
Definition: typedefs.h:56
BYTE elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:2675
HFONT hFont
Definition: main.c:53
static const struct @512 sizes[]
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG lfHeight
Definition: dimm.idl:42
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HWND hwndStatus
Definition: solitaire.cpp:13
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
Definition: text.c:200
if(!(yy_init))
Definition: macro.lex.yy.c:714
unsigned long DWORD
Definition: ntddk_ex.h:95
static INT g_ysize
Definition: status.c:41
HDC hdc
Definition: main.c:9
Definition: time.h:76
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define ARRAY_SIZE(a)
Definition: main.h:24
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define WM_SETFONT
Definition: winuser.h:1632
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
LONG bottom
Definition: windef.h:294
LPARAM lParam
Definition: combotst.c:139
LOGFONTA elfLogFont
Definition: wingdi.h:2674
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1091

Referenced by check_height_family_enumproc().

◆ create_status_control()

static HWND create_status_control ( DWORD  style,
DWORD  exstyle 
)
static

Definition at line 48 of file status.c.

49 {
50  HWND hWndStatus;
51 
52  /* make the control */
53  hWndStatus = CreateWindowExA(exstyle, STATUSCLASSNAMEA, NULL, style,
54  /* placement */
55  0, 0, 300, 20,
56  /* parent, etc */
57  NULL, NULL, hinst, NULL);
58  ok(hWndStatus != NULL, "failed to create status wnd\n");
59  return hWndStatus;
60 }
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
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)
static HINSTANCE hinst
Definition: status.c:36
#define STATUSCLASSNAMEA
Definition: commctrl.h:1909
Arabic default style
Definition: afstyles.h:93

Referenced by test_status_control().

◆ create_test_wndproc()

static LRESULT WINAPI create_test_wndproc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 62 of file status.c.

63 {
64  LRESULT ret;
65 
66  if (msg == WM_CREATE)
67  {
72  ok(cs->x == g_rcCreated.left, "CREATESTRUCT.x modified\n");
73  ok(cs->y == g_rcCreated.top, "CREATESTRUCT.y modified\n");
74  } else if (msg == WM_SIZE)
75  {
78  }
79  else
81 
82  return ret;
83 }
static RECT g_rcCreated
Definition: status.c:38
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
static WNDPROC g_status_wndproc
Definition: status.c:37
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
uint32_t cs
Definition: isohybrid.c:75
#define ok(value,...)
#define WM_SIZE
Definition: winuser.h:1593
int ret
static HWND g_hMainWnd
Definition: status.c:39
#define HWND_DESKTOP
Definition: winuser.h:1195
#define msg(x)
Definition: auth_time.c:54
#define WM_CREATE
Definition: winuser.h:1590
static int g_wmsize_count
Definition: status.c:40
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139

Referenced by register_subclass().

◆ init_functions()

static void init_functions ( void  )
static

Definition at line 714 of file status.c.

715 {
716  HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
717 
718 #define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
720 #undef X
721 }
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define X(f)
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893

Referenced by START_TEST().

◆ ownerdraw_test_wndproc()

static LRESULT WINAPI ownerdraw_test_wndproc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 436 of file status.c.

437 {
438  LRESULT ret;
439  if (msg == WM_DRAWITEM)
440  g_wmdrawitm_ctr++;
442  return ret;
443 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
int ret
static WNDPROC g_wndproc_saved
Definition: status.c:44
#define WM_DRAWITEM
Definition: winuser.h:1627
#define msg(x)
Definition: auth_time.c:54
static int g_wmdrawitm_ctr
Definition: status.c:43
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139

Referenced by test_status_ownerdraw().

◆ register_subclass()

static void register_subclass ( void  )
static

Definition at line 85 of file status.c.

86 {
87  WNDCLASSEXA cls;
88 
89  cls.cbSize = sizeof(WNDCLASSEXA);
94  cls.hInstance = NULL;
95  ok(RegisterClassExA(&cls), "RegisterClassEx failed\n");
96 }
struct _WNDCLASSEXA WNDCLASSEXA
WNDPROC lpfnWndProc
Definition: winuser.h:3156
LPCSTR lpszClassName
Definition: winuser.h:3164
static WNDPROC g_status_wndproc
Definition: status.c:37
HINSTANCE hInstance
Definition: winuser.h:3159
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
UINT cbSize
Definition: winuser.h:3154
ATOM WINAPI RegisterClassExA(_In_ CONST WNDCLASSEXA *)
BOOL WINAPI GetClassInfoExA(_In_opt_ HINSTANCE, _In_ LPCSTR, _Out_ LPWNDCLASSEXA)
#define SUBCLASS_NAME
Definition: status.c:26
#define STATUSCLASSNAMEA
Definition: commctrl.h:1909
static LRESULT WINAPI create_test_wndproc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: status.c:62

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( status  )

Definition at line 723 of file status.c.

724 {
725  INITCOMMONCONTROLSEX iccex;
726 
727  init_functions();
728 
730 
731  iccex.dwSize = sizeof(iccex);
732  iccex.dwICC = ICC_BAR_CLASSES;
733  pInitCommonControlsEx(&iccex);
734 
739 
741 
743  test_create();
744  test_height();
746  test_gettext();
747  test_notify();
748  test_sizegrip();
749 }
#define WC_STATICA
Definition: commctrl.h:4650
static void test_gettext(void)
Definition: status.c:483
static void test_status_control(void)
Definition: status.c:251
#define CW_USEDEFAULT
Definition: winuser.h:225
static void test_status_ownerdraw(void)
Definition: status.c:445
smooth NULL
Definition: ftsmooth.c:416
#define SM_CYSIZEFRAME
Definition: winuser.h:985
static void test_sizegrip(void)
Definition: status.c:589
#define SM_CXSIZEFRAME
Definition: winuser.h:983
#define ICC_BAR_CLASSES
Definition: commctrl.h:60
#define SM_CYCAPTION
Definition: winuser.h:953
static void register_subclass(void)
Definition: status.c:85
int WINAPI GetSystemMetrics(_In_ int)
static void test_create(void)
Definition: status.c:98
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
static void test_notify(void)
Definition: status.c:549
static HWND g_hMainWnd
Definition: status.c:39
static void init_functions(void)
Definition: status.c:714
static void test_height(void)
Definition: status.c:168
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)
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
static HINSTANCE hinst
Definition: status.c:36

◆ test_create()

static void test_create ( void  )
static

Definition at line 98 of file status.c.

99 {
100  RECT rc;
101  HWND hwnd;
102 
104  g_hMainWnd, NULL, NULL, 0)) != NULL, "CreateWindowA failed\n");
106  GetWindowRect(hwnd, &rc);
108  expect_rect(0, 0, 100, 100, g_rcCreated);
109  expect(0, rc.left);
110  expect(672, rc.right);
111  expect(226, rc.bottom);
112  /* we don't check rc.top as this may depend on user font settings */
114 }
static RECT g_rcCreated
Definition: status.c:38
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:291
#define expect_rect(_left, _top, _right, _bottom, got)
Definition: status.c:29
LONG right
Definition: windef.h:293
BOOL WINAPI DestroyWindow(_In_ HWND)
#define ok(value,...)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
smooth NULL
Definition: ftsmooth.c:416
#define SBARS_SIZEGRIP
Definition: commctrl.h:1895
static HWND g_hMainWnd
Definition: status.c:39
#define expect(expected, got)
Definition: status.c:28
#define HWND_DESKTOP
Definition: winuser.h:1195
#define SUBCLASS_NAME
Definition: status.c:26
LONG bottom
Definition: windef.h:294
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by START_TEST().

◆ test_gettext()

static void test_gettext ( void  )
static

Definition at line 483 of file status.c.

484 {
486  0, 0, 300, 20, g_hMainWnd, NULL, NULL, NULL);
487  char buf[5];
488  int r;
489 
490  r = SendMessageA(hwndStatus, SB_SETTEXTA, 0, (LPARAM)"Text");
491  expect(TRUE, r);
493  expect(4, r);
494  /* A size of 0 returns the length of the text */
496  ok( r == 4 || broken(r == 2) /* win8 */, "Expected 4 got %d\n", r );
497  /* A size of 1 only stores the NULL terminator */
498  buf[0] = 0xa;
500  ok( r == 0 || broken(r == 4), "Expected 0 got %d\n", r );
501  if (!r) ok(!buf[0], "expected empty buffer\n");
502  /* A size of 2 returns a length 1 */
504  ok( r == 1 || broken(r == 4), "Expected 1 got %d\n", r );
506  expect(4, r);
507  ok(!strcmp(buf, "Text"), "expected Text, got %s\n", buf);
509 }
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
#define TRUE
Definition: types.h:120
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define WM_GETTEXT
Definition: winuser.h:1600
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI DestroyWindow(_In_ HWND)
HWND hwndStatus
Definition: solitaire.cpp:13
#define ok(value,...)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define SB_SETTEXTA
Definition: commctrl.h:1913
#define broken(x)
Definition: _sntprintf.h:21
static HWND g_hMainWnd
Definition: status.c:39
#define expect(expected, got)
Definition: status.c:28
#define SUBCLASS_NAME
Definition: status.c:26
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by START_TEST().

◆ test_height()

static void test_height ( void  )
static

Definition at line 168 of file status.c.

169 {
170  LOGFONTA lf;
171  HFONT hFont, hFontSm;
172  RECT rc1, rc2;
174  0, 0, 300, 20, g_hMainWnd, NULL, NULL, NULL);
175  HDC hdc;
176 
177  GetClientRect(hwndStatus, &rc1);
180 
181  g_wmsize_count = 0;
183  if (!g_wmsize_count)
184  {
185  skip("Status control not resized in win95, skipping broken tests.\n");
186  return;
187  }
188  ok(g_wmsize_count > 0, "WM_SETFONT should issue WM_SIZE\n");
189 
191  expect_rect(0, 0, 672, 42, rc2); /* GetTextMetrics returns invalid tmInternalLeading for this font */
192 
193  g_wmsize_count = 0;
195  ok(g_wmsize_count > 0, "WM_SETFONT should issue WM_SIZE\n");
196 
198  expect_rect(0, 0, 672, 42, rc2);
199 
200  /* minheight < fontsize - no effects*/
204  expect_rect(0, 0, 672, 42, rc2);
205 
206  /* minheight > fontsize - has an effect after WM_SIZE */
209  expect_rect(0, 0, 672, 42, rc2);
212  expect_rect(0, 0, 672, 62, rc2);
213 
214  /* font changed to smaller than minheight - has an effect */
216  expect_rect(0, 0, 672, 62, rc2);
219  expect_rect(0, 0, 672, 42, rc2);
220  hFontSm = CreateFontA(9, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET,
224  expect_rect(0, 0, 672, 32, rc2);
225 
226  /* test the height formula */
227  ZeroMemory(&lf, sizeof(lf));
229  hdc = GetDC(NULL);
230 
231  /* used only for some fonts (tahoma as example) */
233  if (g_ysize & 1) g_ysize--; /* The min height is always even */
234 
235  g_dpisize = MulDiv(18, GetDeviceCaps(hdc, LOGPIXELSY), 96) + 2;
236  if (g_dpisize & 1) g_dpisize--; /* The min height is always even */
237 
238 
239  trace("dpi=%d (min height: %d or %d) SM_CYSIZE: %d\n",
242 
244  ReleaseDC(NULL, hdc);
245 
248  DeleteObject(hFontSm);
249 }
#define trace(...)
Definition: kmt_test.h:217
#define TRUE
Definition: types.h:120
#define SM_CYSIZE
Definition: winuser.h:982
#define DEFAULT_QUALITY
Definition: wingdi.h:435
#define FF_DONTCARE
Definition: wingdi.h:447
HDC WINAPI GetDC(_In_opt_ HWND)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static HDC
Definition: imagelist.c:92
static INT g_dpisize
Definition: status.c:42
#define ZeroMemory
Definition: winbase.h:1635
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
#define expect_rect(_left, _top, _right, _bottom, got)
Definition: status.c:29
FARPROC FONTENUMPROCA
Definition: wingdi.h:2874
BOOL WINAPI DestroyWindow(_In_ HWND)
HFONT hFont
Definition: main.c:53
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:425
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HWND hwndStatus
Definition: solitaire.cpp:13
#define ok(value,...)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SIZE
Definition: winuser.h:1593
#define OUT_DEFAULT_PRECIS
Definition: wingdi.h:414
int WINAPI GetSystemMetrics(_In_ int)
static INT g_ysize
Definition: status.c:41
static int CALLBACK check_height_family_enumproc(ENUMLOGFONTEXA *enumlf, NEWTEXTMETRICEXA *ntm, DWORD type, LPARAM lParam)
Definition: status.c:159
HDC hdc
Definition: main.c:9
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
HFONT WINAPI CreateFontA(_In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_opt_ LPCSTR)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define FW_DONTCARE
Definition: wingdi.h:367
static HWND g_hMainWnd
Definition: status.c:39
#define WM_SETFONT
Definition: winuser.h:1632
#define skip(...)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define SUBCLASS_NAME
Definition: status.c:26
#define LOGPIXELSY
Definition: wingdi.h:718
static int g_wmsize_count
Definition: status.c:40
static const WCHAR rc2[]
Definition: oid.c:1216
#define ANSI_CHARSET
Definition: wingdi.h:382
#define SB_SETMINHEIGHT
Definition: commctrl.h:1929
int WINAPI EnumFontFamiliesExA(_In_ HDC, _In_ PLOGFONTA, _In_ FONTENUMPROCA, _In_ LPARAM, _In_ DWORD)
#define WS_VISIBLE
Definition: pedump.c:620
#define MulDiv(x, y, z)
Definition: gdifloat.h:86

Referenced by START_TEST().

◆ test_notify()

static void test_notify ( void  )
static

Definition at line 549 of file status.c.

550 {
553  ATOM atom;
554  WNDCLASSA wclass = {0};
555  wclass.lpszClassName = "TestNotifyParentClass";
557  atom = RegisterClassA(&wclass);
558  ok(atom, "RegisterClass failed\n");
559 
560  /* create parent */
562  CW_USEDEFAULT, 0, 300, 20, NULL, NULL, NULL, NULL);
563  ok(hwndParent != NULL, "Parent creation failed!\n");
564 
565  /* create status bar */
567  0, 0, 300, 20, hwndParent, NULL, NULL, NULL);
568  ok(hwndStatus != NULL, "Status creation failed!\n");
569 
570  /* Send various mouse event, and check that we get them */
573  ok(g_got_dblclk, "WM_LBUTTONDBLCLK was not processed correctly!\n");
576  ok(g_got_rdblclk, "WM_RBUTTONDBLCLK was not processed correctly!\n");
577  g_got_click = FALSE;
579  ok(g_got_click, "WM_LBUTTONUP was not processed correctly!\n");
580 
581  /* For R-UP, check that we also get the context menu from the default processing */
585  ok(g_got_rclick, "WM_RBUTTONUP was not processed correctly!\n");
586  ok(g_got_contextmenu, "WM_RBUTTONUP did not activate the context menu!\n");
587 }
WORD ATOM
Definition: dimm.idl:113
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static BOOL g_got_rdblclk
Definition: status.c:514
#define WS_CHILD
Definition: pedump.c:617
HWND hwndStatus
Definition: solitaire.cpp:13
#define ok(value,...)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
#define CW_USEDEFAULT
Definition: winuser.h:225
static LRESULT WINAPI test_notify_parent_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: status.c:520
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
static BOOL g_got_rclick
Definition: status.c:515
static BOOL g_got_contextmenu
Definition: status.c:518
#define WM_RBUTTONUP
Definition: winuser.h:1756
static BOOL g_got_dblclk
Definition: status.c:512
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1754
LPCSTR lpszClassName
Definition: winuser.h:3125
#define WM_LBUTTONUP
Definition: winuser.h:1753
WNDPROC lpfnWndProc
Definition: winuser.h:3117
static BOOL g_got_click
Definition: status.c:513
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1757
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define STATUSCLASSNAMEA
Definition: commctrl.h:1909
#define WS_VISIBLE
Definition: pedump.c:620
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)

Referenced by START_TEST().

◆ test_notify_parent_proc()

static LRESULT WINAPI test_notify_parent_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 520 of file status.c.

521 {
522  switch(msg)
523  {
524  case WM_NOTIFY:
525  {
526  NMHDR *hdr = ((LPNMHDR)lParam);
527  switch(hdr->code)
528  {
529  case NM_DBLCLK: g_got_dblclk = TRUE; break;
530  case NM_CLICK: g_got_click = TRUE; break;
531  case NM_RDBLCLK: g_got_rdblclk = TRUE; break;
532  case NM_RCLICK: g_got_rclick = TRUE; break;
533  }
534 
535  /* Return zero to indicate default processing */
536  return 0;
537  }
538 
539  case WM_CONTEXTMENU: g_got_contextmenu = TRUE; return 0;
540 
541  default:
542  return( DefWindowProcA(hwnd, msg, wParam, lParam));
543  }
544 
545  return 0;
546 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
char hdr[14]
Definition: iptest.cpp:33
#define WM_CONTEXTMENU
Definition: richedit.h:64
static BOOL g_got_rdblclk
Definition: status.c:514
WPARAM wParam
Definition: combotst.c:138
struct tagNMHDR * LPNMHDR
#define NM_RDBLCLK
Definition: commctrl.h:134
static BOOL g_got_rclick
Definition: status.c:515
static BOOL g_got_contextmenu
Definition: status.c:518
static BOOL g_got_dblclk
Definition: status.c:512
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NM_CLICK
Definition: commctrl.h:130
#define NM_DBLCLK
Definition: commctrl.h:131
#define NM_RCLICK
Definition: commctrl.h:133
static BOOL g_got_click
Definition: status.c:513
#define msg(x)
Definition: auth_time.c:54
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by test_notify().

◆ test_sizegrip()

static void test_sizegrip ( void  )
static

Definition at line 589 of file status.c.

590 {
592  LONG style;
593  RECT rc, rcClient;
594  POINT pt;
595  int width, r;
596 
598  0, 0, 100, 100, g_hMainWnd, NULL, NULL, NULL);
599 
602 
603  GetClientRect(hwndStatus, &rcClient);
604 
605  pt.x = rcClient.right;
606  pt.y = rcClient.top;
608  rc.left = pt.x - width;
609  rc.right = pt.x;
610  rc.top = pt.y;
611 
612  pt.y = rcClient.bottom;
614  rc.bottom = pt.y;
615 
616  /* check bounds when not maximized */
620  expect(HTCLIENT, r);
629  r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right - 1, rc.bottom - 1));
631 
632  /* not maximized and right-to-left */
634 
635  pt.x = rcClient.right;
637  rc.left = pt.x + width;
638  rc.right = pt.x;
639 
643  expect(HTCLIENT, r);
652  r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right + 1, rc.bottom - 1));
654 
655  /* maximize with left-to-right */
658 
659  GetClientRect(hwndStatus, &rcClient);
660 
661  pt.x = rcClient.right;
662  pt.y = rcClient.top;
664  rc.left = pt.x - width;
665  rc.right = pt.x;
666  rc.top = pt.y;
667 
668  pt.y = rcClient.bottom;
670  rc.bottom = pt.y;
671 
673  expect(HTCLIENT, r);
675  expect(HTCLIENT, r);
677  expect(HTNOWHERE, r);
679  expect(HTNOWHERE, r);
681  expect(HTNOWHERE, r);
683  expect(HTNOWHERE, r);
684  r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right - 1, rc.bottom - 1));
685  expect(HTCLIENT, r);
686 
687  /* maximized with right-to-left */
689 
690  pt.x = rcClient.right;
692  rc.left = pt.x + width;
693  rc.right = pt.x;
694 
696  expect(HTCLIENT, r);
698  expect(HTCLIENT, r);
700  expect(HTNOWHERE, r);
702  expect(HTNOWHERE, r);
704  expect(HTNOWHERE, r);
706  expect(HTNOWHERE, r);
707  r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right + 1, rc.bottom - 1));
708  expect(HTCLIENT, r);
709 
712 }
GLint GLint GLsizei width
Definition: gl.h:1546
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
#define pt(x, y)
Definition: drawing.c:79
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define MAKELPARAM(l, h)
Definition: winuser.h:3915
LONG top
Definition: windef.h:292
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define GWL_EXSTYLE
Definition: winuser.h:845
#define HTBOTTOMLEFT
Definition: winuser.h:2448
#define WM_NCHITTEST
Definition: winuser.h:1668
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
BOOL WINAPI DestroyWindow(_In_ HWND)
#define HTNOWHERE
Definition: winuser.h:2428
long LONG
Definition: pedump.c:60
HWND hwndStatus
Definition: solitaire.cpp:13
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
smooth NULL
Definition: ftsmooth.c:416
#define GetWindowLongPtrA
Definition: winuser.h:4697
#define SBARS_SIZEGRIP
Definition: commctrl.h:1895
int WINAPI GetSystemMetrics(_In_ int)
#define HTBOTTOMRIGHT
Definition: winuser.h:2449
#define GWL_STYLE
Definition: winuser.h:846
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
static HWND g_hMainWnd
Definition: status.c:39
#define expect(expected, got)
Definition: status.c:28
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
#define SM_CXVSCROLL
Definition: winuser.h:951
#define SUBCLASS_NAME
Definition: status.c:26
LONG bottom
Definition: windef.h:294
#define HTCLIENT
Definition: winuser.h:2429
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_MAXIMIZE
Definition: pedump.c:623

Referenced by START_TEST().

◆ test_status_control()

static void test_status_control ( void  )
static

Definition at line 251 of file status.c.

252 {
253  HWND hWndStatus;
254  int r;
255  int nParts[] = {50, 150, -1};
256  int checkParts[] = {0, 0, 0};
257  int borders[] = {0, 0, 0};
258  RECT rc;
259  CHAR charArray[20];
260  HICON hIcon;
261  char ch;
262  char chstr[10] = "Inval id";
263  COLORREF crColor = RGB(0,0,0);
264 
265  hWndStatus = create_status_control(WS_VISIBLE | SBT_TOOLTIPS, 0);
266 
267  /* Divide into parts and set text */
268  r = SendMessageA(hWndStatus, SB_SETPARTS, 3, (LPARAM)nParts);
269  expect(TRUE,r);
270  r = SendMessageA(hWndStatus, SB_SETTEXTA, SBT_POPOUT|0, (LPARAM)"First");
271  expect(TRUE,r);
272  r = SendMessageA(hWndStatus, SB_SETTEXTA, SBT_OWNERDRAW|1, (LPARAM)"Second");
273  expect(TRUE,r);
274  r = SendMessageA(hWndStatus, SB_SETTEXTA, SBT_NOBORDERS|2, (LPARAM)"Third");
275  expect(TRUE,r);
276 
277  /* Get RECT Information */
278  r = SendMessageA(hWndStatus, SB_GETRECT, 0, (LPARAM)&rc);
279  expect(TRUE,r);
280  expect(2,rc.top);
281  /* The rc.bottom test is system dependent
282  expect(22,rc.bottom); */
283  expect(0,rc.left);
284  expect(50,rc.right);
285  r = SendMessageA(hWndStatus, SB_GETRECT, -1, (LPARAM)&rc);
286  expect(FALSE,r);
287  r = SendMessageA(hWndStatus, SB_GETRECT, 3, (LPARAM)&rc);
288  expect(FALSE,r);
289  /* Get text length and text */
290  r = SendMessageA(hWndStatus, SB_GETTEXTLENGTHA, 0, 0);
291  expect(5,LOWORD(r));
293  r = SendMessageW(hWndStatus, WM_GETTEXTLENGTH, 0, 0);
294  ok(r == 5, "Expected 5, got %d\n", r);
295  r = SendMessageA(hWndStatus, SB_GETTEXTLENGTHA, 1, 0);
296  expect(0,LOWORD(r));
298  r = SendMessageA(hWndStatus, SB_GETTEXTLENGTHA, 2, 0);
299  expect(5,LOWORD(r));
301  r = SendMessageA(hWndStatus, SB_GETTEXTA, 2, (LPARAM) charArray);
302  ok(strcmp(charArray,"Third") == 0, "Expected Third, got %s\n", charArray);
303  expect(5,LOWORD(r));
305 
306  /* Get parts and borders */
307  r = SendMessageA(hWndStatus, SB_GETPARTS, 3, (LPARAM)checkParts);
308  ok(r == 3, "Expected 3, got %d\n", r);
309  expect(50,checkParts[0]);
310  expect(150,checkParts[1]);
311  expect(-1,checkParts[2]);
312  r = SendMessageA(hWndStatus, SB_GETBORDERS, 0, (LPARAM)borders);
313  ok(r == TRUE, "Expected TRUE, got %d\n", r);
314  expect(0,borders[0]);
315  expect(2,borders[1]);
316  expect(2,borders[2]);
317 
318  /* Test resetting text with different characters */
319  r = SendMessageA(hWndStatus, SB_SETTEXTA, 0, (LPARAM)"First@Again");
320  expect(TRUE,r);
321  r = SendMessageA(hWndStatus, SB_SETTEXTA, 1, (LPARAM)"Invalid\tChars\\7\7");
322  expect(TRUE,r);
323  r = SendMessageA(hWndStatus, SB_SETTEXTA, 2, (LPARAM)"InvalidChars\\n\n");
324  expect(TRUE,r);
325 
326  /* Get text again */
327  r = SendMessageA(hWndStatus, SB_GETTEXTA, 0, (LPARAM) charArray);
328  ok(strcmp(charArray,"First@Again") == 0, "Expected First@Again, got %s\n", charArray);
329  expect(11,LOWORD(r));
330  expect(0,HIWORD(r));
331  r = SendMessageA(hWndStatus, SB_GETTEXTA, 1, (LPARAM) charArray);
332  ok(strcmp(charArray,"Invalid\tChars\\7 ") == 0, "Expected Invalid\tChars\\7 , got %s\n", charArray);
333 
334  expect(16,LOWORD(r));
335  expect(0,HIWORD(r));
336  r = SendMessageA(hWndStatus, SB_GETTEXTA, 2, (LPARAM) charArray);
337  ok(strcmp(charArray,"InvalidChars\\n ") == 0, "Expected InvalidChars\\n , got %s\n", charArray);
338 
339  expect(15,LOWORD(r));
340  expect(0,HIWORD(r));
341 
342  /* test more nonprintable chars */
343  for(ch = 0x00; ch < 0x7F; ch++) {
344  chstr[5] = ch;
345  r = SendMessageA(hWndStatus, SB_SETTEXTA, 0, (LPARAM)chstr);
346  expect(TRUE,r);
347  r = SendMessageA(hWndStatus, SB_GETTEXTA, 0, (LPARAM)charArray);
348  ok(r == strlen(charArray), "got %d\n", r);
349  /* substitution with single space */
350  if (ch > 0x00 && ch < 0x20 && ch != '\t')
351  chstr[5] = ' ';
352  ok(strcmp(charArray, chstr) == 0, "Expected %s, got %s\n", chstr, charArray);
353  }
354 
355  /* Set background color */
356  crColor = SendMessageA(hWndStatus, SB_SETBKCOLOR , 0, RGB(255,0,0));
357  ok(crColor == CLR_DEFAULT ||
358  broken(crColor == RGB(0,0,0)), /* win95 */
359  "Expected 0x%.8x, got 0x%.8x\n", CLR_DEFAULT, crColor);
360  crColor = SendMessageA(hWndStatus, SB_SETBKCOLOR , 0, CLR_DEFAULT);
361  ok(crColor == RGB(255,0,0) ||
362  broken(crColor == RGB(0,0,0)), /* win95 */
363  "Expected 0x%.8x, got 0x%.8x\n", RGB(255,0,0), crColor);
364 
365  /* Add an icon to the status bar */
367  r = SendMessageA(hWndStatus, SB_SETICON, 1, 0);
368  ok(r != 0 ||
369  broken(r == 0), /* win95 */
370  "Expected non-zero, got %d\n", r);
371  r = SendMessageA(hWndStatus, SB_SETICON, 1, (LPARAM) hIcon);
372  ok(r != 0 ||
373  broken(r == 0), /* win95 */
374  "Expected non-zero, got %d\n", r);
375  r = SendMessageA(hWndStatus, SB_SETICON, 1, 0);
376  ok(r != 0 ||
377  broken(r == 0), /* win95 */
378  "Expected non-zero, got %d\n", r);
379 
380  /* Set the Unicode format */
381  r = SendMessageA(hWndStatus, SB_SETUNICODEFORMAT, FALSE, 0);
382  expect(FALSE,r);
383  r = SendMessageA(hWndStatus, SB_GETUNICODEFORMAT, 0, 0);
384  expect(FALSE,r);
385  r = SendMessageA(hWndStatus, SB_SETUNICODEFORMAT, TRUE, 0);
386  expect(FALSE,r);
387  r = SendMessageA(hWndStatus, SB_GETUNICODEFORMAT, 0, 0);
388  ok(r == TRUE ||
389  broken(r == FALSE), /* win95 */
390  "Expected TRUE, got %d\n", r);
391 
392  /* Reset number of parts */
393  r = SendMessageA(hWndStatus, SB_SETPARTS, 2, (LPARAM)nParts);
394  expect(TRUE,r);
395  r = SendMessageA(hWndStatus, SB_GETPARTS, 0, 0);
396  ok(r == 2, "Expected 2, got %d\n", r);
397  r = SendMessageA(hWndStatus, SB_SETPARTS, 0, 0);
398  expect(FALSE,r);
399  r = SendMessageA(hWndStatus, SB_GETPARTS, 0, 0);
400  ok(r == 2, "Expected 2, got %d\n", r);
401 
402  /* Set the minimum height and get rectangle information again */
403  SendMessageA(hWndStatus, SB_SETMINHEIGHT, 50, 0);
404  r = SendMessageA(hWndStatus, WM_SIZE, 0, 0);
405  expect(0,r);
406  r = SendMessageA(hWndStatus, SB_GETRECT, 0, (LPARAM)&rc);
407  expect(TRUE,r);
408  expect(2,rc.top);
409  /* The rc.bottom test is system dependent
410  expect(22,rc.bottom); */
411  expect(0,rc.left);
412  expect(50,rc.right);
413  r = SendMessageA(hWndStatus, SB_GETRECT, -1, (LPARAM)&rc);
414  expect(FALSE,r);
415  r = SendMessageA(hWndStatus, SB_GETRECT, 3, (LPARAM)&rc);
416  expect(FALSE,r);
417 
418  /* Set the ToolTip text */
419  SendMessageA(hWndStatus, SB_SETTIPTEXTA, 0,(LPARAM) "Tooltip Text");
420  lstrcpyA(charArray, "apple");
421  SendMessageA(hWndStatus, SB_GETTIPTEXTA, MAKEWPARAM (0, 20),(LPARAM) charArray);
422  ok(strcmp(charArray,"Tooltip Text") == 0 ||
423  broken(!strcmp(charArray, "apple")), /* win95 */
424  "Expected Tooltip Text, got %s\n", charArray);
425 
426  /* Make simple */
427  SendMessageA(hWndStatus, SB_SIMPLE, TRUE, 0);
428  r = SendMessageA(hWndStatus, SB_ISSIMPLE, 0, 0);
429  ok(r == TRUE ||
430  broken(r == FALSE), /* win95 */
431  "Expected TRUE, got %d\n", r);
432 
433  DestroyWindow(hWndStatus);
434 }
#define SBT_POPOUT
Definition: commctrl.h:1944
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
static HICON
Definition: imagelist.c:84
#define SB_ISSIMPLE
Definition: commctrl.h:1932
#define TRUE
Definition: types.h:120
#define MAKEWPARAM(l, h)
Definition: winuser.h:3916
#define SBT_TOOLTIPS
Definition: commctrl.h:1897
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char CHAR
Definition: xmlstorage.h:175
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
BOOL WINAPI DestroyWindow(_In_ HWND)
HICON WINAPI LoadIconA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2029
#define SB_GETRECT
Definition: commctrl.h:1931
#define SB_GETTEXTA
Definition: commctrl.h:1915
#define ok(value,...)
#define SB_SIMPLE
Definition: commctrl.h:1930
smooth NULL
Definition: ftsmooth.c:416
#define SB_GETBORDERS
Definition: commctrl.h:1928
#define SB_SETBKCOLOR
Definition: commctrl.h:1948
LONG_PTR LPARAM
Definition: windef.h:208
const char * LPCSTR
Definition: xmlstorage.h:183
#define SB_SETUNICODEFORMAT
Definition: commctrl.h:1939
#define WM_SIZE
Definition: winuser.h:1593
DWORD COLORREF
Definition: windef.h:285
#define RGB(r, g, b)
Definition: wingdi.h:2918
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
#define SB_SETTEXTA
Definition: commctrl.h:1913
static HWND create_status_control(DWORD style, DWORD exstyle)
Definition: status.c:48
#define SB_SETICON
Definition: commctrl.h:1933
#define broken(x)
Definition: _sntprintf.h:21
#define IDI_QUESTION
Definition: winuser.h:701
#define SB_GETTEXTLENGTHA
Definition: commctrl.h:1917
HICON hIcon
Definition: msconfig.c:44
#define expect(expected, got)
Definition: status.c:28
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SB_SETPARTS
Definition: commctrl.h:1926
#define CLR_DEFAULT
Definition: commctrl.h:305
#define SBT_OWNERDRAW
Definition: commctrl.h:1942
#define HIWORD(l)
Definition: typedefs.h:246
#define SB_SETTIPTEXTA
Definition: commctrl.h:1934
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define SB_GETUNICODEFORMAT
Definition: commctrl.h:1940
#define SB_GETPARTS
Definition: commctrl.h:1927
#define SB_SETMINHEIGHT
Definition: commctrl.h:1929
#define WS_VISIBLE
Definition: pedump.c:620
#define SB_GETTIPTEXTA
Definition: commctrl.h:1936
#define SBT_NOBORDERS
Definition: commctrl.h:1943
#define LOWORD(l)
Definition: pedump.c:82

Referenced by START_TEST().

◆ test_status_ownerdraw()

static void test_status_ownerdraw ( void  )
static

Definition at line 445 of file status.c.

446 {
447  HWND hWndStatus;
448  int r;
449  const char* statustext = "STATUS TEXT";
450  LONG oldstyle;
451 
452  /* subclass the main window and make sure it is visible */
455  ok( g_wndproc_saved != 0, "failed to set the WndProc\n");
457  oldstyle = GetWindowLongA( g_hMainWnd, GWL_STYLE);
459  /* create a status child window */
460  ok((hWndStatus = CreateWindowA(SUBCLASS_NAME, "", WS_CHILD|WS_VISIBLE, 0, 0, 100, 100,
461  g_hMainWnd, NULL, NULL, 0)) != NULL, "CreateWindowA failed\n");
462  /* set text */
463  g_wmdrawitm_ctr = 0;
464  r = SendMessageA(hWndStatus, SB_SETTEXTA, 0, (LPARAM)statustext);
465  ok( r == TRUE, "Sendmessage returned %d, expected 1\n", r);
466  ok( 0 == g_wmdrawitm_ctr, "got %d drawitem messages expected none\n", g_wmdrawitm_ctr);
467  /* set same text, with ownerdraw flag */
468  g_wmdrawitm_ctr = 0;
469  r = SendMessageA(hWndStatus, SB_SETTEXTA, SBT_OWNERDRAW, (LPARAM)statustext);
470  ok( r == TRUE, "Sendmessage returned %d, expected 1\n", r);
471  ok( 1 == g_wmdrawitm_ctr, "got %d drawitem messages expected 1\n", g_wmdrawitm_ctr);
472  /* and again */
473  g_wmdrawitm_ctr = 0;
474  r = SendMessageA(hWndStatus, SB_SETTEXTA, SBT_OWNERDRAW, (LPARAM)statustext);
475  ok( r == TRUE, "Sendmessage returned %d, expected 1\n", r);
476  ok( 1 == g_wmdrawitm_ctr, "got %d drawitem messages expected 1\n", g_wmdrawitm_ctr);
477  /* clean up */
478  DestroyWindow(hWndStatus);
479  SetWindowLongA( g_hMainWnd, GWL_STYLE, oldstyle);
481 }
#define TRUE
Definition: types.h:120
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define HWND_TOPMOST
Definition: winuser.h:1194
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI DestroyWindow(_In_ HWND)
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
long LONG
Definition: pedump.c:60
#define ok(value,...)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
static LRESULT WINAPI ownerdraw_test_wndproc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: status.c:436
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define SB_SETTEXTA
Definition: commctrl.h:1913
static WNDPROC g_wndproc_saved
Definition: status.c:44
#define SetWindowLongPtrA
Definition: winuser.h:5214
#define GWLP_WNDPROC
Definition: treelist.c:66
#define SWP_NOSIZE
Definition: winuser.h:1230
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
#define GWL_STYLE
Definition: winuser.h:846
static HWND g_hMainWnd
Definition: status.c:39
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
static int g_wmdrawitm_ctr
Definition: status.c:43
#define SUBCLASS_NAME
Definition: status.c:26
#define SBT_OWNERDRAW
Definition: commctrl.h:1942
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by START_TEST().

Variable Documentation

◆ g_dpisize

INT g_dpisize
static

Definition at line 42 of file status.c.

Referenced by check_height_font_enumproc(), and test_height().

◆ g_got_click

BOOL g_got_click
static

Definition at line 513 of file status.c.

Referenced by test_notify(), and test_notify_parent_proc().

◆ g_got_contextmenu

BOOL g_got_contextmenu
static

Definition at line 518 of file status.c.

Referenced by test_notify(), and test_notify_parent_proc().

◆ g_got_dblclk

BOOL g_got_dblclk
static

Definition at line 512 of file status.c.

Referenced by test_notify(), and test_notify_parent_proc().

◆ g_got_rclick

BOOL g_got_rclick
static

Definition at line 515 of file status.c.

Referenced by test_notify(), and test_notify_parent_proc().

◆ g_got_rdblclk

BOOL g_got_rdblclk
static

Definition at line 514 of file status.c.

Referenced by test_notify(), and test_notify_parent_proc().

◆ g_hMainWnd

◆ g_rcCreated

RECT g_rcCreated
static

Definition at line 38 of file status.c.

Referenced by create_test_wndproc(), and test_create().

◆ g_status_wndproc

WNDPROC g_status_wndproc
static

Definition at line 37 of file status.c.

Referenced by create_test_wndproc(), and register_subclass().

◆ g_wmdrawitm_ctr

int g_wmdrawitm_ctr
static

Definition at line 43 of file status.c.

Referenced by ownerdraw_test_wndproc(), and test_status_ownerdraw().

◆ g_wmsize_count

int g_wmsize_count = 0
static

Definition at line 40 of file status.c.

Referenced by create_test_wndproc(), and test_height().

◆ g_wndproc_saved

WNDPROC g_wndproc_saved
static

Definition at line 44 of file status.c.

Referenced by ownerdraw_test_wndproc(), and test_status_ownerdraw().

◆ g_ysize

INT g_ysize
static

Definition at line 41 of file status.c.

Referenced by check_height_font_enumproc(), and test_height().

◆ hinst

HINSTANCE hinst
static

Definition at line 36 of file status.c.

Referenced by create_status_control(), and START_TEST().