2007-01-03 07:23:51 +01:00
|
|
|
/* Unit test suite for status control.
|
|
|
|
*
|
|
|
|
* Copyright 2007 Google (Lei Zhang)
|
2007-02-26 05:43:26 +01:00
|
|
|
* Copyright 2007 Alex Arazi
|
2007-01-03 07:23:51 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <windows.h>
|
|
|
|
#include <commctrl.h>
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
2008-07-16 20:21:09 +02:00
|
|
|
#define SUBCLASS_NAME "MyStatusBar"
|
|
|
|
|
2008-07-16 15:25:43 +02:00
|
|
|
#define expect(expected,got) ok (expected == got,"Expected %d, got %d\n",expected,got)
|
2008-09-08 07:46:53 +02:00
|
|
|
#define expect_rect(_left,_top,_right,_bottom,got) 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 {%d,%d, %d,%d}\n", \
|
|
|
|
_left, _top, _right, _bottom, \
|
|
|
|
(got).left, (got).top, (got).right, (got).bottom); } while (0)
|
2007-02-26 05:43:26 +01:00
|
|
|
|
2007-01-03 07:23:51 +01:00
|
|
|
static HINSTANCE hinst;
|
2008-07-16 15:25:43 +02:00
|
|
|
static WNDPROC g_status_wndproc;
|
|
|
|
static RECT g_rcCreated;
|
|
|
|
static HWND g_hMainWnd;
|
2008-07-16 20:21:09 +02:00
|
|
|
static int g_wmsize_count = 0;
|
2007-01-03 07:23:51 +01:00
|
|
|
|
|
|
|
static HWND create_status_control(DWORD style, DWORD exstyle)
|
|
|
|
{
|
|
|
|
HWND hWndStatus;
|
|
|
|
|
|
|
|
/* make the control */
|
2007-02-26 05:43:26 +01:00
|
|
|
hWndStatus = CreateWindowEx(exstyle, STATUSCLASSNAME, NULL, style,
|
2007-01-03 07:23:51 +01:00
|
|
|
/* placement */
|
|
|
|
0, 0, 300, 20,
|
|
|
|
/* parent, etc */
|
|
|
|
NULL, NULL, hinst, NULL);
|
|
|
|
assert (hWndStatus);
|
|
|
|
return hWndStatus;
|
|
|
|
}
|
|
|
|
|
2008-07-16 15:25:43 +02:00
|
|
|
static LRESULT WINAPI create_test_wndproc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2008-07-16 20:21:09 +02:00
|
|
|
LRESULT ret;
|
|
|
|
|
2008-07-16 15:25:43 +02:00
|
|
|
if (msg == WM_CREATE)
|
|
|
|
{
|
|
|
|
CREATESTRUCT *cs = (CREATESTRUCT *)lParam;
|
2008-07-16 20:21:09 +02:00
|
|
|
ret = CallWindowProc(g_status_wndproc, hwnd, msg, wParam, lParam);
|
2008-07-16 15:25:43 +02:00
|
|
|
GetWindowRect(hwnd, &g_rcCreated);
|
|
|
|
MapWindowPoints(HWND_DESKTOP, g_hMainWnd, (LPPOINT)&g_rcCreated, 2);
|
|
|
|
ok(cs->x == g_rcCreated.left, "CREATESTRUCT.x modified\n");
|
|
|
|
ok(cs->y == g_rcCreated.top, "CREATESTRUCT.y modified\n");
|
2008-07-16 20:21:09 +02:00
|
|
|
} else if (msg == WM_SIZE)
|
|
|
|
{
|
|
|
|
g_wmsize_count++;
|
|
|
|
ret = CallWindowProc(g_status_wndproc, hwnd, msg, wParam, lParam);
|
2008-07-16 15:25:43 +02:00
|
|
|
}
|
2008-07-16 20:21:09 +02:00
|
|
|
else
|
|
|
|
ret = CallWindowProc(g_status_wndproc, hwnd, msg, wParam, lParam);
|
|
|
|
|
|
|
|
return ret;
|
2008-07-16 15:25:43 +02:00
|
|
|
}
|
|
|
|
|
2009-01-25 23:27:18 +01:00
|
|
|
static void register_subclass(void)
|
2008-07-16 15:25:43 +02:00
|
|
|
{
|
|
|
|
WNDCLASSEX cls;
|
|
|
|
|
|
|
|
cls.cbSize = sizeof(WNDCLASSEX);
|
|
|
|
GetClassInfoEx(NULL, STATUSCLASSNAME, &cls);
|
|
|
|
g_status_wndproc = cls.lpfnWndProc;
|
|
|
|
cls.lpfnWndProc = create_test_wndproc;
|
2008-07-16 20:21:09 +02:00
|
|
|
cls.lpszClassName = SUBCLASS_NAME;
|
2008-07-16 15:25:43 +02:00
|
|
|
cls.hInstance = NULL;
|
|
|
|
ok(RegisterClassEx(&cls), "RegisterClassEx failed\n");
|
2008-07-16 20:21:09 +02:00
|
|
|
}
|
2008-07-16 15:25:43 +02:00
|
|
|
|
2009-01-25 23:27:18 +01:00
|
|
|
static void test_create(void)
|
2008-07-16 20:21:09 +02:00
|
|
|
{
|
|
|
|
RECT rc;
|
|
|
|
HWND hwnd;
|
|
|
|
|
|
|
|
ok((hwnd = CreateWindowA(SUBCLASS_NAME, "", WS_CHILD|WS_VISIBLE|SBARS_SIZEGRIP, 0, 0, 100, 100,
|
2008-07-16 15:25:43 +02:00
|
|
|
g_hMainWnd, NULL, NULL, 0)) != NULL, "CreateWindowA failed\n");
|
|
|
|
MapWindowPoints(HWND_DESKTOP, g_hMainWnd, (LPPOINT)&rc, 2);
|
|
|
|
GetWindowRect(hwnd, &rc);
|
|
|
|
MapWindowPoints(HWND_DESKTOP, g_hMainWnd, (LPPOINT)&rc, 2);
|
|
|
|
expect_rect(0, 0, 100, 100, g_rcCreated);
|
|
|
|
expect(0, rc.left);
|
|
|
|
expect(672, rc.right);
|
|
|
|
expect(226, rc.bottom);
|
|
|
|
/* we don't check rc.top as this may depend on user font settings */
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
}
|
|
|
|
|
2008-07-17 17:33:08 +02:00
|
|
|
static int CALLBACK check_height_font_enumproc(ENUMLOGFONTEX *enumlf, NEWTEXTMETRICEX *ntm, DWORD type, LPARAM lParam)
|
2008-07-16 20:21:09 +02:00
|
|
|
{
|
2008-07-17 17:33:08 +02:00
|
|
|
HWND hwndStatus = (HWND)lParam;
|
|
|
|
HDC hdc = GetDC(NULL);
|
|
|
|
static const int sizes[] = {8, 9, 10, 12, 16, 22, 28, 36, 48, 72};
|
|
|
|
int i;
|
|
|
|
|
|
|
|
trace("Font %s\n", enumlf->elfFullName);
|
|
|
|
for (i = 0; i < sizeof(sizes)/sizeof(sizes[0]); i++)
|
|
|
|
{
|
|
|
|
HFONT hFont;
|
|
|
|
TEXTMETRIC tm;
|
|
|
|
HFONT hCtrlFont;
|
|
|
|
HFONT hOldFont;
|
|
|
|
RECT rcCtrl;
|
|
|
|
|
|
|
|
enumlf->elfLogFont.lfHeight = sizes[i];
|
|
|
|
hFont = CreateFontIndirect(&enumlf->elfLogFont);
|
|
|
|
hCtrlFont = (HFONT)SendMessage(hwndStatus, WM_SETFONT, (WPARAM)hFont, TRUE);
|
|
|
|
hOldFont = SelectObject(hdc, hFont);
|
|
|
|
|
|
|
|
GetClientRect(hwndStatus, &rcCtrl);
|
|
|
|
GetTextMetrics(hdc, &tm);
|
|
|
|
expect(max(tm.tmHeight + (tm.tmInternalLeading ? tm.tmInternalLeading : 2) + 4, 20), rcCtrl.bottom);
|
|
|
|
|
|
|
|
SelectObject(hdc, hOldFont);
|
|
|
|
SendMessage(hwndStatus, WM_SETFONT, (WPARAM)hCtrlFont, TRUE);
|
|
|
|
DeleteObject(hFont);
|
|
|
|
}
|
|
|
|
ReleaseDC(NULL, hdc);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int CALLBACK check_height_family_enumproc(ENUMLOGFONTEX *enumlf, NEWTEXTMETRICEX *ntm, DWORD type, LPARAM lParam)
|
|
|
|
{
|
|
|
|
HDC hdc = GetDC(NULL);
|
|
|
|
enumlf->elfLogFont.lfHeight = 0;
|
|
|
|
EnumFontFamiliesEx(hdc, &enumlf->elfLogFont, (FONTENUMPROC)check_height_font_enumproc, lParam, 0);
|
|
|
|
ReleaseDC(NULL, hdc);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_height(void)
|
|
|
|
{
|
|
|
|
LOGFONT lf;
|
2008-07-22 21:29:19 +02:00
|
|
|
HFONT hFont, hFontSm;
|
2008-07-16 20:21:09 +02:00
|
|
|
RECT rc1, rc2;
|
|
|
|
HWND hwndStatus = CreateWindow(SUBCLASS_NAME, NULL, WS_CHILD|WS_VISIBLE,
|
|
|
|
0, 0, 300, 20, g_hMainWnd, NULL, NULL, NULL);
|
2008-07-17 17:33:08 +02:00
|
|
|
HDC hdc;
|
2008-07-16 20:21:09 +02:00
|
|
|
|
|
|
|
GetClientRect(hwndStatus, &rc1);
|
|
|
|
hFont = CreateFont(32, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET,
|
|
|
|
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, "Tahoma");
|
|
|
|
|
|
|
|
g_wmsize_count = 0;
|
|
|
|
SendMessage(hwndStatus, WM_SETFONT, (WPARAM)hFont, TRUE);
|
2008-09-15 11:08:24 +02:00
|
|
|
if (!g_wmsize_count)
|
|
|
|
{
|
2008-09-24 10:04:05 +02:00
|
|
|
skip("Status control not resized in win95, skipping broken tests.\n");
|
2008-09-15 11:08:24 +02:00
|
|
|
return;
|
|
|
|
}
|
2008-07-16 20:21:09 +02:00
|
|
|
ok(g_wmsize_count > 0, "WM_SETFONT should issue WM_SIZE\n");
|
|
|
|
|
|
|
|
GetClientRect(hwndStatus, &rc2);
|
2008-09-08 07:46:53 +02:00
|
|
|
expect_rect(0, 0, 672, 42, rc2); /* GetTextMetrics returns invalid tmInternalLeading for this font */
|
2008-07-16 20:21:09 +02:00
|
|
|
|
|
|
|
g_wmsize_count = 0;
|
|
|
|
SendMessage(hwndStatus, WM_SETFONT, (WPARAM)hFont, TRUE);
|
|
|
|
ok(g_wmsize_count > 0, "WM_SETFONT should issue WM_SIZE\n");
|
|
|
|
|
|
|
|
GetClientRect(hwndStatus, &rc2);
|
2008-09-08 07:46:53 +02:00
|
|
|
expect_rect(0, 0, 672, 42, rc2);
|
2008-07-16 20:21:09 +02:00
|
|
|
|
2008-07-22 21:29:19 +02:00
|
|
|
/* minheight < fontsize - no effects*/
|
|
|
|
SendMessage(hwndStatus, SB_SETMINHEIGHT, 12, 0);
|
|
|
|
SendMessage(hwndStatus, WM_SIZE, 0, 0);
|
|
|
|
GetClientRect(hwndStatus, &rc2);
|
2008-09-08 07:46:53 +02:00
|
|
|
expect_rect(0, 0, 672, 42, rc2);
|
2008-07-22 21:29:19 +02:00
|
|
|
|
|
|
|
/* minheight > fontsize - has an effect after WM_SIZE */
|
|
|
|
SendMessage(hwndStatus, SB_SETMINHEIGHT, 60, 0);
|
|
|
|
GetClientRect(hwndStatus, &rc2);
|
2008-09-08 07:46:53 +02:00
|
|
|
expect_rect(0, 0, 672, 42, rc2);
|
2008-07-22 21:29:19 +02:00
|
|
|
SendMessage(hwndStatus, WM_SIZE, 0, 0);
|
|
|
|
GetClientRect(hwndStatus, &rc2);
|
|
|
|
expect_rect(0, 0, 672, 62, rc2);
|
|
|
|
|
|
|
|
/* font changed to smaller than minheight - has an effect */
|
|
|
|
SendMessage(hwndStatus, SB_SETMINHEIGHT, 30, 0);
|
|
|
|
expect_rect(0, 0, 672, 62, rc2);
|
|
|
|
SendMessage(hwndStatus, WM_SIZE, 0, 0);
|
|
|
|
GetClientRect(hwndStatus, &rc2);
|
2008-09-08 07:46:53 +02:00
|
|
|
expect_rect(0, 0, 672, 42, rc2);
|
2008-07-22 21:29:19 +02:00
|
|
|
hFontSm = CreateFont(9, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET,
|
|
|
|
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, "Tahoma");
|
|
|
|
SendMessage(hwndStatus, WM_SETFONT, (WPARAM)hFontSm, TRUE);
|
|
|
|
GetClientRect(hwndStatus, &rc2);
|
|
|
|
expect_rect(0, 0, 672, 32, rc2);
|
|
|
|
|
2008-07-17 17:33:08 +02:00
|
|
|
/* test the height formula */
|
|
|
|
ZeroMemory(&lf, sizeof(lf));
|
|
|
|
SendMessage(hwndStatus, SB_SETMINHEIGHT, 0, 0);
|
|
|
|
hdc = GetDC(NULL);
|
|
|
|
trace("dpi=%d\n", GetDeviceCaps(hdc, LOGPIXELSY));
|
|
|
|
EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)check_height_family_enumproc, (LPARAM)hwndStatus, 0);
|
|
|
|
ReleaseDC(NULL, hdc);
|
|
|
|
|
2008-07-16 20:21:09 +02:00
|
|
|
DestroyWindow(hwndStatus);
|
|
|
|
DeleteObject(hFont);
|
2008-07-22 21:29:19 +02:00
|
|
|
DeleteObject(hFontSm);
|
2008-07-16 20:21:09 +02:00
|
|
|
}
|
|
|
|
|
2007-01-03 07:23:51 +01:00
|
|
|
static void test_status_control(void)
|
|
|
|
{
|
|
|
|
HWND hWndStatus;
|
|
|
|
int r;
|
|
|
|
int nParts[] = {50, 150, -1};
|
2007-02-26 05:43:26 +01:00
|
|
|
int checkParts[] = {0, 0, 0};
|
|
|
|
int borders[] = {0, 0, 0};
|
2007-01-03 07:23:51 +01:00
|
|
|
RECT rc;
|
2007-02-26 05:43:26 +01:00
|
|
|
CHAR charArray[20];
|
|
|
|
HICON hIcon;
|
|
|
|
|
|
|
|
hWndStatus = create_status_control(WS_VISIBLE, 0);
|
2007-01-03 07:23:51 +01:00
|
|
|
|
2007-02-26 05:43:26 +01:00
|
|
|
/* Divide into parts and set text */
|
2008-07-16 15:25:43 +02:00
|
|
|
r = SendMessage(hWndStatus, SB_SETPARTS, 3, (LPARAM)nParts);
|
2007-02-26 05:43:26 +01:00
|
|
|
expect(TRUE,r);
|
2007-01-03 07:23:51 +01:00
|
|
|
r = SendMessage(hWndStatus, SB_SETTEXT, 0, (LPARAM)"First");
|
2007-02-26 05:43:26 +01:00
|
|
|
expect(TRUE,r);
|
2007-01-03 07:23:51 +01:00
|
|
|
r = SendMessage(hWndStatus, SB_SETTEXT, 1, (LPARAM)"Second");
|
2007-02-26 05:43:26 +01:00
|
|
|
expect(TRUE,r);
|
2007-01-03 07:23:51 +01:00
|
|
|
r = SendMessage(hWndStatus, SB_SETTEXT, 2, (LPARAM)"Third");
|
2007-02-26 05:43:26 +01:00
|
|
|
expect(TRUE,r);
|
2007-01-03 07:23:51 +01:00
|
|
|
|
2007-02-26 05:43:26 +01:00
|
|
|
/* Get RECT Information */
|
2007-01-03 07:23:51 +01:00
|
|
|
r = SendMessage(hWndStatus, SB_GETRECT, 0, (LPARAM)&rc);
|
2007-02-26 05:43:26 +01:00
|
|
|
expect(TRUE,r);
|
|
|
|
expect(2,rc.top);
|
|
|
|
/* The rc.bottom test is system dependent
|
|
|
|
expect(22,rc.bottom); */
|
|
|
|
expect(0,rc.left);
|
|
|
|
expect(50,rc.right);
|
|
|
|
r = SendMessage(hWndStatus, SB_GETRECT, -1, (LPARAM)&rc);
|
|
|
|
expect(FALSE,r);
|
|
|
|
r = SendMessage(hWndStatus, SB_GETRECT, 3, (LPARAM)&rc);
|
|
|
|
expect(FALSE,r);
|
|
|
|
/* Get text length and text */
|
|
|
|
r = SendMessage(hWndStatus, SB_GETTEXTLENGTH, 2, 0);
|
|
|
|
expect(5,LOWORD(r));
|
|
|
|
expect(0,HIWORD(r));
|
|
|
|
r = SendMessage(hWndStatus, SB_GETTEXT, 2, (LPARAM) charArray);
|
|
|
|
ok(strcmp(charArray,"Third") == 0, "Expected Third, got %s\n", charArray);
|
|
|
|
expect(5,LOWORD(r));
|
|
|
|
expect(0,HIWORD(r));
|
|
|
|
|
|
|
|
/* Get parts and borders */
|
2008-07-16 15:25:43 +02:00
|
|
|
r = SendMessage(hWndStatus, SB_GETPARTS, 3, (LPARAM)checkParts);
|
2007-02-26 05:43:26 +01:00
|
|
|
ok(r == 3, "Expected 3, got %d\n", r);
|
|
|
|
expect(50,checkParts[0]);
|
|
|
|
expect(150,checkParts[1]);
|
|
|
|
expect(-1,checkParts[2]);
|
2008-07-16 15:25:43 +02:00
|
|
|
r = SendMessage(hWndStatus, SB_GETBORDERS, 0, (LPARAM)borders);
|
2007-01-03 07:23:51 +01:00
|
|
|
ok(r == TRUE, "Expected TRUE, got %d\n", r);
|
2007-02-26 05:43:26 +01:00
|
|
|
expect(0,borders[0]);
|
|
|
|
expect(2,borders[1]);
|
|
|
|
expect(2,borders[2]);
|
|
|
|
|
|
|
|
/* Test resetting text with different characters */
|
|
|
|
r = SendMessage(hWndStatus, SB_SETTEXT, 0, (LPARAM)"First@Again");
|
|
|
|
expect(TRUE,r);
|
|
|
|
r = SendMessage(hWndStatus, SB_SETTEXT, 1, (LPARAM)"InvalidChars\\7\7");
|
|
|
|
expect(TRUE,r);
|
|
|
|
r = SendMessage(hWndStatus, SB_SETTEXT, 2, (LPARAM)"InvalidChars\\n\n");
|
|
|
|
expect(TRUE,r);
|
2007-01-03 07:23:51 +01:00
|
|
|
|
2007-02-26 05:43:26 +01:00
|
|
|
/* Get text again */
|
|
|
|
r = SendMessage(hWndStatus, SB_GETTEXT, 0, (LPARAM) charArray);
|
|
|
|
ok(strcmp(charArray,"First@Again") == 0, "Expected First@Again, got %s\n", charArray);
|
|
|
|
expect(11,LOWORD(r));
|
|
|
|
expect(0,HIWORD(r));
|
|
|
|
r = SendMessage(hWndStatus, SB_GETTEXT, 1, (LPARAM) charArray);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(strcmp(charArray,"InvalidChars\\7 ") == 0, "Expected InvalidChars\\7 , got %s\n", charArray);
|
|
|
|
}
|
|
|
|
expect(15,LOWORD(r));
|
|
|
|
expect(0,HIWORD(r));
|
|
|
|
r = SendMessage(hWndStatus, SB_GETTEXT, 2, (LPARAM) charArray);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(strcmp(charArray,"InvalidChars\\n ") == 0, "Expected InvalidChars\\n , got %s\n", charArray);
|
|
|
|
}
|
|
|
|
expect(15,LOWORD(r));
|
|
|
|
expect(0,HIWORD(r));
|
|
|
|
|
|
|
|
/* Set background color */
|
|
|
|
r = SendMessage(hWndStatus, SB_SETBKCOLOR , 0, RGB(255,0,0));
|
2008-09-15 04:47:19 +02:00
|
|
|
ok(r == CLR_DEFAULT ||
|
|
|
|
broken(r == 0), /* win95 */
|
|
|
|
"Expected %d, got %d\n", CLR_DEFAULT, r);
|
2007-02-26 05:43:26 +01:00
|
|
|
r = SendMessage(hWndStatus, SB_SETBKCOLOR , 0, CLR_DEFAULT);
|
2008-09-15 04:47:19 +02:00
|
|
|
ok(r == RGB(255,0,0) ||
|
|
|
|
broken(r == 0), /* win95 */
|
|
|
|
"Expected %d, got %d\n", RGB(255,0,0), r);
|
2007-02-26 05:43:26 +01:00
|
|
|
|
|
|
|
/* Add an icon to the status bar */
|
|
|
|
hIcon = LoadIcon(NULL, IDI_QUESTION);
|
2008-11-02 00:22:49 +01:00
|
|
|
r = SendMessage(hWndStatus, SB_SETICON, 1, 0);
|
2008-09-15 04:47:19 +02:00
|
|
|
ok(r != 0 ||
|
|
|
|
broken(r == 0), /* win95 */
|
|
|
|
"Expected non-zero, got %d\n", r);
|
2007-02-26 05:43:26 +01:00
|
|
|
r = SendMessage(hWndStatus, SB_SETICON, 1, (LPARAM) hIcon);
|
2008-09-15 04:47:19 +02:00
|
|
|
ok(r != 0 ||
|
|
|
|
broken(r == 0), /* win95 */
|
|
|
|
"Expected non-zero, got %d\n", r);
|
2008-11-02 00:22:49 +01:00
|
|
|
r = SendMessage(hWndStatus, SB_SETICON, 1, 0);
|
2008-09-15 04:47:19 +02:00
|
|
|
ok(r != 0 ||
|
|
|
|
broken(r == 0), /* win95 */
|
|
|
|
"Expected non-zero, got %d\n", r);
|
2007-02-26 05:43:26 +01:00
|
|
|
|
|
|
|
/* Set the Unicode format */
|
|
|
|
r = SendMessage(hWndStatus, SB_SETUNICODEFORMAT, FALSE, 0);
|
|
|
|
r = SendMessage(hWndStatus, SB_GETUNICODEFORMAT, 0, 0);
|
|
|
|
expect(FALSE,r);
|
|
|
|
r = SendMessage(hWndStatus, SB_SETUNICODEFORMAT, TRUE, 0);
|
|
|
|
expect(FALSE,r);
|
|
|
|
r = SendMessage(hWndStatus, SB_GETUNICODEFORMAT, 0, 0);
|
2008-09-15 04:47:19 +02:00
|
|
|
ok(r == TRUE ||
|
|
|
|
broken(r == FALSE), /* win95 */
|
|
|
|
"Expected TRUE, got %d\n", r);
|
2007-02-26 05:43:26 +01:00
|
|
|
|
|
|
|
/* Reset number of parts */
|
2008-07-16 15:25:43 +02:00
|
|
|
r = SendMessage(hWndStatus, SB_SETPARTS, 2, (LPARAM)nParts);
|
2007-02-26 05:43:26 +01:00
|
|
|
expect(TRUE,r);
|
|
|
|
|
|
|
|
/* Set the minimum height and get rectangle information again */
|
2008-11-03 22:43:40 +01:00
|
|
|
SendMessage(hWndStatus, SB_SETMINHEIGHT, 50, 0);
|
|
|
|
r = SendMessage(hWndStatus, WM_SIZE, 0, 0);
|
2007-02-26 05:43:26 +01:00
|
|
|
expect(0,r);
|
|
|
|
r = SendMessage(hWndStatus, SB_GETRECT, 0, (LPARAM)&rc);
|
|
|
|
expect(TRUE,r);
|
|
|
|
expect(2,rc.top);
|
|
|
|
/* The rc.bottom test is system dependent
|
|
|
|
expect(22,rc.bottom); */
|
|
|
|
expect(0,rc.left);
|
|
|
|
expect(50,rc.right);
|
2007-01-03 07:23:51 +01:00
|
|
|
r = SendMessage(hWndStatus, SB_GETRECT, -1, (LPARAM)&rc);
|
2007-02-26 05:43:26 +01:00
|
|
|
expect(FALSE,r);
|
|
|
|
r = SendMessage(hWndStatus, SB_GETRECT, 3, (LPARAM)&rc);
|
|
|
|
expect(FALSE,r);
|
|
|
|
|
|
|
|
/* Set the ToolTip text */
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
SendMessage(hWndStatus, SB_SETTIPTEXT, 0,(LPARAM) "Tooltip Text");
|
2008-09-15 11:08:24 +02:00
|
|
|
lstrcpyA(charArray, "apple");
|
2007-02-26 05:43:26 +01:00
|
|
|
SendMessage(hWndStatus, SB_GETTIPTEXT, MAKEWPARAM (0, 20),(LPARAM) charArray);
|
2008-09-15 11:08:24 +02:00
|
|
|
ok(strcmp(charArray,"Tooltip Text") == 0 ||
|
|
|
|
broken(!strcmp(charArray, "apple")), /* win95 */
|
|
|
|
"Expected Tooltip Text, got %s\n", charArray);
|
2007-02-26 05:43:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Make simple */
|
|
|
|
SendMessage(hWndStatus, SB_SIMPLE, TRUE, 0);
|
|
|
|
r = SendMessage(hWndStatus, SB_ISSIMPLE, 0, 0);
|
2008-09-24 10:03:28 +02:00
|
|
|
ok(r == TRUE ||
|
|
|
|
broken(r == FALSE), /* win95 */
|
|
|
|
"Expected TRUE, got %d\n", r);
|
2007-01-03 07:23:51 +01:00
|
|
|
|
|
|
|
DestroyWindow(hWndStatus);
|
|
|
|
}
|
|
|
|
|
|
|
|
START_TEST(status)
|
|
|
|
{
|
|
|
|
hinst = GetModuleHandleA(NULL);
|
|
|
|
|
2008-07-16 15:25:43 +02:00
|
|
|
g_hMainWnd = CreateWindowExA(0, "static", "", WS_OVERLAPPEDWINDOW,
|
|
|
|
CW_USEDEFAULT, CW_USEDEFAULT, 672+2*GetSystemMetrics(SM_CXSIZEFRAME),
|
|
|
|
226+GetSystemMetrics(SM_CYCAPTION)+2*GetSystemMetrics(SM_CYSIZEFRAME),
|
|
|
|
NULL, NULL, GetModuleHandleA(NULL), 0);
|
|
|
|
|
2007-01-03 07:23:51 +01:00
|
|
|
InitCommonControls();
|
|
|
|
|
2008-07-16 20:21:09 +02:00
|
|
|
register_subclass();
|
|
|
|
|
2007-01-03 07:23:51 +01:00
|
|
|
test_status_control();
|
2008-07-16 15:25:43 +02:00
|
|
|
test_create();
|
2008-07-17 17:33:08 +02:00
|
|
|
test_height();
|
2007-01-03 07:23:51 +01:00
|
|
|
}
|