Author: tfaber
Date: Thu Jul 28 15:25:35 2016
New Revision: 72035
URL:
http://svn.reactos.org/svn/reactos?rev=72035&view=rev
Log:
[SHELL32_APITEST]
- Add a test for CShellLink::GetDescription/SetDescription
CORE-5272
Modified:
trunk/rostests/apitests/shell32/CShellLink.cpp
Modified: trunk/rostests/apitests/shell32/CShellLink.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/shell32/CShellLi…
==============================================================================
--- trunk/rostests/apitests/shell32/CShellLink.cpp [iso-8859-1] (original)
+++ trunk/rostests/apitests/shell32/CShellLink.cpp [iso-8859-1] Thu Jul 28 15:25:35 2016
@@ -157,6 +157,53 @@
static
VOID
+TestDescription(void)
+{
+ HRESULT hr;
+ IShellLinkW *psl;
+ WCHAR buffer[64];
+ PCWSTR testDescription = L"This is a test description";
+
+ /* Test SetDescription */
+ hr = CoCreateInstance(CLSID_ShellLink,
+ NULL,
+ CLSCTX_INPROC_SERVER,
+ IID_PPV_ARG(IShellLinkW, &psl));
+ ok(hr == S_OK, "CoCreateInstance, hr = %lx\n", hr);
+ if (FAILED(hr))
+ {
+ skip("Could not instantiate CShellLink\n");
+ return;
+ }
+
+ memset(buffer, 0x55, sizeof(buffer));
+ hr = psl->GetDescription(buffer, RTL_NUMBER_OF(buffer));
+ ok(hr == S_OK, "IShellLink::GetDescription returned hr = %lx\n", hr);
+ ok(buffer[0] == 0, "buffer[0] = %x\n", buffer[0]);
+ ok(buffer[1] == 0x5555, "buffer[1] = %x\n", buffer[1]);
+
+ hr = psl->SetDescription(testDescription);
+ ok(hr == S_OK, "IShellLink::SetDescription returned hr = %lx\n", hr);
+
+ memset(buffer, 0x55, sizeof(buffer));
+ hr = psl->GetDescription(buffer, RTL_NUMBER_OF(buffer));
+ ok(hr == S_OK, "IShellLink::GetDescription returned hr = %lx\n", hr);
+ ok(buffer[wcslen(testDescription)] == 0, "buffer[n] = %x\n",
buffer[wcslen(testDescription)]);
+ ok(buffer[wcslen(testDescription) + 1] == 0x5555, "buffer[n+1] = %x\n",
buffer[wcslen(testDescription) + 1]);
+ ok(!wcscmp(buffer, testDescription), "buffer = '%ls'\n", buffer);
+
+ hr = psl->SetDescription(NULL);
+ ok(hr == S_OK, "IShellLink::SetDescription returned hr = %lx\n", hr);
+
+ memset(buffer, 0x55, sizeof(buffer));
+ hr = psl->GetDescription(buffer, RTL_NUMBER_OF(buffer));
+ ok(hr == S_OK, "IShellLink::GetDescription returned hr = %lx\n", hr);
+ ok(buffer[0] == 0, "buffer[0] = %x\n", buffer[0]);
+ ok(buffer[1] == 0x5555, "buffer[1] = %x\n", buffer[1]);
+}
+
+static
+VOID
TestShellLink(void)
{
TestShellLinkDef *testDef;
@@ -176,6 +223,8 @@
}
SetEnvironmentVariableW(L"shell",NULL);
+
+ TestDescription();
}
START_TEST(CShellLink)