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
9cef3348
Commit
9cef3348
authored
Aug 08, 2022
by
Jactry Zeng
Committed by
Alexandre Julliard
Aug 14, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi/tests: Test UrlUnescapeW() with URL_UNESCAPE_AS_UTF8.
parent
d4820100
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
url.c
dlls/shlwapi/tests/url.c
+28
-0
No files found.
dlls/shlwapi/tests/url.c
View file @
9cef3348
...
...
@@ -28,6 +28,7 @@
#include "shlwapi.h"
#include "wininet.h"
#include "intshcut.h"
#include "winternl.h"
static
const
char
*
TEST_URL_1
=
"http://www.winehq.org/tests?date=10/10/1923"
;
static
const
char
*
TEST_URL_2
=
"http://localhost:8080/tests%2e.html?date=Mon%2010/10/1923"
;
...
...
@@ -418,7 +419,20 @@ static struct
{
L"file://fo%20o%5Ca/bar"
,
L"file://fo o
\\
a/bar"
},
{
L"file://%24%25foobar"
,
L"file://$%foobar"
},
{
L"file:///C:/Program Files"
,
L"file:///C:/Program Files"
},
{
L"file:///C:/Program Files"
,
L"file:///C:/Program Files"
,
URL_UNESCAPE_AS_UTF8
},
{
L"file:///C:/Program%20Files"
,
L"file:///C:/Program Files"
},
{
L"file:///C:/Program%20Files"
,
L"file:///C:/Program Files"
,
URL_UNESCAPE_AS_UTF8
},
{
L"file://foo/%E4%B8%AD%E6%96%87/bar"
,
L"file://foo/
\xe4\xb8\xad\xe6\x96\x87
/bar"
},
/* with 3 btyes utf-8 */
{
L"file://foo/%E4%B8%AD%E6%96%87/bar"
,
L"file://foo/
\x4e2d\x6587
/bar"
,
URL_UNESCAPE_AS_UTF8
},
/* mix corrupt and good utf-8 */
{
L"file://foo/%E4%AD%E6%96%87/bar"
,
L"file://foo/
\xfffd\x6587
/bar"
,
URL_UNESCAPE_AS_UTF8
},
{
L"file://foo/%F0%9F%8D%B7/bar"
,
L"file://foo/
\xf0\x9f\x8d\xb7
/bar"
},
/* with 4 btyes utf-8 */
{
L"file://foo/%F0%9F%8D%B7/bar"
,
L"file://foo/
\xd83c\xdf77
/bar"
,
URL_UNESCAPE_AS_UTF8
},
/* non-escaped chars between multi-byte escaped chars */
{
L"file://foo/%E4%B8%ADabc%E6%96%87/bar"
,
L"file://foo/
\x4e2d
""abc""
\x6587
/bar"
,
URL_UNESCAPE_AS_UTF8
},
{
L"file://foo/%E4B8%AD/bar"
,
L"file://foo/
\xfffd
""B8
\xfffd
/bar"
,
URL_UNESCAPE_AS_UTF8
},
{
L"file://foo/%E4%G8%AD/bar"
,
L"file://foo/
\xfffd
""%G8
\xfffd
/bar"
,
URL_UNESCAPE_AS_UTF8
},
{
L"file://foo/%G4%B8%AD/bar"
,
L"file://foo/%G4
\xfffd\xfffd
/bar"
,
URL_UNESCAPE_AS_UTF8
},
};
static
const
struct
{
...
...
@@ -1406,6 +1420,7 @@ static void test_UrlUnescape(void)
WCHAR
urlW
[
INTERNET_MAX_URL_LENGTH
],
bufferW
[
INTERNET_MAX_URL_LENGTH
];
CHAR
szReturnUrl
[
INTERNET_MAX_URL_LENGTH
];
DWORD
dwEscaped
,
unescaped
;
BOOL
utf8_support
=
TRUE
;
static
char
inplace
[]
=
"file:///C:/Program%20Files"
;
static
char
another_inplace
[]
=
"file:///C:/Program%20Files"
;
static
const
char
expected
[]
=
"file:///C:/Program Files"
;
...
...
@@ -1429,8 +1444,21 @@ static void test_UrlUnescape(void)
ok
(
strcmp
(
szReturnUrl
,
""
)
==
0
,
"Expected empty string
\n
"
);
}
unescaped
=
INTERNET_MAX_URL_LENGTH
;
lstrcpyW
(
urlW
,
L"%F0%9F%8D%B7"
);
res
=
UrlUnescapeW
(
urlW
,
NULL
,
&
unescaped
,
URL_UNESCAPE_AS_UTF8
|
URL_UNESCAPE_INPLACE
);
ok
(
res
==
S_OK
,
"Got %#lx.
\n
"
,
res
);
if
(
!
wcscmp
(
urlW
,
L"
\xf0\x9f\x8d\xb7
"
))
{
utf8_support
=
FALSE
;
win_skip
(
"Skip URL_UNESCAPE_AS_UTF8 tests for pre-win7 systems.
\n
"
);
}
for
(
i
=
0
;
i
<
ARRAYSIZE
(
TEST_URL_UNESCAPEW
);
i
++
)
{
if
(
TEST_URL_UNESCAPEW
[
i
].
flags
&
URL_UNESCAPE_AS_UTF8
&&
!
utf8_support
)
continue
;
lstrcpyW
(
urlW
,
TEST_URL_UNESCAPEW
[
i
].
url
);
memset
(
bufferW
,
0xff
,
sizeof
(
bufferW
));
...
...
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