Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
59f64b28
Commit
59f64b28
authored
Mar 15, 2011
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 16, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Merge save() tests to a single function.
parent
1adbe826
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
66 deletions
+37
-66
domdoc.c
dlls/msxml3/tests/domdoc.c
+37
-66
No files found.
dlls/msxml3/tests/domdoc.c
View file @
59f64b28
...
...
@@ -5629,10 +5629,15 @@ static void test_nodeTypeTests( void )
free_bstrs
();
}
static
void
test_
DocumentSaveToDocument
(
void
)
static
void
test_
save
(
void
)
{
IXMLDOMDocument
*
doc
,
*
doc2
;
IXMLDOMElement
*
pRoot
;
IXMLDOMElement
*
root
;
VARIANT
file
,
vDoc
;
BSTR
sOrig
,
sNew
;
char
buffer
[
100
];
DWORD
read
=
0
;
HANDLE
hfile
;
HRESULT
hr
;
doc
=
create_document
(
&
IID_IXMLDOMDocument
);
...
...
@@ -5645,86 +5650,53 @@ static void test_DocumentSaveToDocument(void)
return
;
}
hr
=
IXMLDOMDocument_createElement
(
doc
,
_bstr_
(
"Testing"
),
&
pRoot
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
hr
=
IXMLDOMDocument_appendChild
(
doc
,
(
IXMLDOMNode
*
)
pRoot
,
NULL
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
VARIANT
vDoc
;
BSTR
sOrig
;
BSTR
sNew
;
V_VT
(
&
vDoc
)
=
VT_UNKNOWN
;
V_UNKNOWN
(
&
vDoc
)
=
(
IUnknown
*
)
doc2
;
hr
=
IXMLDOMDocument_save
(
doc
,
vDoc
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
/* save to IXMLDOMDocument */
hr
=
IXMLDOMDocument_createElement
(
doc
,
_bstr_
(
"Testing"
),
&
root
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IXMLDOMDocument_get_xml
(
doc
,
&
sOrig
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMDocument_appendChild
(
doc
,
(
IXMLDOMNode
*
)
root
,
NULL
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IXMLDOMDocument_get_xml
(
doc2
,
&
sNew
)
;
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
)
;
V_VT
(
&
vDoc
)
=
VT_UNKNOWN
;
V_UNKNOWN
(
&
vDoc
)
=
(
IUnknown
*
)
doc2
;
ok
(
!
lstrcmpW
(
sOrig
,
sNew
),
"New document is not the same as origial
\n
"
);
hr
=
IXMLDOMDocument_save
(
doc
,
vDoc
);
EXPECT_HR
(
hr
,
S_OK
);
SysFreeString
(
sOrig
);
SysFreeString
(
sNew
);
}
IXMLDOMElement_Release
(
pRoot
);
}
hr
=
IXMLDOMDocument_get_xml
(
doc
,
&
sOrig
);
EXPECT_HR
(
hr
,
S_OK
);
IXMLDOMDocument_Release
(
doc2
);
IXMLDOMDocument_Release
(
doc
);
}
hr
=
IXMLDOMDocument_get_xml
(
doc2
,
&
sNew
);
EXPECT_HR
(
hr
,
S_OK
);
static
void
test_DocumentSaveToFile
(
void
)
{
IXMLDOMDocument
*
doc
;
IXMLDOMElement
*
pRoot
;
HANDLE
file
;
char
buffer
[
100
];
DWORD
read
=
0
;
HRESULT
hr
;
ok
(
!
lstrcmpW
(
sOrig
,
sNew
),
"New document is not the same as origial
\n
"
);
doc
=
create_document
(
&
IID_IXMLDOMDocument
);
if
(
!
doc
)
return
;
SysFreeString
(
sOrig
);
SysFreeString
(
sNew
)
;
hr
=
IXMLDOMDocument_createElement
(
doc
,
_bstr_
(
"Testing"
),
&
pRoot
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
hr
=
IXMLDOMDocument_appendChild
(
doc
,
(
IXMLDOMNode
*
)
pRoot
,
NULL
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
VARIANT
vFile
;
IXMLDOMElement_Release
(
root
);
IXMLDOMDocument_Release
(
doc2
);
V_VT
(
&
vFile
)
=
VT_BSTR
;
V_BSTR
(
&
vFile
)
=
_bstr_
(
"test.xml"
);
/* save to path */
V_VT
(
&
file
)
=
VT_BSTR
;
V_BSTR
(
&
file
)
=
_bstr_
(
"test.xml"
);
hr
=
IXMLDOMDocument_save
(
doc
,
vFile
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
}
}
hr
=
IXMLDOMDocument_save
(
doc
,
file
);
EXPECT_HR
(
hr
,
S_OK
);
IXMLDOMElement_Release
(
pRoot
);
IXMLDOMDocument_Release
(
doc
);
file
=
CreateFile
(
"test.xml"
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"Could not open file: %u
\n
"
,
GetLastError
());
if
(
file
==
INVALID_HANDLE_VALUE
)
return
;
hfile
=
CreateFile
(
"test.xml"
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
hfile
!=
INVALID_HANDLE_VALUE
,
"Could not open file: %u
\n
"
,
GetLastError
());
if
(
hfile
==
INVALID_HANDLE_VALUE
)
return
;
ReadFile
(
file
,
buffer
,
sizeof
(
buffer
),
&
read
,
NULL
);
ReadFile
(
h
file
,
buffer
,
sizeof
(
buffer
),
&
read
,
NULL
);
ok
(
read
!=
0
,
"could not read file
\n
"
);
ok
(
buffer
[
0
]
!=
'<'
||
buffer
[
1
]
!=
'?'
,
"File contains processing instruction
\n
"
);
CloseHandle
(
file
);
CloseHandle
(
h
file
);
DeleteFile
(
"test.xml"
);
free_bstrs
();
}
static
void
test_testTransforms
(
void
)
...
...
@@ -8678,8 +8650,7 @@ START_TEST(domdoc)
test_cloneNode
();
test_xmlTypes
();
test_nodeTypeTests
();
test_DocumentSaveToDocument
();
test_DocumentSaveToFile
();
test_save
();
test_testTransforms
();
test_Namespaces
();
test_FormattingXML
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment