advapi32: Remove a useless macro.
[wine] / dlls / comctl32 / tests / status.c
1 /* Unit test suite for status control.
2  *
3  * Copyright 2007 Google (Lei Zhang)
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18  */
19
20 #include <assert.h>
21 #include <windows.h>
22 #include <commctrl.h>
23 #include <stdio.h>
24
25 #include "wine/test.h"
26
27 static HINSTANCE hinst;
28
29 static HWND create_status_control(DWORD style, DWORD exstyle)
30 {
31     HWND hWndStatus;
32
33     /* make the control */
34     hWndStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, style,
35         /* placement */
36         0, 0, 300, 20,
37         /* parent, etc */
38         NULL, NULL, hinst, NULL);
39     assert (hWndStatus);
40     return hWndStatus;
41 }
42
43 static void test_status_control(void)
44 {
45     HWND hWndStatus;
46     int r;
47     int nParts[] = {50, 150, -1};
48     RECT rc;
49
50     hWndStatus = create_status_control(0, 0);
51     r = SendMessage(hWndStatus, SB_SETPARTS, 3, (long)nParts);
52     ok(r == TRUE, "Expected TRUE, got %d\n", r);
53     r = SendMessage(hWndStatus, SB_SETTEXT, 0, (LPARAM)"First");
54     ok(r == TRUE, "Expected TRUE, got %d\n", r);
55     r = SendMessage(hWndStatus, SB_SETTEXT, 1, (LPARAM)"Second");
56     ok(r == TRUE, "Expected TRUE, got %d\n", r);
57     r = SendMessage(hWndStatus, SB_SETTEXT, 2, (LPARAM)"Third");
58     ok(r == TRUE, "Expected TRUE, got %d\n", r);
59
60     r = SendMessage(hWndStatus, SB_GETRECT, 0, (LPARAM)&rc);
61     ok(r == TRUE, "Expected TRUE, got %d\n", r);
62     ok(rc.top == 2, "Expected 2, got %d\n", rc.top);
63     ok(rc.bottom == 21, "Expected 21, got %d\n", rc.bottom);
64     ok(rc.left == 0, "Expected 0, got %d\n", rc.left);
65     ok(rc.right == 50, "Expected 50, got %d\n", rc.right);
66
67     r = SendMessage(hWndStatus, SB_GETRECT, -1, (LPARAM)&rc);
68     ok(r == FALSE, "Expected FALSE, got %d\n", r);
69     r = SendMessage(hWndStatus, SB_GETRECT, 5, (LPARAM)&rc);
70     ok(r == FALSE, "Expected FALSE, got %d\n", r);
71
72     DestroyWindow(hWndStatus);
73 }
74
75 START_TEST(status)
76 {
77     hinst = GetModuleHandleA(NULL);
78
79     InitCommonControls();
80
81     test_status_control();
82 }