user[1/5]: add SPI_{GET,SET}DESKWALLPAPER tests

Andrew Ziem ahziem1 at mailbolt.com
Sun Jul 9 21:15:50 CDT 2006


This section of tests passes on Windows 2000.  Also, the tests fail on 
Wine until the other patches in the set are applied; then, all the tests 
in the section pass.

These set of 5 patches are updated based on comments from Andrey Turkin 
after original post: 
http://www.winehq.org/pipermail/wine-patches/2006-June/027423.html


---
 dlls/user/tests/sysparams.c |   39 ++++++++++++++++++++++++++++++++++-----
 1 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/dlls/user/tests/sysparams.c b/dlls/user/tests/sysparams.c
index d5f20ce..7ab65aa 100644
--- a/dlls/user/tests/sysparams.c
+++ b/dlls/user/tests/sysparams.c
@@ -2140,8 +2140,11 @@ static void test_SPI_SETMENUSHOWDELAY( v
 static void test_SPI_SETWALLPAPER( void )              /*   115 */
 {
     BOOL rc;
+    char def1[MAX_PATH];
+    char def2[MAX_PATH];
     char oldval[260];
-    char newval[260];
+    char s[MAX_PATH];
+    char doesnotexistbmp[] = "doesnotexist.bmp";
 
     trace("testing SPI_{GET,SET}DESKWALLPAPER\n");
     SetLastError(0xdeadbeef);
@@ -2152,11 +2155,37 @@ static void test_SPI_SETWALLPAPER( void 
     if (!test_error_msg(rc,"SPI_{GET,SET}DESKWALLPAPER"))
         return;
 
-    strcpy(newval, "");
-    rc=SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, newval, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
-    ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
-    test_change_message(SPI_SETDESKWALLPAPER, 0);
+    /* remove wallpaper */
+    rc=SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, "", SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
+    ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
+    if (0==rc)
+        test_change_message(SPI_SETDESKWALLPAPER, 0);
+    else
+    {
+        SystemParametersInfoA(SPI_GETDESKWALLPAPER, MAX_PATH, s, 0);
+        ok(!strcmp("", s), "Expected empty string\n");
+    }
+
+    /* default wallpaper */
+    rc=SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, SETWALLPAPER_DEFAULT, SPIF_UPDATEINIFILE);
+    ok(0!=rc,"SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
+    SystemParametersInfoA(SPI_GETDESKWALLPAPER, MAX_PATH, def1, 0);
+
+    /* default wallpaper */
+    rc=SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, NULL, SPIF_UPDATEINIFILE);
+    ok(0!=rc,"SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
+    SystemParametersInfoA(SPI_GETDESKWALLPAPER, MAX_PATH, def2, 0);
+    ok(!strcmp(def1,def2), "Default wallpapers differ\n");
+
+    /* non-existant file */
+    rc=SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, doesnotexistbmp, SPIF_UPDATEINIFILE);
+    ok(0==rc,"SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
+    SystemParametersInfoA(SPI_GETDESKWALLPAPER, MAX_PATH, s, 0);
+    todo_wine ok(!strcmp(doesnotexistbmp, s), "Expected '%s', got '%s'\n", doesnotexistbmp, s);
+
+    /* todo: test valid wallpaper file */
 
+    /* restore old wallpaper */
     rc=SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, oldval, SPIF_UPDATEINIFILE);
     ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
 
-- 
1.4.0




More information about the wine-patches mailing list