comctl32: rebar: New conformance test for CCS_NORESIZE style.
[sorry try 2, PATCH 1/2]
Misha Koshelev
mk144210 at bcm.tmc.edu
Sat Feb 17 00:21:22 CST 2007
Update: Sorry to post again I had to take out the direct quote from MSDN
for copyright reasons. I had to post the second patch again too so that
it applies cleanly but it has no change.
This patch implements a conformance test for the CCS_NORESIZE style
which is currently unimplemented in wine for rebar.
Changelog:
* comctl32: rebar: New conformance test for CCS_NORESIZE style.
-------------- next part --------------
From 57a7a759b4d95a47cdece50bb1eff6012a937782 Mon Sep 17 00:00:00 2001
From: Misha Koshelev <mk144210 at bcm.tmc.edu>
Date: Sat, 17 Feb 2007 00:17:34 -0600
Subject: comctl32: rebar: New conformance test for CCS_NORESIZE style.
---
dlls/comctl32/tests/rebar.c | 61 +++++++++++++++++++++++++++++++++++++++++--
1 files changed, 58 insertions(+), 3 deletions(-)
diff --git a/dlls/comctl32/tests/rebar.c b/dlls/comctl32/tests/rebar.c
index 23497ef..1613396 100644
--- a/dlls/comctl32/tests/rebar.c
+++ b/dlls/comctl32/tests/rebar.c
@@ -31,12 +31,12 @@ static HWND hRebar;
#define expect_eq(expr, value, type, format) { type ret = expr; ok((value) == ret, #expr " expected " format " got " format "\n", (value), (ret)); }
-static void rebuild_rebar(HWND *hRebar)
+static void rebuild_rebar(HWND *hRebar, DWORD dwStyle)
{
if (*hRebar)
DestroyWindow(*hRebar);
- *hRebar = CreateWindow(REBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0,
+ *hRebar = CreateWindow(REBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | dwStyle, 0, 0, 0, 0,
hMainWnd, (HMENU)17, GetModuleHandle(NULL), NULL);
SendMessageA(*hRebar, WM_SETFONT, (WPARAM)GetStockObject(SYSTEM_FONT), 0);
}
@@ -89,7 +89,7 @@ static void bandinfo_test()
CHAR szABC[] = "ABC";
CHAR szABCD[] = "ABCD";
- rebuild_rebar(&hRebar);
+ rebuild_rebar(&hRebar, 0);
rb.cbSize = sizeof(REBARBANDINFO);
rb.fMask = 0;
ok(SendMessageA(hRebar, RB_INSERTBANDA, 0, (LPARAM)&rb), "RB_INSERTBAND failed\n");
@@ -137,6 +137,60 @@ static void bandinfo_test()
DestroyWindow(hRebar);
}
+/* MSDN 672579 (paraphrased): CCS_NORESIZE makes the rebar use the width and height that is requested rather
+ * than calculating its own. This test checks that this occurs for both creation and sizing dimensions. */
+#define REBAR_RESIZE_BY 20
+static void ccs_noresize_test()
+{
+ REBARBANDINFOA rb;
+ RECT rectBeforeResize, rectAfterResize;
+ CHAR szABC[] = "ABC";
+
+ rebuild_rebar(&hRebar, CCS_NORESIZE);
+
+ /* Verify creation coordinates match (0,0,0,0) */
+ ok(GetWindowRect(hRebar, &rectBeforeResize), "GetWindowRect failed %d\n", GetLastError());
+ ok(ScreenToClient(hMainWnd, (LPPOINT)&rectBeforeResize), "ScreenToClient failed\n");
+ ok(ScreenToClient(hMainWnd, (LPPOINT)&rectBeforeResize.right), "ScreenToClient failed\n");
+ todo_wine ok(rectBeforeResize.left == 0 &&
+ rectBeforeResize.top == 0 &&
+ rectBeforeResize.right == 0 &&
+ rectBeforeResize.bottom == 0,
+ "Rebar position should be (0,0)-(0,0) not (%d,%d)-(%d,%d)\n",
+ rectBeforeResize.left, rectBeforeResize.top, rectBeforeResize.right, rectBeforeResize.bottom);
+
+ /* Resize rebar, insert a text band */
+ ok(MoveWindow(hRebar, 0, 0, 200, 200, TRUE), "MoveWindow failed %d\n", GetLastError());
+ rb.cbSize = sizeof(REBARBANDINFO);
+ rb.fMask = RBBIM_TEXT;
+ rb.lpText = szABC;
+ ok(SendMessageA(hRebar, RB_INSERTBANDA, -1, (LPARAM)&rb), "RB_INSERTBAND failed\n");
+
+ /* Get window rectangle of our created rebar in screen coordinates and convert to parent window
+ * client area coordinates for MoveWindow */
+ ok(GetWindowRect(hRebar, &rectBeforeResize), "GetWindowRect failed %d\n", GetLastError());
+ ok(ScreenToClient(hMainWnd, (LPPOINT)&rectBeforeResize), "ScreenToClient failed\n");
+ ok(ScreenToClient(hMainWnd, (LPPOINT)&rectBeforeResize.right), "ScreenToClient failed\n");
+
+ /* Resize rebar to specified size. With CCS_NORESIZE flag set, should be that exact size after resize. */
+ rectBeforeResize.right += REBAR_RESIZE_BY;
+ rectBeforeResize.bottom += REBAR_RESIZE_BY;
+ ok(MoveWindow(hRebar, rectBeforeResize.left, rectBeforeResize.top,
+ rectBeforeResize.right-rectBeforeResize.left,
+ rectBeforeResize.bottom-rectBeforeResize.top, TRUE), "MoveWindow failed %d\n", GetLastError());
+
+ /* Get the new window rectangle of our rebar in screen coordinates and convert to parent window client
+ * area coordinates for comparison */
+ ok(GetWindowRect(hRebar, &rectAfterResize), "GetClientRect failed %d\n", GetLastError());
+ ok(ScreenToClient(hMainWnd, (LPPOINT)&rectAfterResize), "ScreenToClient failed\n");
+ ok(ScreenToClient(hMainWnd, (LPPOINT)&rectAfterResize.right), "ScreenToClient failed\n");
+
+ /* Rebar should be exactly the same size as we requested */
+ todo_wine ok(EqualRect(&rectBeforeResize, &rectAfterResize), "Rebar position should be (%d,%d)-(%d,%d) not (%d,%d)-(%d,%d)\n", rectBeforeResize.left, rectBeforeResize.top, rectBeforeResize.right, rectBeforeResize.bottom, rectAfterResize.left, rectAfterResize.top, rectAfterResize.right, rectAfterResize.bottom);
+
+ DestroyWindow(hRebar);
+}
+
START_TEST(rebar)
{
INITCOMMONCONTROLSEX icc;
@@ -166,6 +220,7 @@ START_TEST(rebar)
ShowWindow(hMainWnd, SW_SHOW);
bandinfo_test();
+ ccs_noresize_test();
PostQuitMessage(0);
while(GetMessageA(&msg,0,0,0)) {
TranslateMessage(&msg);
--
1.4.1
More information about the wine-patches
mailing list