summaryrefslogtreecommitdiffstats
path: root/Tools/DumpRenderTree/chromium/TestShellWin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/DumpRenderTree/chromium/TestShellWin.cpp')
-rw-r--r--Tools/DumpRenderTree/chromium/TestShellWin.cpp51
1 files changed, 12 insertions, 39 deletions
diff --git a/Tools/DumpRenderTree/chromium/TestShellWin.cpp b/Tools/DumpRenderTree/chromium/TestShellWin.cpp
index 3b3ddd9..f82771f 100644
--- a/Tools/DumpRenderTree/chromium/TestShellWin.cpp
+++ b/Tools/DumpRenderTree/chromium/TestShellWin.cpp
@@ -166,39 +166,11 @@ void openStartupDialog()
bool checkLayoutTestSystemDependencies()
{
- std::list<std::string> errors;
-
- OSVERSIONINFOEX versionInfo;
- ::ZeroMemory(&versionInfo, sizeof(OSVERSIONINFOEX));
- versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
- ::GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&versionInfo));
-
- // Default to XP metrics, override if on Vista or win 7.
- int requiredVScrollSize = 17;
- int requiredFontSize = -11; // 8 pt
- const wchar_t* requiredFont = L"Tahoma";
- bool isVista = false;
- bool isWin7 = false;
- const DWORD major = versionInfo.dwMajorVersion;
- const DWORD minor = versionInfo.dwMinorVersion;
- const WORD type = versionInfo.wProductType;
- if (major == 6 && minor == 1 && type == VER_NT_WORKSTATION) {
- requiredFont = L"Segoe UI";
- requiredFontSize = -12;
- isWin7 = true;
- } else if (major == 6 && !minor && type == VER_NT_WORKSTATION) {
- requiredFont = L"Segoe UI";
- requiredFontSize = -12; // 9 pt
- isVista = true;
- } else if (!(major == 5 && minor == 1 && type == VER_NT_WORKSTATION)) {
- // The above check is for XP, so that means ...
- errors.push_back("Unsupported Operating System version "
- "(must use XP, Vista, or Windows 7).");
- }
-
// This metric will be 17 when font size is "Normal".
// The size of drop-down menus depends on it.
int verticalScrollSize = ::GetSystemMetrics(SM_CXVSCROLL);
+ int requiredVScrollSize = 17;
+ std::list<std::string> errors;
if (verticalScrollSize != requiredVScrollSize)
errors.push_back("Must use normal size fonts (96 dpi).");
@@ -210,21 +182,22 @@ bool checkLayoutTestSystemDependencies()
if (fontSmoothingEnabled && (fontSmoothingType == FE_FONTSMOOTHINGCLEARTYPE))
errors.push_back("ClearType must be disabled.");
- // Check that we're using the default system fonts
- NONCLIENTMETRICS metrics;
- // Checks Vista or later.
- metrics.cbSize = major >= 6 ? sizeof(NONCLIENTMETRICS) : NONCLIENTMETRICS_SIZE_PRE_VISTA;
+ // Check that we're using the default system fonts.
+ OSVERSIONINFO versionInfo = {0};
+ versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
+ ::GetVersionEx(&versionInfo);
+ const bool isVistaOrLater = (versionInfo.dwMajorVersion >= 6);
+ NONCLIENTMETRICS metrics = {0};
+ metrics.cbSize = isVistaOrLater ? (sizeof NONCLIENTMETRICS) : NONCLIENTMETRICS_SIZE_PRE_VISTA;
const bool success = !!::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, metrics.cbSize, &metrics, 0);
ASSERT(success);
LOGFONTW* systemFonts[] =
{&metrics.lfStatusFont, &metrics.lfMenuFont, &metrics.lfSmCaptionFont};
-
+ const wchar_t* const requiredFont = isVistaOrLater ? L"Segoe UI" : L"Tahoma";
+ const int requiredFontSize = isVistaOrLater ? -12 : -11;
for (size_t i = 0; i < arraysize(systemFonts); ++i) {
if (systemFonts[i]->lfHeight != requiredFontSize || wcscmp(requiredFont, systemFonts[i]->lfFaceName)) {
- if (isVista || isWin7)
- errors.push_back("Must use either the Aero or Basic theme.");
- else
- errors.push_back("Must use the default XP theme (Luna).");
+ errors.push_back(isVistaOrLater ? "Must use either the Aero or Basic theme." : "Must use the default XP theme (Luna).");
break;
}
}