OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 #include <list> | 6 #include <list> |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <commctrl.h> | 8 #include <commctrl.h> |
9 | 9 |
10 #include "app/gfx/native_theme_win.h" | 10 #include "app/gfx/native_theme_win.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 // and normal vs large fonts. Something it misses is changes to the color | 42 // and normal vs large fonts. Something it misses is changes to the color |
43 // scheme (which will infact cause pixel test failures). | 43 // scheme (which will infact cause pixel test failures). |
44 bool TestShellPlatformDelegate::CheckLayoutTestSystemDependencies() { | 44 bool TestShellPlatformDelegate::CheckLayoutTestSystemDependencies() { |
45 std::list<std::string> errors; | 45 std::list<std::string> errors; |
46 | 46 |
47 OSVERSIONINFOEX osvi; | 47 OSVERSIONINFOEX osvi; |
48 ::ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); | 48 ::ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); |
49 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); | 49 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); |
50 ::GetVersionEx((OSVERSIONINFO *)&osvi); | 50 ::GetVersionEx((OSVERSIONINFO *)&osvi); |
51 | 51 |
52 // default to XP metrics, override if on Vista | 52 // Default to XP metrics, override if on Vista or win 7. |
53 int requiredVScrollSize = 17; | 53 int requiredVScrollSize = 17; |
54 int requiredFontSize = -11; // 8 pt | 54 int requiredFontSize = -11; // 8 pt |
55 const wchar_t* requiredFont = L"Tahoma"; | 55 const wchar_t* requiredFont = L"Tahoma"; |
56 // Consider Windows 7 as Vista. | |
57 bool isVista = false; | 56 bool isVista = false; |
57 bool isWin7 = false; | |
58 if (osvi.dwMajorVersion == 6 | 58 if (osvi.dwMajorVersion == 6 |
59 && (osvi.dwMinorVersion == 0 || osvi.dwMinorVersion == 1) | 59 && osvi.dwMinorVersion == 1 |
60 && osvi.wProductType == VER_NT_WORKSTATION) { | |
61 requiredFont = L"Segoe UI"; | |
62 requiredFontSize = -12; | |
63 isWin7 = true; | |
64 } else if (osvi.dwMajorVersion == 6 | |
65 && osvi.dwMinorVersion == 0 | |
60 && osvi.wProductType == VER_NT_WORKSTATION) { | 66 && osvi.wProductType == VER_NT_WORKSTATION) { |
61 requiredFont = L"Segoe UI"; | 67 requiredFont = L"Segoe UI"; |
62 requiredFontSize = -12; // 9 pt | 68 requiredFontSize = -12; // 9 pt |
63 isVista = true; | 69 isVista = true; |
64 } else if (osvi.dwMajorVersion == 5 | 70 } else if (osvi.dwMajorVersion == 5 |
65 && osvi.dwMinorVersion == 1 | 71 && osvi.dwMinorVersion == 1 |
66 && osvi.wProductType == VER_NT_WORKSTATION) { | 72 && osvi.wProductType == VER_NT_WORKSTATION) { |
67 // XP; | 73 ; // XP |
ojan
2009/10/29 20:32:31
Nit: This seems weird to me. That compiles?
How a
Dirk Pranke
2009/10/29 21:03:20
Sure, it compiles - it's just an empty statement.
| |
68 } else { | 74 } else { |
69 errors.push_back("Unsupported Operating System version " | 75 errors.push_back("Unsupported Operating System version " |
70 "(must use XP or Vista)."); | 76 "(must use XP, Vista, or Windows 7)."); |
71 } | 77 } |
72 | 78 |
73 // on both XP and Vista, this metric will be 17 when font size is "Normal". | 79 // This metric will be 17 when font size is "Normal". |
74 // The size of drop-down menus depends on it. | 80 // The size of drop-down menus depends on it. |
75 int vScrollSize = ::GetSystemMetrics(SM_CXVSCROLL); | 81 int vScrollSize = ::GetSystemMetrics(SM_CXVSCROLL); |
76 if (vScrollSize != requiredVScrollSize) { | 82 if (vScrollSize != requiredVScrollSize) { |
77 errors.push_back("Must use normal size fonts (96 dpi)."); | 83 errors.push_back("Must use normal size fonts (96 dpi)."); |
78 } | 84 } |
79 | 85 |
80 // ClearType must be disabled, because the rendering is unpredictable. | 86 // ClearType must be disabled, because the rendering is unpredictable. |
81 BOOL bFontSmoothing; | 87 BOOL bFontSmoothing; |
82 SystemParametersInfo(SPI_GETFONTSMOOTHING, (UINT)0, | 88 SystemParametersInfo(SPI_GETFONTSMOOTHING, (UINT)0, |
83 (PVOID)&bFontSmoothing, (UINT)0); | 89 (PVOID)&bFontSmoothing, (UINT)0); |
84 int fontSmoothingType; | 90 int fontSmoothingType; |
85 SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, (UINT)0, | 91 SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, (UINT)0, |
86 (PVOID)&fontSmoothingType, (UINT)0); | 92 (PVOID)&fontSmoothingType, (UINT)0); |
87 if (bFontSmoothing && (fontSmoothingType == FE_FONTSMOOTHINGCLEARTYPE)) { | 93 if (bFontSmoothing && (fontSmoothingType == FE_FONTSMOOTHINGCLEARTYPE)) { |
88 errors.push_back("ClearType must be disabled."); | 94 errors.push_back("ClearType must be disabled."); |
89 } | 95 } |
90 | 96 |
91 // Check that we're using the default system fonts | 97 // Check that we're using the default system fonts |
92 NONCLIENTMETRICS metrics; | 98 NONCLIENTMETRICS metrics; |
93 win_util::GetNonClientMetrics(&metrics); | 99 win_util::GetNonClientMetrics(&metrics); |
94 LOGFONTW* system_fonts[] = | 100 LOGFONTW* system_fonts[] = |
95 { &metrics.lfStatusFont, &metrics.lfMenuFont, &metrics.lfSmCaptionFont }; | 101 { &metrics.lfStatusFont, &metrics.lfMenuFont, &metrics.lfSmCaptionFont }; |
96 | 102 |
97 for (size_t i = 0; i < arraysize(system_fonts); ++i) { | 103 for (size_t i = 0; i < arraysize(system_fonts); ++i) { |
98 if (system_fonts[i]->lfHeight != requiredFontSize || | 104 if (system_fonts[i]->lfHeight != requiredFontSize || |
99 wcscmp(requiredFont, system_fonts[i]->lfFaceName)) { | 105 wcscmp(requiredFont, system_fonts[i]->lfFaceName)) { |
100 if (isVista) | 106 if (isVista || isWin7) |
101 errors.push_back("Must use either the Aero or Basic theme."); | 107 errors.push_back("Must use either the Aero or Basic theme."); |
102 else | 108 else |
103 errors.push_back("Must use the default XP theme (Luna)."); | 109 errors.push_back("Must use the default XP theme (Luna)."); |
104 break; | 110 break; |
105 } | 111 } |
106 } | 112 } |
107 | 113 |
108 if (!errors.empty()) { | 114 if (!errors.empty()) { |
109 fprintf(stderr, "%s", | 115 fprintf(stderr, "%s", |
110 "##################################################################\n" | 116 "##################################################################\n" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 void TestShellPlatformDelegate::SetWindowPositionForRecording( | 148 void TestShellPlatformDelegate::SetWindowPositionForRecording( |
143 TestShell *shell) { | 149 TestShell *shell) { |
144 // Move the window to the upper left corner for consistent | 150 // Move the window to the upper left corner for consistent |
145 // record/playback mode. For automation, we want this to work | 151 // record/playback mode. For automation, we want this to work |
146 // on build systems where the script invoking us is a background | 152 // on build systems where the script invoking us is a background |
147 // process. So for this case, make our window the topmost window | 153 // process. So for this case, make our window the topmost window |
148 // as well. | 154 // as well. |
149 ForegroundHelper::SetForeground(shell->mainWnd()); | 155 ForegroundHelper::SetForeground(shell->mainWnd()); |
150 ::SetWindowPos(shell->mainWnd(), HWND_TOP, 0, 0, 600, 800, 0); | 156 ::SetWindowPos(shell->mainWnd(), HWND_TOP, 0, 0, 600, 800, 0); |
151 } | 157 } |
OLD | NEW |