[user32_apitests]
authorGiannis Adamopoulos <gadamopoulos@reactos.org>
Wed, 31 Oct 2012 15:23:11 +0000 (15:23 +0000)
committerGiannis Adamopoulos <gadamopoulos@reactos.org>
Wed, 31 Oct 2012 15:23:11 +0000 (15:23 +0000)
- Add some tests for OpenInputDesktop

svn path=/trunk/; revision=57658

rostests/apitests/user32/desktop.c

index b0d33bc..a03ff44 100644 (file)
@@ -132,6 +132,33 @@ void Test_InitialDesktop(char *argv0)
     test_CreateProcessWithDesktop(8, argv0, "NonExistantWinsta\\NonExistantDesktop", 0);
 }
 
+void Test_OpenInputDesktop()
+{
+    HDESK hDeskInput ,hDeskInput2;
+    HDESK hDeskInitial;
+    BOOL ret;
+
+    hDeskInput = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
+    ok(hDeskInput != NULL, "OpenInputDesktop failed\n");
+    hDeskInitial = GetThreadDesktop( GetCurrentThreadId() );
+    ok(hDeskInitial != NULL, "GetThreadDesktop failed\n");
+    ok(hDeskInput != hDeskInitial, "OpenInputDesktop returned thread desktop\n");
+
+    hDeskInput2 = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
+    ok(hDeskInput2 != NULL, "Second call to OpenInputDesktop failed\n");
+    ok(hDeskInput2 != hDeskInput, "Second call to OpenInputDesktop returned same handle\n"); 
+
+    ok(CloseDesktop(hDeskInput2) != 0, "CloseDesktop failed\n");
+
+    ret = SetThreadDesktop(hDeskInput);
+    ok(ret == TRUE, "SetThreadDesktop for input desktop failed\n");
+
+    ret = SetThreadDesktop(hDeskInitial);
+    ok(ret == TRUE, "SetThreadDesktop for initial desktop failed\n");
+
+    ok(CloseDesktop(hDeskInput) != 0, "CloseDesktop failed\n");
+}
+
 START_TEST(desktop)
 {
     char **test_argv;
@@ -151,4 +178,5 @@ START_TEST(desktop)
     }
        
     Test_InitialDesktop(test_argv[0]);
+    Test_OpenInputDesktop();    
 }