mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 14:40:56 +00:00
ole32/tests: Add tests for output parameters in MkParseDisplayName.
This commit is contained in:
parent
7bdf023e69
commit
07325c7d7c
@ -817,7 +817,7 @@ static void test_MkParseDisplayName(void)
|
||||
static const WCHAR wszEmpty[] = {0};
|
||||
char szDisplayNameFile[256];
|
||||
WCHAR wszDisplayNameFile[256];
|
||||
int i;
|
||||
int i, len;
|
||||
|
||||
const struct
|
||||
{
|
||||
@ -861,15 +861,23 @@ static void test_MkParseDisplayName(void)
|
||||
ok(pmk == (IMoniker *)0xdeadbeef, "[%d] Output moniker pointer should have been 0xdeadbeef instead of %p\n", i, pmk);
|
||||
}
|
||||
|
||||
eaten = 0xdeadbeef;
|
||||
pmk = (IMoniker *)0xdeadbeef;
|
||||
hr = MkParseDisplayName(pbc, wszNonExistentProgId, &eaten, &pmk);
|
||||
ok(hr == MK_E_SYNTAX || hr == MK_E_CANTOPENFILE /* Win9x */,
|
||||
"MkParseDisplayName should have failed with MK_E_SYNTAX or MK_E_CANTOPENFILE instead of 0x%08x\n", hr);
|
||||
ok(eaten == 0, "Processed character count should have been 0 instead of %u\n", eaten);
|
||||
ok(pmk == NULL, "Output moniker pointer should have been NULL instead of %p\n", pmk);
|
||||
|
||||
/* no special handling of "clsid:" without the string form of the clsid
|
||||
* following */
|
||||
eaten = 0xdeadbeef;
|
||||
pmk = (IMoniker *)0xdeadbeef;
|
||||
hr = MkParseDisplayName(pbc, wszDisplayNameClsid, &eaten, &pmk);
|
||||
ok(hr == MK_E_SYNTAX || hr == MK_E_CANTOPENFILE /* Win9x */,
|
||||
"MkParseDisplayName should have failed with MK_E_SYNTAX or MK_E_CANTOPENFILE instead of 0x%08x\n", hr);
|
||||
ok(eaten == 0, "Processed character count should have been 0 instead of %u\n", eaten);
|
||||
ok(pmk == NULL, "Output moniker pointer should have been NULL instead of %p\n", pmk);
|
||||
|
||||
/* shows clsid has higher precedence than a running object */
|
||||
hr = CreateFileMoniker(wszDisplayName, &pmk);
|
||||
@ -882,6 +890,8 @@ static void test_MkParseDisplayName(void)
|
||||
pmk = NULL;
|
||||
hr = MkParseDisplayName(pbc, wszDisplayName, &eaten, &pmk);
|
||||
ok_ole_success(hr, MkParseDisplayName);
|
||||
ok(eaten == sizeof(wszDisplayName)/sizeof(WCHAR) - 1,
|
||||
"Processed character count should have been 43 instead of %u\n", eaten);
|
||||
if (pmk)
|
||||
{
|
||||
IMoniker_IsSystemMoniker(pmk, &moniker_type);
|
||||
@ -902,6 +912,8 @@ static void test_MkParseDisplayName(void)
|
||||
pmk = NULL;
|
||||
hr = MkParseDisplayName(pbc, wszDisplayNameRunning, &eaten, &pmk);
|
||||
ok_ole_success(hr, MkParseDisplayName);
|
||||
ok(eaten == sizeof(wszDisplayNameRunning)/sizeof(WCHAR) - 1,
|
||||
"Processed character count should have been 15 instead of %u\n", eaten);
|
||||
if (pmk)
|
||||
{
|
||||
IMoniker_IsSystemMoniker(pmk, &moniker_type);
|
||||
@ -918,6 +930,8 @@ static void test_MkParseDisplayName(void)
|
||||
expected_display_name = wszDisplayNameProgId1;
|
||||
hr = MkParseDisplayName(pbc, wszDisplayNameProgId1, &eaten, &pmk);
|
||||
ok_ole_success(hr, MkParseDisplayName);
|
||||
ok(eaten == sizeof(wszDisplayNameProgId1)/sizeof(WCHAR) - 1,
|
||||
"Processed character count should have been 8 instead of %u\n", eaten);
|
||||
if (pmk)
|
||||
{
|
||||
IMoniker_IsSystemMoniker(pmk, &moniker_type);
|
||||
@ -928,6 +942,8 @@ static void test_MkParseDisplayName(void)
|
||||
expected_display_name = wszDisplayNameProgId2;
|
||||
hr = MkParseDisplayName(pbc, wszDisplayNameProgId2, &eaten, &pmk);
|
||||
ok_ole_success(hr, MkParseDisplayName);
|
||||
ok(eaten == sizeof(wszDisplayNameProgId2)/sizeof(WCHAR) - 1,
|
||||
"Processed character count should have been 8 instead of %u\n", eaten);
|
||||
if (pmk)
|
||||
{
|
||||
IMoniker_IsSystemMoniker(pmk, &moniker_type);
|
||||
@ -935,18 +951,23 @@ static void test_MkParseDisplayName(void)
|
||||
IMoniker_Release(pmk);
|
||||
}
|
||||
|
||||
eaten = 0xdeadbeef;
|
||||
pmk = (IMoniker *)0xdeadbeef;
|
||||
hr = MkParseDisplayName(pbc, wszDisplayNameProgIdFail, &eaten, &pmk);
|
||||
ok(hr == MK_E_SYNTAX || hr == MK_E_CANTOPENFILE /* Win9x */,
|
||||
"MkParseDisplayName with ProgId without marker should fail with MK_E_SYNTAX or MK_E_CANTOPENFILE instead of 0x%08x\n", hr);
|
||||
ok(eaten == 0, "Processed character count should have been 0 instead of %u\n", eaten);
|
||||
ok(pmk == NULL, "Output moniker pointer should have been NULL instead of %p\n", pmk);
|
||||
|
||||
hr = CoRevokeClassObject(pdwReg1);
|
||||
ok_ole_success(hr, CoRevokeClassObject);
|
||||
|
||||
GetSystemDirectoryA(szDisplayNameFile, sizeof(szDisplayNameFile));
|
||||
strcat(szDisplayNameFile, "\\kernel32.dll");
|
||||
MultiByteToWideChar(CP_ACP, 0, szDisplayNameFile, -1, wszDisplayNameFile, sizeof(wszDisplayNameFile)/sizeof(wszDisplayNameFile[0]));
|
||||
len = MultiByteToWideChar(CP_ACP, 0, szDisplayNameFile, -1, wszDisplayNameFile, sizeof(wszDisplayNameFile)/sizeof(wszDisplayNameFile[0]));
|
||||
hr = MkParseDisplayName(pbc, wszDisplayNameFile, &eaten, &pmk);
|
||||
ok_ole_success(hr, MkParseDisplayName);
|
||||
ok(eaten == len - 1, "Processed character count should have been %d instead of %u\n", len - 1, eaten);
|
||||
if (pmk)
|
||||
{
|
||||
IMoniker_IsSystemMoniker(pmk, &moniker_type);
|
||||
@ -956,6 +977,7 @@ static void test_MkParseDisplayName(void)
|
||||
|
||||
hr = MkParseDisplayName(pbc, wszDisplayName, &eaten, &pmk);
|
||||
ok_ole_success(hr, MkParseDisplayName);
|
||||
ok(eaten == sizeof(wszDisplayName)/sizeof(WCHAR) - 1, "Processed character count should have been 43 instead of %u\n", eaten);
|
||||
|
||||
if (pmk)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user