msxml3/tests: Really test load() on files with leading spaces

Nikolay Sivov nsivov at codeweavers.com
Wed May 9 11:33:05 CDT 2012


Test doesn't work currently, load() takes path as BSTR argument.
-------------- next part --------------
>From e4296adea1d8ca518765bb4b1f4c5c73da22641c Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Wed, 9 May 2012 20:30:58 +0400
Subject: [PATCH 2/2] Really test load() on files with leading spaces

---
 dlls/msxml3/tests/domdoc.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 09165c3..2aa2906 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -2061,8 +2061,12 @@ static void test_domdoc( void )
     LONG code, ref;
     LONG nLength = 0;
     WCHAR buff[100];
+    char path[MAX_PATH];
     int index;
 
+    GetTempPathA(MAX_PATH, path);
+    strcat(path, "leading_spaces.xml");
+
     /* Load document with leading spaces
      *
      * Test all CLSIDs with all test data XML strings
@@ -2087,13 +2091,24 @@ static void test_domdoc( void )
         i = 0;
         while (*data_ptr) {
             BSTR data = _bstr_(*data_ptr);
+            DWORD written;
+            HANDLE file;
+
+            file = CreateFileA(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
+            ok(file != INVALID_HANDLE_VALUE, "can't create file %s: %u\n", path, GetLastError());
+
+            WriteFile(file, data, lstrlenW(data)*sizeof(WCHAR), &written, NULL);
+            CloseHandle(file);
 
             b = 0xc;
             V_VT(&var) = VT_BSTR;
-            V_BSTR(&var) = data;
+            V_BSTR(&var) = _bstr_(path);
             hr = IXMLDOMDocument_load(doc, var, &b);
+        todo_wine {
             EXPECT_HR(hr, class_ptr->ret[0].hr);
             ok(b == class_ptr->ret[0].b, "%d:%d, got %d, expected %d\n", index, i, b, class_ptr->ret[0].b);
+        }
+            DeleteFileA(path);
 
             b = 0xc;
             hr = IXMLDOMDocument_loadXML(doc, data, &b);
@@ -2103,8 +2118,10 @@ static void test_domdoc( void )
             data_ptr++;
             i++;
         }
+
         class_ptr++;
         index++;
+        free_bstrs();
     }
 
     doc = create_document(&IID_IXMLDOMDocument);
-- 
1.5.6.5



More information about the wine-patches mailing list