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
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
58 deletions
+29
-58
domdoc.c
dlls/msxml3/tests/domdoc.c
+29
-58
No files found.
dlls/msxml3/tests/domdoc.c
View file @
59f64b28
...
@@ -5629,10 +5629,15 @@ static void test_nodeTypeTests( void )
...
@@ -5629,10 +5629,15 @@ static void test_nodeTypeTests( void )
free_bstrs
();
free_bstrs
();
}
}
static
void
test_
DocumentSaveToDocument
(
void
)
static
void
test_
save
(
void
)
{
{
IXMLDOMDocument
*
doc
,
*
doc2
;
IXMLDOMDocument
*
doc
,
*
doc2
;
IXMLDOMElement
*
pRoot
;
IXMLDOMElement
*
root
;
VARIANT
file
,
vDoc
;
BSTR
sOrig
,
sNew
;
char
buffer
[
100
];
DWORD
read
=
0
;
HANDLE
hfile
;
HRESULT
hr
;
HRESULT
hr
;
doc
=
create_document
(
&
IID_IXMLDOMDocument
);
doc
=
create_document
(
&
IID_IXMLDOMDocument
);
...
@@ -5645,86 +5650,53 @@ static void test_DocumentSaveToDocument(void)
...
@@ -5645,86 +5650,53 @@ static void test_DocumentSaveToDocument(void)
return
;
return
;
}
}
hr
=
IXMLDOMDocument_createElement
(
doc
,
_bstr_
(
"Testing"
),
&
pRoot
);
/* save to IXMLDOMDocument */
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMDocument_createElement
(
doc
,
_bstr_
(
"Testing"
),
&
root
);
if
(
hr
==
S_OK
)
EXPECT_HR
(
hr
,
S_OK
);
{
hr
=
IXMLDOMDocument_appendChild
(
doc
,
(
IXMLDOMNode
*
)
pRoot
,
NULL
);
hr
=
IXMLDOMDocument_appendChild
(
doc
,
(
IXMLDOMNode
*
)
root
,
NULL
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
EXPECT_HR
(
hr
,
S_OK
);
if
(
hr
==
S_OK
)
{
VARIANT
vDoc
;
BSTR
sOrig
;
BSTR
sNew
;
V_VT
(
&
vDoc
)
=
VT_UNKNOWN
;
V_VT
(
&
vDoc
)
=
VT_UNKNOWN
;
V_UNKNOWN
(
&
vDoc
)
=
(
IUnknown
*
)
doc2
;
V_UNKNOWN
(
&
vDoc
)
=
(
IUnknown
*
)
doc2
;
hr
=
IXMLDOMDocument_save
(
doc
,
vDoc
);
hr
=
IXMLDOMDocument_save
(
doc
,
vDoc
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IXMLDOMDocument_get_xml
(
doc
,
&
sOrig
);
hr
=
IXMLDOMDocument_get_xml
(
doc
,
&
sOrig
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IXMLDOMDocument_get_xml
(
doc2
,
&
sNew
);
hr
=
IXMLDOMDocument_get_xml
(
doc2
,
&
sNew
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
!
lstrcmpW
(
sOrig
,
sNew
),
"New document is not the same as origial
\n
"
);
ok
(
!
lstrcmpW
(
sOrig
,
sNew
),
"New document is not the same as origial
\n
"
);
SysFreeString
(
sOrig
);
SysFreeString
(
sOrig
);
SysFreeString
(
sNew
);
SysFreeString
(
sNew
);
}
IXMLDOMElement_Release
(
pRoot
);
}
IXMLDOMElement_Release
(
root
);
IXMLDOMDocument_Release
(
doc2
);
IXMLDOMDocument_Release
(
doc2
);
IXMLDOMDocument_Release
(
doc
);
}
static
void
test_DocumentSaveToFile
(
void
)
{
IXMLDOMDocument
*
doc
;
IXMLDOMElement
*
pRoot
;
HANDLE
file
;
char
buffer
[
100
];
DWORD
read
=
0
;
HRESULT
hr
;
doc
=
create_document
(
&
IID_IXMLDOMDocument
);
if
(
!
doc
)
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
vFile
;
V_VT
(
&
vFile
)
=
VT_BSTR
;
/* save to path */
V_BSTR
(
&
vFile
)
=
_bstr_
(
"test.xml"
);
V_VT
(
&
file
)
=
VT_BSTR
;
V_BSTR
(
&
file
)
=
_bstr_
(
"test.xml"
);
hr
=
IXMLDOMDocument_save
(
doc
,
vFile
);
hr
=
IXMLDOMDocument_save
(
doc
,
file
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
EXPECT_HR
(
hr
,
S_OK
);
}
}
IXMLDOMElement_Release
(
pRoot
);
IXMLDOMDocument_Release
(
doc
);
IXMLDOMDocument_Release
(
doc
);
file
=
CreateFile
(
"test.xml"
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
hfile
=
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
());
ok
(
hfile
!=
INVALID_HANDLE_VALUE
,
"Could not open file: %u
\n
"
,
GetLastError
());
if
(
file
==
INVALID_HANDLE_VALUE
)
if
(
hfile
==
INVALID_HANDLE_VALUE
)
return
;
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
(
read
!=
0
,
"could not read file
\n
"
);
ok
(
buffer
[
0
]
!=
'<'
||
buffer
[
1
]
!=
'?'
,
"File contains processing instruction
\n
"
);
ok
(
buffer
[
0
]
!=
'<'
||
buffer
[
1
]
!=
'?'
,
"File contains processing instruction
\n
"
);
CloseHandle
(
file
);
CloseHandle
(
h
file
);
DeleteFile
(
"test.xml"
);
DeleteFile
(
"test.xml"
);
free_bstrs
();
}
}
static
void
test_testTransforms
(
void
)
static
void
test_testTransforms
(
void
)
...
@@ -8678,8 +8650,7 @@ START_TEST(domdoc)
...
@@ -8678,8 +8650,7 @@ START_TEST(domdoc)
test_cloneNode
();
test_cloneNode
();
test_xmlTypes
();
test_xmlTypes
();
test_nodeTypeTests
();
test_nodeTypeTests
();
test_DocumentSaveToDocument
();
test_save
();
test_DocumentSaveToFile
();
test_testTransforms
();
test_testTransforms
();
test_Namespaces
();
test_Namespaces
();
test_FormattingXML
();
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