Commit b32bccb4 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/treeview: Use a common structure for tests (as we use already for others).

parent a6694761
...@@ -238,6 +238,8 @@ static void FillRoot(void) ...@@ -238,6 +238,8 @@ static void FillRoot(void)
static CHAR root[] = "Root", static CHAR root[] = "Root",
child[] = "Child"; child[] = "Child";
flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
Clear(); Clear();
AddItem('A'); AddItem('A');
ins.hParent = TVI_ROOT; ins.hParent = TVI_ROOT;
...@@ -262,6 +264,7 @@ static void FillRoot(void) ...@@ -262,6 +264,7 @@ static void FillRoot(void)
hChild = TreeView_InsertItem(hTree, &ins); hChild = TreeView_InsertItem(hTree, &ins);
assert(hChild); assert(hChild);
AddItem('.'); AddItem('.');
ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, FillRootSeq, "FillRoot", FALSE);
ok(!strcmp(sequence, "AB."), "Item creation\n"); ok(!strcmp(sequence, "AB."), "Item creation\n");
} }
...@@ -331,6 +334,9 @@ static void TestCallback(void) ...@@ -331,6 +334,9 @@ static void TestCallback(void)
static void DoTest1(void) static void DoTest1(void)
{ {
BOOL r; BOOL r;
flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
r = TreeView_SelectItem(hTree, NULL); r = TreeView_SelectItem(hTree, NULL);
Clear(); Clear();
AddItem('1'); AddItem('1');
...@@ -345,11 +351,15 @@ static void DoTest1(void) ...@@ -345,11 +351,15 @@ static void DoTest1(void)
r = TreeView_SelectItem(hTree, hRoot); r = TreeView_SelectItem(hTree, hRoot);
AddItem('.'); AddItem('.');
ok(!strcmp(sequence, "1(nR)nR23(Rn)Rn45(nR)nR."), "root-none select test\n"); ok(!strcmp(sequence, "1(nR)nR23(Rn)Rn45(nR)nR."), "root-none select test\n");
ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, DoTest1Seq, "DoTest1", FALSE);
} }
static void DoTest2(void) static void DoTest2(void)
{ {
BOOL r; BOOL r;
flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
r = TreeView_SelectItem(hTree, NULL); r = TreeView_SelectItem(hTree, NULL);
Clear(); Clear();
AddItem('1'); AddItem('1');
...@@ -364,6 +374,7 @@ static void DoTest2(void) ...@@ -364,6 +374,7 @@ static void DoTest2(void)
r = TreeView_SelectItem(hTree, hRoot); r = TreeView_SelectItem(hTree, hRoot);
AddItem('.'); AddItem('.');
ok(!strcmp(sequence, "1(nR)nR23(RC)RC45(CR)CR."), "root-child select test\n"); ok(!strcmp(sequence, "1(nR)nR23(RC)RC45(CR)CR."), "root-child select test\n");
ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, DoTest2Seq, "DoTest2", FALSE);
} }
static void DoTest3(void) static void DoTest3(void)
...@@ -375,6 +386,8 @@ static void DoTest3(void) ...@@ -375,6 +386,8 @@ static void DoTest3(void)
int nBufferSize = 80; int nBufferSize = 80;
CHAR szBuffer[80] = "Blah"; CHAR szBuffer[80] = "Blah";
flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
/* add an item without TVIF_TEXT mask and pszText == NULL */ /* add an item without TVIF_TEXT mask and pszText == NULL */
ins.hParent = hRoot; ins.hParent = hRoot;
ins.hInsertAfter = TVI_ROOT; ins.hInsertAfter = TVI_ROOT;
...@@ -393,6 +406,7 @@ static void DoTest3(void) ...@@ -393,6 +406,7 @@ static void DoTest3(void)
SendMessageA( hTree, TVM_GETITEM, 0, (LPARAM)&tvi ); SendMessageA( hTree, TVM_GETITEM, 0, (LPARAM)&tvi );
ok(!strcmp(szBuffer, ""), "szBuffer=\"%s\", expected \"\"\n", szBuffer); ok(!strcmp(szBuffer, ""), "szBuffer=\"%s\", expected \"\"\n", szBuffer);
ok(SendMessageA(hTree, TVM_DELETEITEM, 0, (LPARAM)hChild), "DeleteItem failed\n"); ok(SendMessageA(hTree, TVM_DELETEITEM, 0, (LPARAM)hChild), "DeleteItem failed\n");
ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, DoTest3Seq, "DoTest3", FALSE);
} }
static void DoFocusTest(void) static void DoFocusTest(void)
...@@ -402,6 +416,8 @@ static void DoFocusTest(void) ...@@ -402,6 +416,8 @@ static void DoFocusTest(void)
child2[] = "A really long string"; child2[] = "A really long string";
HTREEITEM hChild1, hChild2; HTREEITEM hChild1, hChild2;
flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
/* This test verifies that when a label is being edited, scrolling /* This test verifies that when a label is being edited, scrolling
* the treeview does not cause the label to lose focus. To test * the treeview does not cause the label to lose focus. To test
* this, first some additional entries are added to generate * this, first some additional entries are added to generate
...@@ -425,6 +441,7 @@ static void DoFocusTest(void) ...@@ -425,6 +441,7 @@ static void DoFocusTest(void)
hEdit = TreeView_EditLabel(hTree, hChild); hEdit = TreeView_EditLabel(hTree, hChild);
ScrollWindowEx(hTree, -10, 0, NULL, NULL, NULL, NULL, SW_SCROLLCHILDREN); ScrollWindowEx(hTree, -10, 0, NULL, NULL, NULL, NULL, SW_SCROLLCHILDREN);
ok(GetFocus() == hEdit, "Edit control should have focus\n"); ok(GetFocus() == hEdit, "Edit control should have focus\n");
ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, DoFocusTestSeq, "DoFocusTest", TRUE);
} }
static void TestGetSetBkColor(void) static void TestGetSetBkColor(void)
...@@ -863,32 +880,14 @@ START_TEST(treeview) ...@@ -863,32 +880,14 @@ START_TEST(treeview)
if ( !ok(hMainWnd != NULL, "Failed to create parent window. Tests aborted.\n") ) if ( !ok(hMainWnd != NULL, "Failed to create parent window. Tests aborted.\n") )
return; return;
flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
FillRoot(); FillRoot();
ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, FillRootSeq, "FillRoot", FALSE);
flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
DoTest1(); DoTest1();
ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, DoTest1Seq, "DoTest1", FALSE);
flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
DoTest2(); DoTest2();
ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, DoTest2Seq, "DoTest2", FALSE);
flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
DoTest3(); DoTest3();
ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, DoTest3Seq, "DoTest3", FALSE);
flush_sequences(MsgSequences, NUM_MSG_SEQUENCES);
DoFocusTest(); DoFocusTest();
ok_sequence(MsgSequences, TREEVIEW_SEQ_INDEX, DoFocusTestSeq, "DoFocusTest", TRUE);
/* Sequences tested inside due to number */
TestGetSet(); TestGetSet();
/* Clears all the previous items */ /* Clears all the previous items */
TestCallback(); TestCallback();
/* Clears all the previous items */ /* Clears all the previous items */
TestExpandInvisible(); TestExpandInvisible();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment