Alexandre Julliard : user32/tests: Add some tests for ShowCursor.
Alexandre Julliard
julliard at winehq.org
Fri Mar 19 11:16:36 CDT 2010
Module: wine
Branch: master
Commit: d2ec02e06f8cef15d996795e6de95de4ec5e8e50
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d2ec02e06f8cef15d996795e6de95de4ec5e8e50
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Mar 18 19:26:36 2010 +0100
user32/tests: Add some tests for ShowCursor.
---
dlls/user32/tests/cursoricon.c | 95 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 95 insertions(+), 0 deletions(-)
diff --git a/dlls/user32/tests/cursoricon.c b/dlls/user32/tests/cursoricon.c
index 1ebe665..ceca35d 100644
--- a/dlls/user32/tests/cursoricon.c
+++ b/dlls/user32/tests/cursoricon.c
@@ -1436,6 +1436,100 @@ static void test_SetCursor(void)
"wrong error %u\n", error );
}
+static HANDLE event_start, event_next;
+
+static DWORD CALLBACK show_cursor_thread( void *arg )
+{
+ DWORD count = (DWORD_PTR)arg;
+ int ret;
+
+ PeekMessage( 0, 0, 0, 0, PM_NOREMOVE ); /* create a msg queue */
+ if (parent_id)
+ {
+ BOOL ret = AttachThreadInput( GetCurrentThreadId(), parent_id, TRUE );
+ ok( ret, "AttachThreadInput failed\n" );
+ }
+ if (!count) ret = ShowCursor( FALSE );
+ else while (count--) ret = ShowCursor( TRUE );
+ SetEvent( event_start );
+ WaitForSingleObject( event_next, 2000 );
+ return ret;
+}
+
+static void test_ShowCursor(void)
+{
+ int count;
+ DWORD id, result;
+ HANDLE thread;
+
+ event_start = CreateEvent( NULL, FALSE, FALSE, NULL );
+ event_next = CreateEvent( NULL, FALSE, FALSE, NULL );
+
+ count = ShowCursor( TRUE );
+ ok( count == 1, "wrong count %d\n", count );
+ count = ShowCursor( TRUE );
+ ok( count == 2, "wrong count %d\n", count );
+ count = ShowCursor( FALSE );
+ ok( count == 1, "wrong count %d\n", count );
+ count = ShowCursor( FALSE );
+ ok( count == 0, "wrong count %d\n", count );
+ count = ShowCursor( FALSE );
+ ok( count == -1, "wrong count %d\n", count );
+ count = ShowCursor( FALSE );
+ ok( count == -2, "wrong count %d\n", count );
+
+ parent_id = 0;
+ thread = CreateThread( NULL, 0, show_cursor_thread, NULL, 0, &id );
+ WaitForSingleObject( event_start, 1000 );
+ count = ShowCursor( FALSE );
+ ok( count == -3, "wrong count %d\n", count );
+ SetEvent( event_next );
+ WaitForSingleObject( thread, 1000 );
+ GetExitCodeThread( thread, &result );
+ ok( result == -1, "wrong thread count %d\n", result );
+ count = ShowCursor( FALSE );
+ ok( count == -4, "wrong count %d\n", count );
+
+ thread = CreateThread( NULL, 0, show_cursor_thread, (void *)1, 0, &id );
+ WaitForSingleObject( event_start, 1000 );
+ count = ShowCursor( TRUE );
+ ok( count == -3, "wrong count %d\n", count );
+ SetEvent( event_next );
+ WaitForSingleObject( thread, 1000 );
+ GetExitCodeThread( thread, &result );
+ ok( result == 1, "wrong thread count %d\n", result );
+ count = ShowCursor( TRUE );
+ ok( count == -2, "wrong count %d\n", count );
+
+ parent_id = GetCurrentThreadId();
+ thread = CreateThread( NULL, 0, show_cursor_thread, NULL, 0, &id );
+ WaitForSingleObject( event_start, 1000 );
+ count = ShowCursor( TRUE );
+ todo_wine ok( count == -2, "wrong count %d\n", count );
+ SetEvent( event_next );
+ WaitForSingleObject( thread, 1000 );
+ GetExitCodeThread( thread, &result );
+ todo_wine ok( result == -3, "wrong thread count %d\n", result );
+ count = ShowCursor( FALSE );
+ ok( count == -2, "wrong count %d\n", count );
+
+ thread = CreateThread( NULL, 0, show_cursor_thread, (void *)3, 0, &id );
+ WaitForSingleObject( event_start, 1000 );
+ count = ShowCursor( TRUE );
+ todo_wine ok( count == 2, "wrong count %d\n", count );
+ SetEvent( event_next );
+ WaitForSingleObject( thread, 1000 );
+ GetExitCodeThread( thread, &result );
+ todo_wine ok( result == 1, "wrong thread count %d\n", result );
+ count = ShowCursor( FALSE );
+ ok( count == -2, "wrong count %d\n", count );
+
+ count = ShowCursor( TRUE );
+ ok( count == -1, "wrong count %d\n", count );
+ count = ShowCursor( TRUE );
+ ok( count == 0, "wrong count %d\n", count );
+}
+
static void test_DestroyCursor(void)
{
@@ -1548,6 +1642,7 @@ START_TEST(cursoricon)
test_DrawIconEx();
test_DrawState();
test_SetCursor();
+ test_ShowCursor();
test_DestroyCursor();
do_parent();
test_child_process();
More information about the wine-cvs
mailing list