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
0c568c2a
Commit
0c568c2a
authored
Oct 10, 2008
by
Lei Zhang
Committed by
Alexandre Julliard
Oct 13, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Add some tests for AssocQueryStringW.
parent
8d18cb8c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
136 additions
and
0 deletions
+136
-0
Makefile.in
dlls/shlwapi/tests/Makefile.in
+1
-0
assoc.c
dlls/shlwapi/tests/assoc.c
+134
-0
shlwapi.h
include/shlwapi.h
+1
-0
No files found.
dlls/shlwapi/tests/Makefile.in
View file @
0c568c2a
...
...
@@ -6,6 +6,7 @@ TESTDLL = shlwapi.dll
IMPORTS
=
shlwapi advapi32 ole32 oleaut32 kernel32
CTESTS
=
\
assoc.c
\
clist.c
\
clsid.c
\
generated.c
\
...
...
dlls/shlwapi/tests/assoc.c
0 → 100644
View file @
0c568c2a
/* Unit test suite for SHLWAPI IQueryAssociations functions
*
* Copyright 2008 Google (Lei Zhang)
*
* 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
*/
#include <stdarg.h>
#include "wine/test.h"
#include "shlwapi.h"
#define expect(expected, got) ok ( expected == got, "Expected %d, got %d\n", expected, got)
#define expect_hr(expected, got) ok ( expected == got, "Expected %08x, got %08x\n", expected, got)
/* Every version of Windows with IE should have this association? */
static
const
WCHAR
dotHtml
[]
=
{
'.'
,
'h'
,
't'
,
'm'
,
'l'
,
0
};
static
const
WCHAR
badBad
[]
=
{
'b'
,
'a'
,
'd'
,
'b'
,
'a'
,
'd'
,
0
};
static
const
WCHAR
dotBad
[]
=
{
'.'
,
'b'
,
'a'
,
'd'
,
0
};
static
const
WCHAR
open
[]
=
{
'o'
,
'p'
,
'e'
,
'n'
,
0
};
static
const
WCHAR
invalid
[]
=
{
'i'
,
'n'
,
'v'
,
'a'
,
'l'
,
'i'
,
'd'
,
0
};
static
void
test_getstring_bad
(
void
)
{
HRESULT
hr
;
DWORD
len
;
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
NULL
,
open
,
NULL
,
&
len
);
todo_wine
expect_hr
(
E_INVALIDARG
,
hr
);
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
badBad
,
open
,
NULL
,
&
len
);
todo_wine
expect_hr
(
E_FAIL
,
hr
);
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
dotBad
,
open
,
NULL
,
&
len
);
todo_wine
expect_hr
(
E_FAIL
,
hr
);
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
dotHtml
,
invalid
,
NULL
,
&
len
);
todo_wine
expect_hr
(
0x80070002
,
hr
);
/* NOT FOUND */
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
dotHtml
,
open
,
NULL
,
NULL
);
todo_wine
expect_hr
(
E_UNEXPECTED
,
hr
);
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
NULL
,
open
,
NULL
,
&
len
);
todo_wine
expect_hr
(
E_INVALIDARG
,
hr
);
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
badBad
,
open
,
NULL
,
&
len
);
todo_wine
expect_hr
(
E_FAIL
,
hr
);
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
dotBad
,
open
,
NULL
,
&
len
);
todo_wine
expect_hr
(
E_FAIL
,
hr
);
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
dotHtml
,
invalid
,
NULL
,
&
len
);
todo_wine
expect_hr
(
0x80070002
,
hr
);
/* NOT FOUND */
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
dotHtml
,
open
,
NULL
,
NULL
);
todo_wine
expect_hr
(
E_UNEXPECTED
,
hr
);
}
static
void
test_getstring_basic
(
void
)
{
HRESULT
hr
;
WCHAR
*
friendlyName
;
WCHAR
*
executableName
;
DWORD
len
,
len2
,
slen
;
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
dotHtml
,
open
,
NULL
,
&
len
);
todo_wine
expect_hr
(
S_FALSE
,
hr
);
if
(
hr
!=
S_FALSE
)
{
skip
(
"failed to get initial len
\n
"
);
return
;
}
executableName
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
len
*
sizeof
(
WCHAR
));
if
(
!
executableName
)
{
skip
(
"failed to allocate memory
\n
"
);
return
;
}
len2
=
len
;
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
dotHtml
,
open
,
executableName
,
&
len2
);
expect_hr
(
S_OK
,
hr
);
slen
=
lstrlenW
(
executableName
)
+
1
;
expect
(
len
,
len2
);
expect
(
len
,
slen
);
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
dotHtml
,
open
,
NULL
,
&
len
);
expect_hr
(
S_FALSE
,
hr
);
if
(
hr
!=
S_FALSE
)
{
HeapFree
(
GetProcessHeap
(),
0
,
executableName
);
skip
(
"failed to get initial len
\n
"
);
return
;
}
friendlyName
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
len
*
sizeof
(
WCHAR
));
if
(
!
friendlyName
)
{
HeapFree
(
GetProcessHeap
(),
0
,
executableName
);
skip
(
"failed to allocate memory
\n
"
);
return
;
}
len2
=
len
;
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
dotHtml
,
open
,
friendlyName
,
&
len2
);
expect_hr
(
S_OK
,
hr
);
slen
=
lstrlenW
(
friendlyName
)
+
1
;
expect
(
len
,
len2
);
expect
(
len
,
slen
);
HeapFree
(
GetProcessHeap
(),
0
,
executableName
);
HeapFree
(
GetProcessHeap
(),
0
,
friendlyName
);
}
START_TEST
(
assoc
)
{
test_getstring_bad
();
test_getstring_basic
();
}
include/shlwapi.h
View file @
0c568c2a
...
...
@@ -193,6 +193,7 @@ enum
ASSOCF_REMAPRUNDLL
=
0x080
,
/* Get rundll args */
ASSOCF_NOFIXUPS
=
0x100
,
/* Don't fixup errors */
ASSOCF_IGNOREBASECLASS
=
0x200
,
/* Don't read baseclass */
ASSOCF_INIT_IGNOREUNKNOWN
=
0x400
,
/* Fail for unknown progid */
};
typedef
DWORD
ASSOCF
;
...
...
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