Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
3d38c077
Commit
3d38c077
authored
Feb 04, 2010
by
Hans Leidekker
Committed by
Alexandre Julliard
Feb 04, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Add tests for the _Streams table implementation.
parent
19b50cff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
90 additions
and
2 deletions
+90
-2
db.c
dlls/msi/tests/db.c
+90
-2
No files found.
dlls/msi/tests/db.c
View file @
3d38c077
...
...
@@ -1454,8 +1454,30 @@ static void test_streamtable(void)
MsiViewClose
(
view
);
MsiCloseHandle
(
view
);
/* insert another one */
create_file
(
"test1.txt"
);
rec
=
MsiCreateRecord
(
2
);
MsiRecordSetString
(
rec
,
1
,
"data1"
);
r
=
MsiRecordSetStream
(
rec
,
2
,
"test1.txt"
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to add stream data to the record: %d
\n
"
,
r
);
DeleteFile
(
"test1.txt"
);
r
=
MsiDatabaseOpenView
(
hdb
,
"INSERT INTO `_Streams` ( `Name`, `Data` ) VALUES ( ?, ? )"
,
&
view
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to open database view: %d
\n
"
,
r
);
r
=
MsiViewExecute
(
view
,
rec
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to execute view: %d
\n
"
,
r
);
MsiCloseHandle
(
rec
);
MsiViewClose
(
view
);
MsiCloseHandle
(
view
);
r
=
MsiDatabaseOpenView
(
hdb
,
"SELECT `Name`, `Data` FROM `_Streams`"
,
&
view
);
"SELECT `Name`, `Data` FROM `_Streams`
WHERE `Name` = 'data'
"
,
&
view
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to open database view: %d
\n
"
,
r
);
r
=
MsiViewExecute
(
view
,
0
);
...
...
@@ -1476,10 +1498,76 @@ static void test_streamtable(void)
ok
(
!
lstrcmp
(
buf
,
"test.txt
\n
"
),
"Expected 'test.txt
\\
n', got %s
\n
"
,
buf
);
MsiCloseHandle
(
rec
);
MsiViewClose
(
view
);
MsiCloseHandle
(
view
);
r
=
MsiDatabaseOpenView
(
hdb
,
"SELECT `Name`, `Data` FROM `_Streams` WHERE `Name` = 'data1'"
,
&
view
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to open database view: %d
\n
"
,
r
);
r
=
MsiViewExecute
(
view
,
0
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to execute view: %d
\n
"
,
r
);
r
=
MsiViewFetch
(
view
,
&
rec
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
size
=
MAX_PATH
;
r
=
MsiRecordGetString
(
rec
,
1
,
file
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to get string: %d
\n
"
,
r
);
ok
(
!
lstrcmp
(
file
,
"data1"
),
"Expected 'data1', got %s
\n
"
,
file
);
size
=
MAX_PATH
;
memset
(
buf
,
0
,
MAX_PATH
);
r
=
MsiRecordReadStream
(
rec
,
2
,
buf
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to get stream: %d
\n
"
,
r
);
ok
(
!
lstrcmp
(
buf
,
"test1.txt
\n
"
),
"Expected 'test1.txt
\\
n', got %s
\n
"
,
buf
);
MsiCloseHandle
(
rec
);
MsiViewClose
(
view
);
MsiCloseHandle
(
view
);
/* perform an update */
create_file
(
"test2.txt"
);
rec
=
MsiCreateRecord
(
1
);
r
=
MsiRecordSetStream
(
rec
,
1
,
"test2.txt"
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to add stream data to the record: %d
\n
"
,
r
);
DeleteFile
(
"test2.txt"
);
r
=
MsiDatabaseOpenView
(
hdb
,
"UPDATE `_Streams` SET `Data` = ? WHERE `Name` = 'data1'"
,
&
view
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to open database view: %d
\n
"
,
r
);
r
=
MsiViewExecute
(
view
,
rec
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to execute view: %d
\n
"
,
r
);
MsiCloseHandle
(
rec
);
MsiViewClose
(
view
);
MsiCloseHandle
(
view
);
r
=
MsiDatabaseOpenView
(
hdb
,
"SELECT `Name`, `Data` FROM `_Streams` WHERE `Name` = 'data1'"
,
&
view
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to open database view: %d
\n
"
,
r
);
r
=
MsiViewExecute
(
view
,
0
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to execute view: %d
\n
"
,
r
);
r
=
MsiViewFetch
(
view
,
&
rec
);
ok
(
r
==
ERROR_NO_MORE_ITEMS
,
"Expected ERROR_NO_MORE_ITEMS, got %d
\n
"
,
r
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to fetch record: %d
\n
"
,
r
);
size
=
MAX_PATH
;
r
=
MsiRecordGetString
(
rec
,
1
,
file
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to get string: %d
\n
"
,
r
);
ok
(
!
lstrcmp
(
file
,
"data1"
),
"Expected 'data1', got %s
\n
"
,
file
);
size
=
MAX_PATH
;
memset
(
buf
,
0
,
MAX_PATH
);
r
=
MsiRecordReadStream
(
rec
,
2
,
buf
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to get stream: %d
\n
"
,
r
);
todo_wine
ok
(
!
lstrcmp
(
buf
,
"test2.txt
\n
"
),
"Expected 'test2.txt
\\
n', got %s
\n
"
,
buf
);
MsiCloseHandle
(
rec
);
MsiViewClose
(
view
);
MsiCloseHandle
(
view
);
MsiCloseHandle
(
hdb
);
...
...
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