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
c74a791a
Commit
c74a791a
authored
May 09, 2002
by
Juergen Schmied
Committed by
Alexandre Julliard
May 09, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some tests.
parent
68b6f56b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
209 additions
and
1 deletion
+209
-1
configure
configure
+5
-0
configure.ac
configure.ac
+1
-0
Makefile.in
dlls/shlwapi/Makefile.in
+5
-1
.cvsignore
dlls/shlwapi/tests/.cvsignore
+3
-0
shlwapi_test.spec
dlls/shlwapi/tests/shlwapi_test.spec
+3
-0
shreg.c
dlls/shlwapi/tests/shreg.c
+192
-0
No files found.
configure
View file @
c74a791a
...
...
@@ -12385,6 +12385,8 @@ ac_config_commands="$ac_config_commands dlls/kernel/tests"
ac_config_commands
=
"
$ac_config_commands
dlls/oleaut32/tests"
ac_config_commands
=
"
$ac_config_commands
dlls/shlwapi/tests"
ac_config_commands
=
"
$ac_config_commands
dlls/user/dde"
ac_config_commands
=
"
$ac_config_commands
dlls/user/resources"
...
...
@@ -13048,6 +13050,7 @@ do
"dlls/kernel/messages" ) CONFIG_COMMANDS="
$CONFIG_COMMANDS
dlls/kernel/messages" ;;
"dlls/kernel/tests" ) CONFIG_COMMANDS="
$CONFIG_COMMANDS
dlls/kernel/tests" ;;
"dlls/oleaut32/tests" ) CONFIG_COMMANDS="
$CONFIG_COMMANDS
dlls/oleaut32/tests" ;;
"dlls/shlwapi/tests" ) CONFIG_COMMANDS="
$CONFIG_COMMANDS
dlls/shlwapi/tests" ;;
"dlls/user/dde" ) CONFIG_COMMANDS="
$CONFIG_COMMANDS
dlls/user/dde" ;;
"dlls/user/resources" ) CONFIG_COMMANDS="
$CONFIG_COMMANDS
dlls/user/resources" ;;
"dlls/user/tests" ) CONFIG_COMMANDS="
$CONFIG_COMMANDS
dlls/user/tests" ;;
...
...
@@ -13716,6 +13719,8 @@ echo "$as_me: creating dlls/kernel/messages" >&6;} && mkdir "dlls/kernel/message
echo "
$as_me
: creating dlls/kernel/tests" >&6;} && mkdir "dlls/kernel/tests") ;;
dlls/oleaut32/tests ) test -d "dlls/oleaut32/tests" || ({ echo "
$as_me
:
$LINENO
: creating dlls/oleaut32/tests" >&5
echo "
$as_me
: creating dlls/oleaut32/tests" >&6;} && mkdir "dlls/oleaut32/tests") ;;
dlls/shlwapi/tests ) test -d "dlls/shlwapi/tests" || ({ echo "
$as_me
:
$LINENO
: creating dlls/shlwapi/tests" >&5
echo "
$as_me
: creating dlls/shlwapi/tests" >&6;} && mkdir "dlls/shlwapi/tests") ;;
dlls/user/dde ) test -d "dlls/user/dde" || ({ echo "
$as_me
:
$LINENO
: creating dlls/user/dde" >&5
echo "
$as_me
: creating dlls/user/dde" >&6;} && mkdir "dlls/user/dde") ;;
dlls/user/resources ) test -d "dlls/user/resources" || ({ echo "
$as_me
:
$LINENO
: creating dlls/user/resources" >&5
...
...
configure.ac
View file @
c74a791a
...
...
@@ -1228,6 +1228,7 @@ WINE_CONFIG_EXTRA_DIR(dlls/gdi/win16drv)
WINE_CONFIG_EXTRA_DIR(dlls/kernel/messages)
WINE_CONFIG_EXTRA_DIR(dlls/kernel/tests)
WINE_CONFIG_EXTRA_DIR(dlls/oleaut32/tests)
WINE_CONFIG_EXTRA_DIR(dlls/shlwapi/tests)
WINE_CONFIG_EXTRA_DIR(dlls/user/dde)
WINE_CONFIG_EXTRA_DIR(dlls/user/resources)
WINE_CONFIG_EXTRA_DIR(dlls/user/tests)
...
...
dlls/shlwapi/Makefile.in
View file @
c74a791a
...
...
@@ -19,7 +19,11 @@ C_SRCS = \
string.c
\
url.c
EXTRASUBDIRS
=
tests
CTESTS
=
\
tests/shreg.c
@MAKE_DLL_RULES@
### Dependencies:
dlls/shlwapi/tests/.cvsignore
0 → 100644
View file @
c74a791a
shlwapi_test.spec.c
shreg.ok
testlist.c
dlls/shlwapi/tests/shlwapi_test.spec
0 → 100644
View file @
c74a791a
name shlwapi_test
type win32
mode cuiexe
dlls/shlwapi/tests/shreg.c
0 → 100644
View file @
c74a791a
/* Unit test suite for SHReg* functions
*
* Copyright 2002 Juergen Schmied
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include "wine/test.h"
#include "winbase.h"
#include "winreg.h"
#include "winuser.h"
#include "wine/obj_base.h"
#include "wine/obj_storage.h"
#include "shlwapi.h"
static
char
*
sTestpath1
=
"%SYSTEMROOT%
\\
subdir1"
;
static
char
*
sTestpath2
=
"%USERPROFILE%
\\
subdir1"
;
static
char
sExpTestpath1
[
MAX_PATH
];
static
char
sExpTestpath2
[
MAX_PATH
];
static
char
*
sEmptyBuffer
=
"0123456789"
;
static
void
create_test_entrys
()
{
HKEY
hKey
;
ok
(
!
RegCreateKeyA
(
HKEY_CURRENT_USER
,
"Software
\\
Wine
\\
Test"
,
&
hKey
),
""
);
if
(
hKey
)
{
ok
(
!
RegSetValueExA
(
hKey
,
"Test1"
,
0
,
REG_EXPAND_SZ
,
sTestpath1
,
strlen
(
sTestpath1
)),
""
);
ok
(
!
RegSetValueExA
(
hKey
,
"Test2"
,
0
,
REG_SZ
,
sTestpath1
,
strlen
(
sTestpath1
)),
""
);
ok
(
!
RegSetValueExA
(
hKey
,
"Test3"
,
0
,
REG_EXPAND_SZ
,
sTestpath2
,
strlen
(
sTestpath2
)),
""
);
RegCloseKey
(
hKey
);
}
ExpandEnvironmentStringsA
(
sTestpath1
,
sExpTestpath1
,
sizeof
(
sExpTestpath1
));
ExpandEnvironmentStringsA
(
sTestpath2
,
sExpTestpath2
,
sizeof
(
sExpTestpath2
));
ok
(
strlen
(
sExpTestpath2
)
>
25
,
"%USERPROFILE% is set to a short value on this machine. we cant perform all tests."
);
}
static
void
test_SHGetValue
(
void
)
{
DWORD
dwSize
;
DWORD
dwType
;
char
buf
[
MAX_PATH
];
strcpy
(
buf
,
sEmptyBuffer
);
dwSize
=
MAX_PATH
;
dwType
=
-
1
;
ok
(
!
SHGetValueA
(
HKEY_CURRENT_USER
,
"Software
\\
Wine
\\
Test"
,
"Test1"
,
&
dwType
,
buf
,
&
dwSize
),
""
);
ok
(
0
==
strcmp
(
sExpTestpath1
,
buf
),
"(%s,%s)"
,
buf
,
sExpTestpath1
);
ok
(
REG_SZ
==
dwType
,
"(%lx)"
,
dwType
);
strcpy
(
buf
,
sEmptyBuffer
);
dwSize
=
MAX_PATH
;
dwType
=
-
1
;
ok
(
!
SHGetValueA
(
HKEY_CURRENT_USER
,
"Software
\\
Wine
\\
Test"
,
"Test2"
,
&
dwType
,
buf
,
&
dwSize
),
""
);
ok
(
0
==
strcmp
(
sTestpath1
,
buf
)
,
"(%s)"
,
buf
);
ok
(
REG_SZ
==
dwType
,
"(%lx)"
,
dwType
);
}
static
void
test_SHGetTegPath
(
void
)
{
char
buf
[
MAX_PATH
];
strcpy
(
buf
,
sEmptyBuffer
);
ok
(
!
SHRegGetPathA
(
HKEY_CURRENT_USER
,
"Software
\\
Wine
\\
Test"
,
"Test1"
,
buf
,
0
),
""
);
ok
(
0
==
strcmp
(
sExpTestpath1
,
buf
)
,
"(%s)"
,
buf
);
}
static
void
test_SHQUeryValueEx
(
void
)
{
HKEY
hKey
;
DWORD
dwSize
;
DWORD
dwType
;
char
buf
[
MAX_PATH
];
DWORD
dwRet
;
char
*
sTestedFunction
=
""
;
int
nUsedBuffer1
;
int
nUsedBuffer2
;
ok
(
!
RegOpenKeyExA
(
HKEY_CURRENT_USER
,
"Software
\\
Wine
\\
Test"
,
0
,
KEY_QUERY_VALUE
,
&
hKey
),
"test4 RegOpenKey"
);
/****** SHQueryValueExA ******/
sTestedFunction
=
"SHQueryValueExA"
;
nUsedBuffer1
=
max
(
strlen
(
sExpTestpath1
)
+
1
,
strlen
(
sTestpath1
));
nUsedBuffer2
=
max
(
strlen
(
sExpTestpath2
)
+
1
,
strlen
(
sTestpath2
));
/*
* Case 1.1 All arguments are NULL
*/
ok
(
!
SHQueryValueExA
(
hKey
,
"Test1"
,
NULL
,
NULL
,
NULL
,
NULL
),
""
);
/*
* Case 1.2 dwType is set
*/
dwType
=
-
1
;
ok
(
!
SHQueryValueExA
(
hKey
,
"Test1"
,
NULL
,
&
dwType
,
NULL
,
NULL
),
""
);
ok
(
dwType
==
REG_SZ
,
"(%lu)"
,
dwType
);
/*
* dwSize is set
* dwExpanded < dwUnExpanded
*/
dwSize
=
6
;
ok
(
!
SHQueryValueExA
(
hKey
,
"Test1"
,
NULL
,
NULL
,
NULL
,
&
dwSize
),
""
);
ok
(
dwSize
==
nUsedBuffer1
,
"(%lu,%lu)"
,
dwSize
,
nUsedBuffer1
);
/*
* dwExpanded > dwUnExpanded
*/
dwSize
=
6
;
ok
(
!
SHQueryValueExA
(
hKey
,
"Test3"
,
NULL
,
NULL
,
NULL
,
&
dwSize
),
""
);
ok
(
dwSize
==
nUsedBuffer2
,
"(%lu,%lu)"
,
dwSize
,
nUsedBuffer2
);
/*
* Case 1 string shrinks during expanding
*/
strcpy
(
buf
,
sEmptyBuffer
);
dwSize
=
6
;
dwType
=
-
1
;
dwRet
=
SHQueryValueExA
(
hKey
,
"Test1"
,
NULL
,
&
dwType
,
buf
,
&
dwSize
);
ok
(
dwRet
==
ERROR_MORE_DATA
,
"(%lu)"
,
dwRet
);
ok
(
0
==
strcmp
(
sEmptyBuffer
,
buf
),
"(%s)"
,
buf
);
ok
(
dwType
==
REG_SZ
,
"(%lu)"
,
dwType
);
ok
(
dwSize
==
nUsedBuffer1
,
"(%lu,%lu)"
,
dwSize
,
nUsedBuffer1
);
/*
* string grows during expanding
*/
strcpy
(
buf
,
sEmptyBuffer
);
dwSize
=
6
;
dwType
=
-
1
;
dwRet
=
SHQueryValueExA
(
hKey
,
"Test3"
,
NULL
,
&
dwType
,
buf
,
&
dwSize
);
ok
(
ERROR_MORE_DATA
==
dwRet
,
""
);
ok
(
0
==
strcmp
(
sEmptyBuffer
,
buf
),
"(%s)"
,
buf
);
ok
(
dwSize
==
nUsedBuffer2
,
"(%lu,%lu)"
,
dwSize
,
nUsedBuffer2
);
ok
(
dwType
==
REG_SZ
,
"(%lu)"
,
dwType
);
/*
* if the unexpanded string fits into the buffer it can get cut when expanded
*/
strcpy
(
buf
,
sEmptyBuffer
);
dwSize
=
24
;
dwType
=
-
1
;
ok
(
ERROR_MORE_DATA
==
SHQueryValueExA
(
hKey
,
"Test3"
,
NULL
,
&
dwType
,
buf
,
&
dwSize
),
""
);
ok
(
0
==
strncmp
(
sExpTestpath2
,
buf
,
24
-
1
),
"(%s)"
,
buf
);
ok
(
24
-
1
==
strlen
(
buf
),
"(%s)"
,
buf
);
ok
(
dwSize
==
nUsedBuffer2
,
"(%lu,%lu)"
,
dwSize
,
nUsedBuffer2
);
ok
(
dwType
==
REG_SZ
,
"(%lu)"
,
dwType
);
/*
* The buffer is NULL but the size is set
*/
strcpy
(
buf
,
sEmptyBuffer
);
dwSize
=
6
;
dwType
=
-
1
;
dwRet
=
SHQueryValueExA
(
hKey
,
"Test3"
,
NULL
,
&
dwType
,
NULL
,
&
dwSize
);
ok
(
ERROR_SUCCESS
==
dwRet
,
"(%lu)"
,
dwRet
);
ok
(
dwSize
==
nUsedBuffer2
,
"(%lu,%lu)"
,
dwSize
,
nUsedBuffer2
);
ok
(
dwType
==
REG_SZ
,
"(%lu)"
,
dwType
);
RegCloseKey
(
hKey
);
}
START_TEST
(
shreg
)
{
create_test_entrys
();
test_SHGetValue
();
test_SHQUeryValueEx
();
test_SHGetTegPath
();
}
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