Nikolay Sivov : comctl32/tests: Simplify static text data initialization.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Apr 18 10:37:02 CDT 2016


Module: wine
Branch: master
Commit: b7f1839583b33397a0fbcd3784968087c4ab776f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b7f1839583b33397a0fbcd3784968087c4ab776f

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sat Apr 16 11:36:09 2016 +0300

comctl32/tests: Simplify static text data initialization.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comctl32/tests/header.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/dlls/comctl32/tests/header.c b/dlls/comctl32/tests/header.c
index 8245711..43fd175 100644
--- a/dlls/comctl32/tests/header.c
+++ b/dlls/comctl32/tests/header.c
@@ -1080,15 +1080,13 @@ static void test_hdm_index_messages(HWND hParent)
     HWND hChild;
     int retVal, i, iSize;
     static const int lpiarray[2] = {1, 0};
-    static int lpiarrayReceived[2];
-    static char firstHeaderItem[] = "Name";
-    static char secondHeaderItem[] = "Size";
-    static char thirdHeaderItem[] = "Type";
-    static char fourthHeaderItem[] = "Date Modified";
-    static char *items[] = {firstHeaderItem, secondHeaderItem, thirdHeaderItem, fourthHeaderItem};
+    static const char *item_texts[] = {
+        "Name", "Size", "Type", "Date Modified"
+    };
     RECT rect;
     HDITEMA hdItem;
     char buffA[32];
+    int array[2];
 
     flush_sequences(sequences, NUM_MSG_SEQUENCES);
     hChild = create_custom_header_control(hParent, FALSE);
@@ -1099,10 +1097,10 @@ static void test_hdm_index_messages(HWND hParent)
          ok_sequence(sequences, PARENT_SEQ_INDEX, add_header_to_parent_seq,
                                      "adder header control to parent", FALSE);
     flush_sequences(sequences, NUM_MSG_SEQUENCES);
-    for (i = 0; i < sizeof(items)/sizeof(items[0]); i++)
+    for (i = 0; i < sizeof(item_texts)/sizeof(item_texts[0]); i++)
     {
         hdItem.mask = HDI_TEXT | HDI_WIDTH | HDI_FORMAT;
-        hdItem.pszText = items[i];
+        hdItem.pszText = (char*)item_texts[i];
         hdItem.fmt = HDF_LEFT;
         hdItem.cxy = 80;
 
@@ -1146,8 +1144,8 @@ static void test_hdm_index_messages(HWND hParent)
     ok_sequence(sequences, HEADER_SEQ_INDEX, getItem_seq, "getItem sequence testing", FALSE);
 
     /* check if the item is the right one */
-    ok(!strcmp(hdItem.pszText, firstHeaderItem), "got wrong item %s, expected %s\n",
-        hdItem.pszText, firstHeaderItem);
+    ok(!strcmp(hdItem.pszText, item_texts[0]), "got wrong item %s, expected %s\n",
+        hdItem.pszText, item_texts[0]);
     expect(80, hdItem.cxy);
 
     iSize = SendMessageA(hChild, HDM_GETITEMCOUNT, 0, 0);
@@ -1166,15 +1164,15 @@ static void test_hdm_index_messages(HWND hParent)
     retVal = SendMessageA(hChild, HDM_SETORDERARRAY, iSize, (LPARAM) lpiarray);
     ok(retVal == TRUE, "Setting header items order should return TRUE, got %d\n", retVal);
 
-    retVal = SendMessageA(hChild, HDM_GETORDERARRAY, iSize, (LPARAM) lpiarrayReceived);
+    retVal = SendMessageA(hChild, HDM_GETORDERARRAY, 2, (LPARAM) array);
     ok(retVal == TRUE, "Getting header items order should return TRUE, got %d\n", retVal);
 
     ok_sequence(sequences, HEADER_SEQ_INDEX, orderArray_seq, "set_get_orderArray sequence testing", FALSE);
 
     /* check if the array order is set correctly and the size of the array is correct. */
     expect(2, iSize);
-    expect(lpiarray[0], lpiarrayReceived[0]);
-    expect(lpiarray[1], lpiarrayReceived[1]);
+    ok(lpiarray[0] == array[0], "got %d, expected %d\n", array[0], lpiarray[0]);
+    ok(lpiarray[1] == array[1], "got %d, expected %d\n", array[1], lpiarray[1]);
 
     hdItem.mask = HDI_FORMAT;
     hdItem.fmt = HDF_CENTER | HDF_STRING;




More information about the wine-cvs mailing list