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
7d7f14c1
Commit
7d7f14c1
authored
Feb 25, 2009
by
James Hawkins
Committed by
Alexandre Julliard
Feb 26, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Add tests for field zero of a record.
parent
60ad75ea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
148 additions
and
0 deletions
+148
-0
record.c
dlls/msi/tests/record.c
+148
-0
No files found.
dlls/msi/tests/record.c
View file @
7d7f14c1
...
@@ -24,6 +24,8 @@
...
@@ -24,6 +24,8 @@
#include "wine/test.h"
#include "wine/test.h"
static
const
char
*
msifile
=
"winetest.msi"
;
static
BOOL
create_temp_file
(
char
*
name
)
static
BOOL
create_temp_file
(
char
*
name
)
{
{
UINT
r
;
UINT
r
;
...
@@ -443,9 +445,155 @@ static void test_MsiRecordGetInteger(void)
...
@@ -443,9 +445,155 @@ static void test_MsiRecordGetInteger(void)
MsiCloseHandle
(
rec
);
MsiCloseHandle
(
rec
);
}
}
static
void
test_fieldzero
(
void
)
{
MSIHANDLE
hdb
,
hview
,
rec
;
CHAR
buf
[
MAX_PATH
];
LPCSTR
query
;
DWORD
sz
;
UINT
r
;
rec
=
MsiCreateRecord
(
1
);
ok
(
rec
!=
0
,
"Expected a valid handle
\n
"
);
r
=
MsiRecordGetInteger
(
rec
,
0
);
ok
(
r
==
MSI_NULL_INTEGER
,
"Expected MSI_NULL_INTEGER, got %d
\n
"
,
r
);
sz
=
MAX_PATH
;
lstrcpyA
(
buf
,
"apple"
);
r
=
MsiRecordGetString
(
rec
,
0
,
buf
,
&
sz
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
lstrcmpA
(
buf
,
""
),
"Expected
\"\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
sz
==
0
,
"Expectd 0, got %d
\n
"
,
sz
);
r
=
MsiRecordIsNull
(
rec
,
0
);
ok
(
r
==
TRUE
,
"Expected TRUE, got %d
\n
"
,
r
);
r
=
MsiRecordGetInteger
(
rec
,
1
);
ok
(
r
==
MSI_NULL_INTEGER
,
"Expected MSI_NULL_INTEGER, got %d
\n
"
,
r
);
r
=
MsiRecordSetInteger
(
rec
,
1
,
42
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiRecordGetInteger
(
rec
,
0
);
ok
(
r
==
MSI_NULL_INTEGER
,
"Expected MSI_NULL_INTEGER, got %d
\n
"
,
r
);
sz
=
MAX_PATH
;
lstrcpyA
(
buf
,
"apple"
);
r
=
MsiRecordGetString
(
rec
,
0
,
buf
,
&
sz
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
lstrcmpA
(
buf
,
""
),
"Expected
\"\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
sz
==
0
,
"Expectd 0, got %d
\n
"
,
sz
);
r
=
MsiRecordIsNull
(
rec
,
0
);
ok
(
r
==
TRUE
,
"Expected TRUE, got %d
\n
"
,
r
);
r
=
MsiRecordGetInteger
(
rec
,
1
);
ok
(
r
==
42
,
"Expected 42, got %d
\n
"
,
r
);
r
=
MsiRecordSetString
(
rec
,
1
,
"bologna"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiRecordGetInteger
(
rec
,
0
);
ok
(
r
==
MSI_NULL_INTEGER
,
"Expected MSI_NULL_INTEGER, got %d
\n
"
,
r
);
sz
=
MAX_PATH
;
lstrcpyA
(
buf
,
"apple"
);
r
=
MsiRecordGetString
(
rec
,
0
,
buf
,
&
sz
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
lstrcmpA
(
buf
,
""
),
"Expected
\"\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
sz
==
0
,
"Expectd 0, got %d
\n
"
,
sz
);
r
=
MsiRecordIsNull
(
rec
,
0
);
ok
(
r
==
TRUE
,
"Expected TRUE, got %d
\n
"
,
r
);
sz
=
MAX_PATH
;
lstrcpyA
(
buf
,
"apple"
);
r
=
MsiRecordGetString
(
rec
,
1
,
buf
,
&
sz
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
lstrcmpA
(
buf
,
"bologna"
),
"Expected
\"
bologna
\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
sz
==
7
,
"Expectd 7, got %d
\n
"
,
sz
);
MsiCloseHandle
(
rec
);
r
=
MsiOpenDatabase
(
msifile
,
MSIDBOPEN_CREATE
,
&
hdb
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiOpenDatabase failed
\n
"
);
query
=
"CREATE TABLE `drone` ( "
"`id` INT, `name` CHAR(32), `number` CHAR(32) "
"PRIMARY KEY `id`)"
;
r
=
MsiDatabaseOpenView
(
hdb
,
query
,
&
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiViewExecute
(
hview
,
0
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiViewClose
(
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewClose failed
\n
"
);
r
=
MsiCloseHandle
(
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiCloseHandle failed
\n
"
);
query
=
"INSERT INTO `drone` ( `id`, `name`, `number` )"
"VALUES('1', 'Abe', '8675309')"
;
r
=
MsiDatabaseOpenView
(
hdb
,
query
,
&
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiDatabaseOpenView failed
\n
"
);
r
=
MsiViewExecute
(
hview
,
0
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewExecute failed
\n
"
);
r
=
MsiViewClose
(
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewClose failed
\n
"
);
r
=
MsiCloseHandle
(
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiCloseHandle failed
\n
"
);
r
=
MsiDatabaseGetPrimaryKeysA
(
hdb
,
"drone"
,
&
rec
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiRecordGetInteger
(
rec
,
0
);
ok
(
r
==
MSI_NULL_INTEGER
,
"Expected MSI_NULL_INTEGER, got %d
\n
"
,
r
);
sz
=
MAX_PATH
;
lstrcpyA
(
buf
,
"apple"
);
r
=
MsiRecordGetString
(
rec
,
0
,
buf
,
&
sz
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
todo_wine
{
ok
(
!
lstrcmpA
(
buf
,
"drone"
),
"Expected
\"
drone
\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
sz
==
5
,
"Expectd 5, got %d
\n
"
,
sz
);
}
r
=
MsiRecordIsNull
(
rec
,
0
);
todo_wine
{
ok
(
r
==
FALSE
,
"Expected FALSE, got %d
\n
"
,
r
);
}
MsiCloseHandle
(
rec
);
query
=
"SELECT * FROM `drone` WHERE `id` = 1"
;
r
=
MsiDatabaseOpenView
(
hdb
,
query
,
&
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiViewExecute
(
hview
,
0
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiViewFetch
(
hview
,
&
rec
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiRecordGetInteger
(
rec
,
0
);
todo_wine
{
ok
(
r
!=
MSI_NULL_INTEGER
&&
r
!=
0
,
"Expected non-NULL value, got %d
\n
"
,
r
);
}
r
=
MsiRecordIsNull
(
rec
,
0
);
todo_wine
{
ok
(
r
==
FALSE
,
"Expected FALSE, got %d
\n
"
,
r
);
}
MsiCloseHandle
(
hdb
);
DeleteFileA
(
msifile
);
}
START_TEST
(
record
)
START_TEST
(
record
)
{
{
test_msirecord
();
test_msirecord
();
test_MsiRecordGetString
();
test_MsiRecordGetString
();
test_MsiRecordGetInteger
();
test_MsiRecordGetInteger
();
test_fieldzero
();
}
}
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