Module: wine Branch: master Commit: 89e9d6db33d6745ed86cb3112bae47c2b87aeaf2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=89e9d6db33d6745ed86cb3112b...
Author: Michael Stefaniuc mstefani@redhat.de Date: Tue Oct 7 01:01:56 2014 +0200
comctl32/tests: Add some ImageList_BeginDrag() tests.
---
dlls/comctl32/tests/imagelist.c | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index 5085c70..921a16a 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -253,6 +253,50 @@ static void check_bits(HWND hwnd, HIMAGELIST himl, int idx, int size, #endif /* VISIBLE */ }
+static void test_begindrag(void) +{ + HIMAGELIST himl = createImageList(7,13); + HIMAGELIST drag; + BOOL ret; + int count; + POINT hotspot; + + count = ImageList_GetImageCount(himl); + ok(count > 2, "Tests need an ImageList with more than 2 images\n"); + + /* Two BeginDrag() without EndDrag() in between */ + ret = ImageList_BeginDrag(himl, 1, 0, 0); + drag = ImageList_GetDragImage(NULL, NULL); + ok(ret && drag, "ImageList_BeginDrag() failed\n"); + ret = ImageList_BeginDrag(himl, 0, 3, 5); + ok(!ret, "ImageList_BeginDrag() returned TRUE\n"); + drag = ImageList_GetDragImage(NULL, &hotspot); + ok(!!drag, "No active ImageList drag left\n"); + ok(hotspot.x == 0 && hotspot.y == 0, "New ImageList drag was created\n"); + ImageList_EndDrag(); + drag = ImageList_GetDragImage(NULL, NULL); + ok(!drag, "ImageList drag was not destroyed\n"); + + /* Invalid image index */ + ImageList_BeginDrag(himl, 0, 0, 0); + ret = ImageList_BeginDrag(himl, count, 3, 5); + ok(!ret, "ImageList_BeginDrag() returned TRUE\n"); + drag = ImageList_GetDragImage(NULL, &hotspot); + ok(drag && hotspot.x == 0 && hotspot.y == 0, "Active drag should not have been canceled\n"); + ImageList_EndDrag(); + drag = ImageList_GetDragImage(NULL, NULL); + ok(!drag, "ImageList drag was not destroyed\n"); + /* Invalid negative image indexes succeed */ + ret = ImageList_BeginDrag(himl, -17, 0, 0); + drag = ImageList_GetDragImage(NULL, NULL); + ok(ret && drag, "ImageList drag was created\n"); + ImageList_EndDrag(); + ret = ImageList_BeginDrag(himl, -1, 0, 0); + drag = ImageList_GetDragImage(NULL, NULL); + ok(ret && drag, "ImageList drag was created\n"); + ImageList_EndDrag(); +} + static void test_hotspot(void) { struct hotspot { @@ -2087,6 +2131,7 @@ START_TEST(imagelist) InitCommonControls();
test_create_destroy(); + test_begindrag(); test_hotspot(); test_add_remove(); test_imagecount();