comctl32: rebar: New conformance test for cxMinChild and cyMinChild. [PATCH 1/2]

Misha Koshelev mk144210 at bcm.tmc.edu
Sat Feb 17 19:03:31 CST 2007


This is a new conformance test to make sure rebar respects cyMinChild
and cxMinChild (which it currently doesn't, and bug #7464 depends on
this). Currently this applies cleanly after the last rebar patches I
posted for bug #1115 are applied. Even though I see rebar is being
rewritten as we speak, and so the fix patches will probably have to
undergo some changes, I strongly believe the conformance tests will need
to be included so these bugs do not resurface.

Misha
-------------- next part --------------
From c7ea0677097d996a2ad7517fd8191e807ce0ca15 Mon Sep 17 00:00:00 2001
From: Misha Koshelev <mk144210 at bcm.tmc.edu>
Date: Sat, 17 Feb 2007 18:46:00 -0600
Subject: comctl32: rebar: New conformance test for cxMinChild and cyMinChild.
---
 dlls/comctl32/tests/rebar.c |   53 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/dlls/comctl32/tests/rebar.c b/dlls/comctl32/tests/rebar.c
index e4142bb..83a2fe3 100644
--- a/dlls/comctl32/tests/rebar.c
+++ b/dlls/comctl32/tests/rebar.c
@@ -191,6 +191,56 @@ static void ccs_noresize_test()
     DestroyWindow(hRebar);
 }
 
+/* Make sure minimum child size is taken into account for RBBIM_CHILDSIZE flag. 
+ * Need to pass dwRebarStyle to make sure both CCS_VERT and non-CCS_VERT rebars 
+ * respect the minimum child size. */
+#define CHILD_SIZE 20
+static void minchild_test(DWORD dwRebarStyle)
+{
+    REBARBANDINFOA rb;
+    HWND hwndChild;
+    RECT rectBand;
+    UINT cx, cy;
+
+    rebuild_rebar(&hRebar, dwRebarStyle);
+
+    /* Create a combo box (any child would do) of a certain size */
+    hwndChild = CreateWindow("COMBOBOX", "", CBS_DROPDOWN | WS_CHILD | WS_VISIBLE,
+			     0, 0, CHILD_SIZE, CHILD_SIZE, hMainWnd, NULL, GetModuleHandle(NULL), NULL);
+    ok(hwndChild != NULL, "CreateWindow failed %d\n", GetLastError());
+			
+    /* Add it to the rebar, specifying the minimum X and Y sizes and default size */
+    rb.cbSize = sizeof(REBARBANDINFO);
+    rb.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE;
+    rb.hwndChild = hwndChild;
+    rb.cxMinChild = rb.cyMinChild = CHILD_SIZE;
+    rb.cx = CHILD_SIZE;
+    ok(SendMessageA(hRebar, RB_INSERTBANDA, -1, (LPARAM)&rb), "RB_INSERTBAND failed\n");
+
+    /* Now shrink the rebar to be smaller than the minimums */
+    MoveWindow(hRebar, 0, 0, CHILD_SIZE-1, CHILD_SIZE-1, TRUE);
+
+    /* Get the band rectangle */ 
+    ok(SendMessage(hRebar, RB_GETRECT, 0, (LPARAM)&rectBand), "RB_GETRECT failed\n");
+    if (dwRebarStyle & CCS_VERT) {
+	cx = rectBand.bottom-rectBand.top;
+	cy = rectBand.right-rectBand.left;   
+    } else {
+	cx = rectBand.right-rectBand.left;
+	cy = rectBand.bottom-rectBand.top;
+    }
+    
+    /* make sure rebar respects the minimums we passed */
+    todo_wine ok(cx >= CHILD_SIZE, "Band cx expected to be >= %d but was %d, CCS_VERT%s set\n", 
+       CHILD_SIZE, cx, (dwRebarStyle & CCS_VERT ? "" : " not"));
+    todo_wine ok(cy >= CHILD_SIZE, "Band cy expected to be >= %d but was %d, CCS_VERT%s set\n", 
+       CHILD_SIZE, cy, (dwRebarStyle & CCS_VERT ? "" : " not"));       
+
+    DestroyWindow(hRebar);    
+    /* According to MSDN, hwndCombo will be destroyed by hRebar already here */
+    ok(!DestroyWindow(hwndChild), "DestroyWindow did not fail as expected\n");
+}
+
 START_TEST(rebar)
 {
     INITCOMMONCONTROLSEX icc;
@@ -221,6 +271,9 @@ START_TEST(rebar)
 
     bandinfo_test();
     ccs_noresize_test();
+    minchild_test(0);
+    minchild_test(CCS_VERT);
+
     PostQuitMessage(0);
     while(GetMessageA(&msg,0,0,0)) {
         TranslateMessage(&msg);
-- 
1.4.1



More information about the wine-patches mailing list