MSHMTL: Added QueryStatus implementation

Saulius Krasuckas saulius2 at ar.fi.lt
Sun Aug 14 05:10:12 CDT 2005


* On Tue, 2 Aug 2005, Jacek Caban wrote:
> 
> --- dlls/mshtml/tests/htmldoc.c 26 Jul 2005 10:31:23 -0000      1.5
> +++ dlls/mshtml/tests/htmldoc.c 1 Aug 2005 22:33:37 -0000
> @@ -806,12 +806,76 @@ static void test_Persist()
>      }
>  }
>  
> +static OLECMDF expect_cmds[OLECMDID_GETPRINTTEMPLATE+1] = {
> +    0,
> +    OLECMDF_SUPPORTED,                  /* OLECMDID_OPEN */
> +    OLECMDF_SUPPORTED,                  /* OLECMDID_NEW */
> +    OLECMDF_SUPPORTED,                  /* OLECMDID_SAVE */
  ...
> +        OLECMD cmd[2] = {
> +            {OLECMDID_OPEN, 0xf0f0},
> +            {OLECMDID_GETPRINTTEMPLATE+1, 0xf0f0}
> +        };
> +    
> +        hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 0, NULL, NULL);
> +        ok(hres == S_OK, "QueryStatus failed: %08lx\n", hres);
> +    
> +        hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 2, cmd, NULL);
> +        ok(hres == OLECMDERR_E_NOTSUPPORTED,
> +                "QueryStatus failed: %08lx, expected OLECMDERR_E_NOTSUPPORTED\n", hres);

Jacek, OLECMDID_OPEN (equally as OLECMDID_NEW) isn't supported here on 
winME, AFAICT.  Moreover, calls to IOleCommandTarget_QueryStatus throws an 
exception of Accesss Violation here.  I tested this with OLECMDID_SAVE and 
it works OK.

And we have a typo next, right?

> +        ok(cmd[1].cmdf == 0, "cmd[0].cmdf=%lx, expected 0\n", cmd[0].cmdf);
> +        ok(cmd[0].cmdf == OLECMDF_SUPPORTED,
> +                "cmd[1].cmdf=%lx, expected OLECMDF_SUPPORTED\n", cmd[1].cmdf);

Hence, there goes my try:

Log message:
        Saulius Krasuckas <saulius.krasuckas at ieee.org>
	Fix typo in a two checks.  WinME fixes:
        - OLECMDID_OPEN and OLECMDID_NEW aren't supported.
	- Ignore unsupported OLECMDs as they throws exceptions.


Index: dlls/mshtml/tests/htmldoc.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/tests/htmldoc.c,v
retrieving revision 1.7
diff -p -u -r1.7 htmldoc.c
--- dlls/mshtml/tests/htmldoc.c 3 Aug 2005 21:26:40 -0000       1.7
+++ dlls/mshtml/tests/htmldoc.c 13 Aug 2005 16:09:15 -0000
@@ -808,8 +808,8 @@ static void test_Persist()
 
 static const OLECMDF expect_cmds[OLECMDID_GETPRINTTEMPLATE+1] = {
     0,
-    OLECMDF_SUPPORTED,                  /* OLECMDID_OPEN */
-    OLECMDF_SUPPORTED,                  /* OLECMDID_NEW */
+    0,                                  /* OLECMDID_OPEN */
+    0,                                  /* OLECMDID_NEW */
     OLECMDF_SUPPORTED,                  /* OLECMDID_SAVE */
     OLECMDF_SUPPORTED|OLECMDF_ENABLED,  /* OLECMDID_SAVEAS */
     OLECMDF_SUPPORTED,                  /* OLECMDID_SAVECOPYAS */
@@ -842,7 +842,7 @@ static const OLECMDF expect_cmds[OLECMDI
     OLECMDF_SUPPORTED,                  /* OLECMDID_SHOWPAGESETUP */
     OLECMDF_SUPPORTED,                  /* OLECMDID_SHOWPRINT */
     0,0,
-    OLECMDF_SUPPORTED,                  /* OLECMDID_CLOSE */
+    OLECMDF_SUPPORTED,                  /* OLECMDID_DONTDOWNLOADCSS */
     0,0,0,
     OLECMDF_SUPPORTED,                  /* OLECMDID_SETPRINTTEMPLATE */
     OLECMDF_SUPPORTED                   /* OLECMDID_GETPRINTTEMPLATE */
@@ -854,7 +854,10 @@ static void test_OleCommandTarget(IOleCo
     int i;
     HRESULT hres;
 
+    ZeroMemory(cmds, sizeof(cmds));
+
     for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
+        if(!expect_cmds[i+1]) continue;
         cmds[i].cmdID = i+1;
         cmds[i].cmdf = 0xf0f0;
     }
@@ -863,6 +866,7 @@ static void test_OleCommandTarget(IOleCo
     ok(hres == S_OK, "QueryStatus failed: %08lx\n", hres);
 
     for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
+        if(!expect_cmds[i+1]) continue;
         ok(cmds[i].cmdID == i+1, "cmds[%d].cmdID canged to %lx\n", i, cmds[i].cmdID);
         ok(cmds[i].cmdf == expect_cmds[i+1], "cmds[%d].cmdf=%lx, expected %x\n",
                 i+1, cmds[i].cmdf, expect_cmds[i+1]);
@@ -961,7 +965,7 @@ static void test_HTMLDocument(void)
         int i;
     
         OLECMD cmd[2] = {
-            {OLECMDID_OPEN, 0xf0f0},
+            {OLECMDID_SAVE, 0xf0f0},
             {OLECMDID_GETPRINTTEMPLATE+1, 0xf0f0}
         };
     
@@ -973,9 +977,9 @@ static void test_HTMLDocument(void)
                 "QueryStatus failed: %08lx, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
         ok(cmd[1].cmdID == OLECMDID_GETPRINTTEMPLATE+1,
                 "cmd[0].cmdID=%ld, expected OLECMDID_GETPRINTTEMPLATE+1\n", cmd[0].cmdID);
-        ok(cmd[1].cmdf == 0, "cmd[0].cmdf=%lx, expected 0\n", cmd[0].cmdf);
+        ok(cmd[1].cmdf == 0, "cmd[1].cmdf=%lx, expected 0\n", cmd[1].cmdf);
         ok(cmd[0].cmdf == OLECMDF_SUPPORTED,
-                "cmd[1].cmdf=%lx, expected OLECMDF_SUPPORTED\n", cmd[1].cmdf);
+                "cmd[0].cmdf=%lx, expected OLECMDF_SUPPORTED\n", cmd[0].cmdf);
 
         hres = IOleCommandTarget_QueryStatus(cmdtrg, &IID_IHTMLDocument2, 2, cmd, NULL);
         ok(hres == OLECMDERR_E_UNKNOWNGROUP,



More information about the wine-devel mailing list