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
c20908bf
Commit
c20908bf
authored
Jul 25, 2010
by
Andrew Nguyen
Committed by
Alexandre Julliard
Jul 26, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
propsys/tests: Add tests for PSStringFromPropertyKey.
parent
c50177b1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
153 additions
and
0 deletions
+153
-0
configure
configure
+1
-0
configure.ac
configure.ac
+1
-0
Makefile.in
dlls/propsys/tests/Makefile.in
+11
-0
propsys.c
dlls/propsys/tests/propsys.c
+140
-0
No files found.
configure
View file @
c20908bf
...
...
@@ -14665,6 +14665,7 @@ wine_fn_config_dll pidgen enable_pidgen
wine_fn_config_dll powrprof enable_powrprof powrprof
wine_fn_config_dll printui enable_printui
wine_fn_config_dll propsys enable_propsys propsys
wine_fn_config_test dlls/propsys/tests propsys_test
wine_fn_config_dll psapi enable_psapi psapi
wine_fn_config_test dlls/psapi/tests psapi_test
wine_fn_config_dll pstorec enable_pstorec
...
...
configure.ac
View file @
c20908bf
...
...
@@ -2534,6 +2534,7 @@ WINE_CONFIG_DLL(pidgen)
WINE_CONFIG_DLL(powrprof,,[powrprof])
WINE_CONFIG_DLL(printui)
WINE_CONFIG_DLL(propsys,,[propsys])
WINE_CONFIG_TEST(dlls/propsys/tests)
WINE_CONFIG_DLL(psapi,,[psapi])
WINE_CONFIG_TEST(dlls/psapi/tests)
WINE_CONFIG_DLL(pstorec)
...
...
dlls/propsys/tests/Makefile.in
0 → 100644
View file @
c20908bf
TOPSRCDIR
=
@top_srcdir@
TOPOBJDIR
=
../../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
TESTDLL
=
propsys.dll
IMPORTS
=
propsys
C_SRCS
=
\
propsys.c
@MAKE_TEST_RULES@
dlls/propsys/tests/propsys.c
0 → 100644
View file @
c20908bf
/*
* Unit tests for Windows property system
*
* Copyright 2010 Andrew Nguyen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "propsys.h"
#include "initguid.h"
#include "wine/test.h"
DEFINE_GUID
(
GUID_NULL
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
static
void
test_PSStringFromPropertyKey
(
void
)
{
static
const
WCHAR
fillerW
[]
=
{
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
};
static
const
WCHAR
zero_fillerW
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,
'-'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'}'
,
' '
,
'4'
,
'2'
,
'9'
,
'4'
,
'9'
,
'6'
,
'7'
,
'2'
,
'9'
,
'5'
,
0
};
static
const
WCHAR
expected2W
[]
=
{
'{'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'-'
,
'0'
,
'0'
,
'0'
,
'0'
,
'-'
,
'0'
,
'0'
,
'0'
,
'0'
,
'-'
,
'0'
,
'0'
,
'0'
,
'0'
,
'-'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'}'
,
' '
,
'1'
,
'3'
,
'5'
,
'7'
,
'9'
,
'\0'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
};
static
const
WCHAR
expected3W
[]
=
{
'{'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'-'
,
'0'
,
'0'
,
'0'
,
'0'
,
'-'
,
'0'
,
'0'
,
'0'
,
'0'
,
'-'
,
'0'
,
'0'
,
'0'
,
'0'
,
'-'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'0'
,
'}'
,
' '
,
'0'
,
'\0'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
,
'X'
};
PROPERTYKEY
prop
=
{
GUID_NULL
,
~
0U
};
PROPERTYKEY
prop2
=
{
GUID_NULL
,
13579
};
PROPERTYKEY
prop3
=
{
GUID_NULL
,
0
};
WCHAR
out
[
PKEYSTR_MAX
];
HRESULT
ret
;
const
struct
{
REFPROPERTYKEY
pkey
;
LPWSTR
psz
;
UINT
cch
;
HRESULT
hr_expect
;
const
WCHAR
*
buf_expect
;
int
hr_broken
;
HRESULT
hr2
;
int
buf_broken
;
const
WCHAR
*
buf2
;
}
testcases
[]
=
{
{
NULL
,
NULL
,
0
,
E_POINTER
},
{
&
prop
,
NULL
,
0
,
E_POINTER
},
{
&
prop
,
NULL
,
PKEYSTR_MAX
,
E_POINTER
},
{
NULL
,
out
,
0
,
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
),
fillerW
},
{
NULL
,
out
,
PKEYSTR_MAX
,
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
),
zero_fillerW
,
0
,
0
,
1
,
fillerW
},
{
&
prop
,
out
,
0
,
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
),
fillerW
},
{
&
prop
,
out
,
GUIDSTRING_MAX
,
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
),
fillerW
},
{
&
prop
,
out
,
GUIDSTRING_MAX
+
1
,
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
),
fillerW
},
{
&
prop
,
out
,
GUIDSTRING_MAX
+
2
,
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
),
zero_truncatedW
,
1
,
S_OK
,
1
,
truncatedW
},
{
&
prop
,
out
,
PKEYSTR_MAX
-
2
,
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
),
zero_truncated2W
,
1
,
S_OK
,
1
,
truncated2W
},
{
&
prop
,
out
,
PKEYSTR_MAX
-
1
,
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
),
zero_truncated3W
,
1
,
S_OK
,
1
,
truncated3W
},
{
&
prop
,
out
,
PKEYSTR_MAX
,
S_OK
,
expectedW
},
{
&
prop2
,
out
,
GUIDSTRING_MAX
+
2
,
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
),
zero_truncated4W
,
1
,
S_OK
,
1
,
truncated4W
},
{
&
prop2
,
out
,
GUIDSTRING_MAX
+
6
,
S_OK
,
expected2W
},
{
&
prop2
,
out
,
PKEYSTR_MAX
,
S_OK
,
expected2W
},
{
&
prop3
,
out
,
GUIDSTRING_MAX
+
1
,
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
),
fillerW
},
{
&
prop3
,
out
,
GUIDSTRING_MAX
+
2
,
S_OK
,
expected3W
},
{
&
prop3
,
out
,
PKEYSTR_MAX
,
S_OK
,
expected3W
},
};
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
testcases
)
/
sizeof
(
testcases
[
0
]);
i
++
)
{
if
(
testcases
[
i
].
psz
)
memcpy
(
testcases
[
i
].
psz
,
fillerW
,
PKEYSTR_MAX
*
sizeof
(
WCHAR
));
ret
=
PSStringFromPropertyKey
(
testcases
[
i
].
pkey
,
testcases
[
i
].
psz
,
testcases
[
i
].
cch
);
ok
(
ret
==
testcases
[
i
].
hr_expect
||
broken
(
testcases
[
i
].
hr_broken
&&
ret
==
testcases
[
i
].
hr2
),
/* Vista/Win2k8 */
"[%d] Expected PSStringFromPropertyKey to return 0x%08x, got 0x%08x
\n
"
,
i
,
testcases
[
i
].
hr_expect
,
ret
);
if
(
testcases
[
i
].
psz
)
ok
(
!
memcmp
(
testcases
[
i
].
psz
,
testcases
[
i
].
buf_expect
,
PKEYSTR_MAX
*
sizeof
(
WCHAR
))
||
broken
(
testcases
[
i
].
buf_broken
&&
!
memcmp
(
testcases
[
i
].
psz
,
testcases
[
i
].
buf2
,
PKEYSTR_MAX
*
sizeof
(
WCHAR
))),
/* Vista/Win2k8 */
"[%d] Unexpected output contents
\n
"
,
i
);
}
}
START_TEST
(
propsys
)
{
test_PSStringFromPropertyKey
();
}
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