https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f511258ee59183df7cc19…
commit f511258ee59183df7cc196e52bc5429dc0322fe7
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Wed Apr 7 17:08:23 2021 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Wed Apr 7 17:08:23 2021 +0900
Revert '[FONTEXT_APITEST] Follow-up of #3585'
---
.../rostests/apitests/fontext/GetDisplayNameOf.cpp | 97 +++++-----------------
1 file changed, 23 insertions(+), 74 deletions(-)
diff --git a/modules/rostests/apitests/fontext/GetDisplayNameOf.cpp
b/modules/rostests/apitests/fontext/GetDisplayNameOf.cpp
index ac0c7abb425..a0c164d6683 100644
--- a/modules/rostests/apitests/fontext/GetDisplayNameOf.cpp
+++ b/modules/rostests/apitests/fontext/GetDisplayNameOf.cpp
@@ -3,7 +3,6 @@
* LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Tests for fontext GetDisplayNameOf behavior
* COPYRIGHT: Copyright 2021 Mark Jansen <mark.jansen(a)reactos.org>
- * Copyright 2021 Katayama Hirofumi MZ
<katayama.hirofumi.mz(a)gmail.com>
*/
#include <ntstatus.h>
@@ -16,7 +15,6 @@
#include <shlobj.h>
#include <shlwapi.h>
#include <shellutils.h>
-#include <versionhelpers.h>
#include "wine/test.h"
static HRESULT Initialize(CComPtr<IShellFolder>& spFolder)
@@ -41,68 +39,45 @@ static HRESULT Initialize(CComPtr<IShellFolder>& spFolder)
hr = desktopFolder->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder,
&spFolder));
ok_hex(hr, S_OK);
- if (FAILED(hr))
- {
- skip("BindToObject failed\n");
- return hr;
- }
-
return hr;
}
-static void
-Test_GetDisplayNameOf(CComPtr<IShellFolder>& spFolder,
- DWORD dwFlags, LPCWSTR text, BOOL fRelative)
+static void Test_GetDisplayNameOf(CComPtr<IShellFolder>& spFolder)
{
CComPtr<IEnumIDList> fontsEnum;
HRESULT hr = spFolder->EnumObjects(NULL, SHCONTF_NONFOLDERS, &fontsEnum);
+
ok_hex(hr, S_OK);
if (FAILED(hr))
- {
- skip("EnumObjects failed\n");
return;
- }
- BOOL bFound = FALSE;
- for (;;)
- {
- CComHeapPtr<ITEMIDLIST> fontPidl;
- ULONG fetched = 0;
- hr = fontsEnum->Next(1, &fontPidl, &fetched);
- if (FAILED(hr) || hr == S_FALSE)
- break;
-
- STRRET strret;
- hr = spFolder->GetDisplayNameOf(fontPidl, dwFlags, &strret);
- if (FAILED(hr))
- continue;
-
- WCHAR Buf[MAX_PATH];
- hr = StrRetToBufW(&strret, fontPidl, Buf, _countof(Buf));
- if (FAILED(hr))
- continue;
+ CComHeapPtr<ITEMIDLIST> fontPidl;
+ ULONG fetched = 0;
+ hr = fontsEnum->Next(1, &fontPidl, &fetched);
+ STRRET strret;
+ hr = spFolder->GetDisplayNameOf(fontPidl, SHGDN_FORPARSING, &strret);
+ ok_hex(hr, S_OK);
+ if (FAILED(hr))
+ return;
- trace("Path: %s\n", wine_dbgstr_w(Buf));
- if (lstrcmpiW(text, Buf) == 0)
- {
- bFound = TRUE;
- ok_int(PathIsRelativeW(Buf), fRelative);
- break;
- }
- }
+ WCHAR Buf[MAX_PATH];
+ hr = StrRetToBufW(&strret, fontPidl, Buf, _countof(Buf));
+ ok_hex(hr, S_OK);
+ if (FAILED(hr))
+ return;
- ok_int(bFound, TRUE);
+ // On 2k3 where this is not a custom IShellFolder, it will return something like:
+ // 'C:\\WINDOWS\\Fonts\\arial.ttf'
+ // On Vista+ this results in something like:
+ // 'C:\\Windows\\Fonts\\System Bold'
+ BOOL bRelative = PathIsRelativeW(Buf);
+ trace("Path: %s\n", wine_dbgstr_w(Buf));
+ ok(bRelative == FALSE, "Path not relative? (%s)\n", wine_dbgstr_w(Buf));
}
START_TEST(GetDisplayNameOf)
{
- if (IsWindowsVistaOrGreater())
- {
- skip("Vista+\n");
- return;
- }
-
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
{
@@ -110,33 +85,7 @@ START_TEST(GetDisplayNameOf)
HRESULT hr = Initialize(spFolder);
if (SUCCEEDED(hr))
{
- WCHAR szPath[MAX_PATH];
- SHGetFolderPathW(NULL, CSIDL_FONTS, NULL, 0, szPath);
- PathAppendW(szPath, L"arial.ttf");
-
- trace("SHGDN_NORMAL\n");
- Test_GetDisplayNameOf(spFolder, SHGDN_NORMAL, L"arial.ttf", TRUE);
-
- trace("SHGDN_INFOLDER\n");
- Test_GetDisplayNameOf(spFolder, SHGDN_INFOLDER, L"arial.ttf",
TRUE);
-
- trace("SHGDN_FORPARSING\n");
- Test_GetDisplayNameOf(spFolder, SHGDN_FORPARSING, szPath, FALSE);
-
- trace("SHGDN_INFOLDER | SHGDN_FORPARSING\n");
- Test_GetDisplayNameOf(spFolder, SHGDN_INFOLDER | SHGDN_FORPARSING,
L"arial.ttf", TRUE);
-
- trace("SHGDN_FORADDRESSBAR\n");
- Test_GetDisplayNameOf(spFolder, SHGDN_FORADDRESSBAR, L"arial.ttf",
TRUE);
-
- trace("SHGDN_INFOLDER | SHGDN_FORADDRESSBAR\n");
- Test_GetDisplayNameOf(spFolder, SHGDN_INFOLDER | SHGDN_FORADDRESSBAR,
L"arial.ttf", TRUE);
-
- trace("SHGDN_FORPARSING | SHGDN_FORADDRESSBAR\n");
- Test_GetDisplayNameOf(spFolder, SHGDN_FORPARSING | SHGDN_FORADDRESSBAR,
szPath, FALSE);
-
- trace("SHGDN_INFOLDER | SHGDN_FORPARSING |
SHGDN_FORADDRESSBAR\n");
- Test_GetDisplayNameOf(spFolder, SHGDN_INFOLDER | SHGDN_FORPARSING |
SHGDN_FORADDRESSBAR, L"arial.ttf", TRUE);
+ Test_GetDisplayNameOf(spFolder);
}
}