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
f820392f
Commit
f820392f
authored
Jan 06, 2009
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 06, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Have each test create and destroy its own string table.
parent
18b5366c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
18 deletions
+48
-18
stringtable.c
dlls/setupapi/tests/stringtable.c
+48
-18
No files found.
dlls/setupapi/tests/stringtable.c
View file @
f820392f
...
...
@@ -54,8 +54,6 @@ HMODULE hdll;
static
WCHAR
string
[]
=
{
's'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
static
WCHAR
String
[]
=
{
'S'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
static
WCHAR
foo
[]
=
{
'f'
,
'o'
,
'o'
,
0
};
DWORD
hstring
,
hString
,
hfoo
;
/* Handles pointing to our strings */
HANDLE
table
,
table2
;
/* Handles pointing to our tables */
static
void
load_it_up
(
void
)
{
...
...
@@ -86,15 +84,13 @@ static void load_it_up(void)
pStringTableStringFromId
=
(
void
*
)
GetProcAddress
(
hdll
,
"pSetupStringTableStringFromId"
);
}
static
void
test_StringTableInitialize
(
void
)
{
table
=
pStringTableInitialize
();
ok
(
table
!=
NULL
,
"Failed to Initialize String Table
\n
"
);
}
static
void
test_StringTableAddString
(
void
)
{
DWORD
retval
;
DWORD
retval
,
hstring
,
hString
,
hfoo
;
HANDLE
table
;
table
=
pStringTableInitialize
();
ok
(
table
!=
NULL
,
"failed to initialize string table
\n
"
);
/* case insensitive */
hstring
=
pStringTableAddString
(
table
,
string
,
0
);
...
...
@@ -111,18 +107,44 @@ static void test_StringTableAddString(void)
/* case sensitive */
hString
=
pStringTableAddString
(
table
,
String
,
ST_CASE_SENSITIVE_COMPARE
);
ok
(
hstring
!=
hString
,
"String handle and string share same ID %x in Table
\n
"
,
hstring
);
pStringTableDestroy
(
table
);
}
static
void
test_StringTableDuplicate
(
void
)
{
HANDLE
table
,
table2
;
table
=
pStringTableInitialize
();
ok
(
table
!=
NULL
,
"Failed to Initialize String Table
\n
"
);
table2
=
pStringTableDuplicate
(
table
);
ok
(
table2
!=
NULL
,
"Failed to duplicate String Table
\n
"
);
pStringTableDestroy
(
table
);
pStringTableDestroy
(
table2
);
}
static
void
test_StringTableLookUpString
(
void
)
{
DWORD
retval
,
retval2
;
DWORD
retval
,
retval2
,
hstring
,
hString
,
hfoo
;
HANDLE
table
,
table2
;
table
=
pStringTableInitialize
();
ok
(
table
!=
NULL
,
"failed to initialize string table
\n
"
);
hstring
=
pStringTableAddString
(
table
,
string
,
0
);
ok
(
hstring
!=
~
0u
,
"failed to add 'string' to string table
\n
"
);
hString
=
pStringTableAddString
(
table
,
String
,
0
);
ok
(
hString
!=
~
0u
,
"failed to add 'String' to string table
\n
"
);
hfoo
=
pStringTableAddString
(
table
,
foo
,
0
);
ok
(
hfoo
!=
~
0u
,
"failed to add 'foo' to string table
\n
"
);
table2
=
pStringTableDuplicate
(
table
);
ok
(
table2
!=
NULL
,
"Failed to duplicate String Table
\n
"
);
/* case insensitive */
retval
=
pStringTableLookUpString
(
table
,
string
,
0
);
ok
(
retval
!=-
1
,
"Failed find string in String Table 1
\n
"
);
...
...
@@ -152,35 +174,43 @@ static void test_StringTableLookUpString(void)
retval
=
pStringTableLookUpString
(
table
,
string
,
ST_CASE_SENSITIVE_COMPARE
);
retval2
=
pStringTableLookUpString
(
table
,
String
,
ST_CASE_SENSITIVE_COMPARE
);
ok
(
retval
!=
retval2
,
"Lookup of string equals String in Table 1
\n
"
);
ok
(
retval
2
==
hString
,
ok
(
retval
==
hString
,
"Lookup for String (%x) does not match previous handle (%x) in String Table 1
\n
"
,
retval
,
hString
);
retval
,
hString
);
pStringTableDestroy
(
table
);
pStringTableDestroy
(
table2
);
}
static
void
test_StringTableStringFromId
(
void
)
{
HANDLE
table
;
DWORD
hstring
;
WCHAR
*
string2
;
int
result
;
table
=
pStringTableInitialize
();
ok
(
table
!=
NULL
,
"Failed to Initialize String Table
\n
"
);
hstring
=
pStringTableAddString
(
table
,
string
,
0
);
ok
(
hstring
!=
~
0u
,
"failed to add 'string' to string table
\n
"
);
/* correct */
string2
=
pStringTableStringFromId
(
table
,
pStringTableLookUpString
(
table
,
string
,
0
));
ok
(
string2
!=
NULL
,
"Failed to look up string by ID from String Table
\n
"
);
result
=
lstrcmpiW
(
string
,
string2
);
ok
(
result
==
0
,
"StringID %p does not match requested StringID %p
\n
"
,
string
,
string2
);
pStringTableDestroy
(
table
);
}
START_TEST
(
stringtable
)
{
load_it_up
();
test_StringTableInitialize
();
test_StringTableAddString
();
test_StringTableDuplicate
();
test_StringTableLookUpString
();
test_StringTableStringFromId
();
/* assume we can always destroy */
pStringTableDestroy
(
table
);
pStringTableDestroy
(
table2
);
}
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