Commit 3535fe25 authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

ieframe/tests: Add more IPropertyStorage read/write tests.

parent c5d8ebe7
......@@ -173,12 +173,18 @@ static void test_ReadAndWriteProperties(void)
WCHAR fileNameW[MAX_PATH];
static WCHAR iconPath[] = L"file:///C:/arbitrary/icon/path";
char testurl[] = "http://some/bogus/url.html";
PROPVARIANT pv[2], pvread[2];
ps[0].ulKind = PRSPEC_PROPID;
U(ps[0]).propid = PID_IS_ICONFILE;
ps[1].ulKind = PRSPEC_PROPID;
U(ps[1]).propid = PID_IS_ICONINDEX;
pv[0].vt = VT_LPWSTR;
U(pv[0]).pwszVal = iconPath;
pv[1].vt = VT_I4;
U(pv[1]).lVal = iconIndex;
/* Make sure we have a valid temporary directory */
GetTempPathW(MAX_PATH, fileNameW);
lstrcatW(fileNameW, L"testshortcut.url");
......@@ -190,7 +196,6 @@ static void test_ReadAndWriteProperties(void)
IPersistFile *pf;
IPropertyStorage *pPropStgWrite;
IPropertySetStorage *pPropSetStg;
PROPVARIANT pv[2];
/* We need to set a URL -- IPersistFile refuses to save without one. */
hr = urlA->lpVtbl->SetURL(urlA, testurl, 0);
......@@ -205,10 +210,6 @@ static void test_ReadAndWriteProperties(void)
IPersistFile_Release(pf);
pv[0].vt = VT_LPWSTR;
U(pv[0]).pwszVal = iconPath;
pv[1].vt = VT_I4;
U(pv[1]).lVal = iconIndex;
hr = urlA->lpVtbl->QueryInterface(urlA, &IID_IPropertySetStorage, (void **) &pPropSetStg);
ok(hr == S_OK, "Unable to get an IPropertySetStorage, hr=0x%lx\n", hr);
......@@ -218,6 +219,16 @@ static void test_ReadAndWriteProperties(void)
hr = IPropertyStorage_WriteMultiple(pPropStgWrite, 2, ps, pv, 0);
ok(hr == S_OK, "Unable to set properties, hr=0x%lx\n", hr);
memset(pvread, 0, sizeof(pvread));
hr = IPropertyStorage_ReadMultiple(pPropStgWrite, 2, ps, pvread);
ok(hr == S_OK, "Unable to read properties, hr=0x%lx\n", hr);
ok(pvread[1].vt == VT_I4, "got %d\n", pvread[1].vt);
ok(U(pvread[1]).lVal == iconIndex, "Read wrong icon index: %d\n", U(pvread[1]).iVal);
ok(pvread[0].vt == VT_LPWSTR, "got %d\n", pvread[0].vt);
ok(lstrcmpW(U(pvread[0]).pwszVal, iconPath) == 0, "Wrong icon path read: %s\n", wine_dbgstr_w(U(pvread[0]).pwszVal));
PropVariantClear(&pvread[0]);
PropVariantClear(&pvread[1]);
hr = IPropertyStorage_Commit(pPropStgWrite, STGC_DEFAULT);
ok(hr == S_OK, "Failed to commit properties, hr=0x%lx\n", hr);
......@@ -268,6 +279,10 @@ static void test_ReadAndWriteProperties(void)
}
PropVariantClear(&pvread[0]);
PropVariantClear(&pvread[1]);
hr = IPropertyStorage_WriteMultiple(pPropStgRead, 2, ps, pv, 0);
ok(hr == STG_E_ACCESSDENIED, "setting properties should return STG_E_ACCESSDENIED instead of 0x%lx\n", hr);
IPropertyStorage_Release(pPropStgRead);
IPropertySetStorage_Release(pPropSetStg);
urlAFromFile->lpVtbl->Release(urlAFromFile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment