2011-03-10 Peter Kasting <pkasting@google.com>

        Reviewed by Dimitri Glazkov.

        Clean up some gross code in TestShellWin.cpp.  No functional change.
        https://bugs.webkit.org/show_bug.cgi?id=56048

        * DumpRenderTree/chromium/TestShellWin.cpp:
        (checkLayoutTestSystemDependencies):

git-svn-id: svn://svn.chromium.org/blink/trunk@80817 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 122a90cd
2011-03-10 Peter Kasting <pkasting@google.com>
Reviewed by Dimitri Glazkov.
Clean up some gross code in TestShellWin.cpp. No functional change.
https://bugs.webkit.org/show_bug.cgi?id=56048
* DumpRenderTree/chromium/TestShellWin.cpp:
(checkLayoutTestSystemDependencies):
2011-03-10 Keith Kyzivat <keith.kyzivat@nokia.com>
Reviewed by Laszlo Gombos.
......
......@@ -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;
}
}
......
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