1 /* 2 * PROJECT: ReactOS api tests 3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) 4 * PURPOSE: Test for GetTextMetrics and GetTextExtentPoint32 5 * COPYRIGHT: Copyright 2018 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com) 6 */ 7 8 #include "precomp.h" 9 10 /* #define EMIT_TESTCASES */ 11 12 typedef struct TEST_ENTRY 13 { 14 int line; 15 LONG lfHeight; 16 LONG lfWidth; 17 LONG cxText; 18 LONG cyText; 19 LONG tmHeight; 20 LONG tmAscent; 21 LONG tmDescent; 22 LONG tmInternalLeading; 23 LONG tmExternalLeading; 24 } TEST_ENTRY; 25 26 #ifdef EMIT_TESTCASES 27 static const TEST_ENTRY g_test_entries[] = 28 { 29 { __LINE__, 400, 0 }, 30 { __LINE__, 300, 0 }, 31 { __LINE__, 200, 0 }, 32 { __LINE__, 100, 0 }, 33 { __LINE__, 64, 0 }, 34 { __LINE__, 32, 0 }, 35 { __LINE__, 16, 0 }, 36 { __LINE__, 15, 0 }, 37 { __LINE__, 14, 0 }, 38 { __LINE__, 13, 0 }, 39 { __LINE__, 12, 0 }, 40 { __LINE__, 11, 0 }, 41 { __LINE__, 10, 0 }, 42 { __LINE__, 9, 0 }, 43 { __LINE__, 8, 0 }, 44 { __LINE__, 7, 0 }, 45 { __LINE__, 6, 0 }, 46 { __LINE__, 5, 0 }, 47 { __LINE__, 4, 0 }, 48 { __LINE__, 3, 0 }, 49 { __LINE__, 2, 0 }, 50 { __LINE__, 1, 0 }, 51 { __LINE__, 0, 0 }, 52 { __LINE__, -1, 0 }, 53 { __LINE__, -2, 0 }, 54 { __LINE__, -3, 0 }, 55 { __LINE__, -4, 0 }, 56 { __LINE__, -5, 0 }, 57 { __LINE__, -6, 0 }, 58 { __LINE__, -7, 0 }, 59 { __LINE__, -8, 0 }, 60 { __LINE__, -9, 0 }, 61 { __LINE__, -10, 0 }, 62 { __LINE__, -11, 0 }, 63 { __LINE__, -12, 0 }, 64 { __LINE__, -13, 0 }, 65 { __LINE__, -14, 0 }, 66 { __LINE__, -15, 0 }, 67 { __LINE__, -16, 0 }, 68 { __LINE__, -32, 0 }, 69 { __LINE__, -64, 0 }, 70 { __LINE__, -100, 0 }, 71 { __LINE__, -200, 0 }, 72 { __LINE__, -300, 0 }, 73 { __LINE__, -400, 0 }, 74 }; 75 #define g_test_entry_count _countof(g_test_entries) 76 #else 77 static const TEST_ENTRY g_FREEMONO[] = 78 { 79 { __LINE__, 400, 0, 3600, 400, 400, 320, 80, 0, 0 }, 80 { __LINE__, 300, 0, 2700, 300, 300, 240, 60, 0, 0 }, 81 { __LINE__, 200, 0, 1800, 200, 200, 160, 40, 0, 0 }, 82 { __LINE__, 100, 0, 900, 100, 100, 80, 20, 0, 0 }, 83 { __LINE__, 64, 0, 570, 64, 64, 51, 13, 0, 0 }, 84 { __LINE__, 32, 0, 285, 32, 32, 26, 6, 0, 0 }, 85 { __LINE__, 16, 0, 150, 16, 16, 13, 3, 0, 0 }, 86 { __LINE__, 15, 0, 135, 15, 15, 12, 3, 0, 0 }, 87 { __LINE__, 14, 0, 120, 14, 14, 11, 3, 0, 0 }, 88 { __LINE__, 13, 0, 120, 13, 13, 10, 3, 0, 0 }, 89 { __LINE__, 12, 0, 105, 12, 12, 10, 2, 0, 0 }, 90 { __LINE__, 11, 0, 105, 11, 11, 9, 2, 0, 0 }, 91 { __LINE__, 10, 0, 90, 10, 10, 8, 2, 0, 0 }, 92 { __LINE__, 9, 0, 77, 9, 9, 7, 2, 0, 0 }, 93 { __LINE__, 8, 0, 75, 8, 8, 6, 2, 0, 0 }, 94 { __LINE__, 7, 0, 60, 7, 7, 6, 1, 0, 0 }, 95 { __LINE__, 6, 0, 60, 6, 6, 5, 1, 0, 0 }, 96 { __LINE__, 5, 0, 45, 5, 5, 4, 1, 0, 0 }, 97 { __LINE__, 4, 0, 30, 4, 4, 3, 1, 0, 0 }, 98 { __LINE__, 3, 0, 30, 3, 3, 2, 1, 0, 0 }, 99 { __LINE__, 2, 0, 15, 2, 2, 2, 0, 0, 0 }, 100 { __LINE__, 1, 0, 15, 2, 2, 2, 0, 0, 0 }, 101 { __LINE__, 0, 0, -165, -18, -18, -14, -4, 0, 0 }, 102 { __LINE__, -1, 0, 15, 2, 2, 2, 0, 0, 0 }, 103 { __LINE__, -2, 0, 15, 2, 2, 2, 0, 0, 0 }, 104 { __LINE__, -3, 0, 30, 3, 3, 2, 1, 0, 0 }, 105 { __LINE__, -4, 0, 30, 4, 4, 3, 1, 0, 0 }, 106 { __LINE__, -5, 0, 45, 5, 5, 4, 1, 0, 0 }, 107 { __LINE__, -6, 0, 60, 6, 6, 5, 1, 0, 0 }, 108 { __LINE__, -7, 0, 60, 7, 7, 6, 1, 0, 0 }, 109 { __LINE__, -8, 0, 75, 8, 8, 6, 2, 0, 0 }, 110 { __LINE__, -9, 0, 77, 9, 9, 7, 2, 0, 0 }, 111 { __LINE__, -10, 0, 90, 10, 10, 8, 2, 0, 0 }, 112 { __LINE__, -11, 0, 105, 11, 11, 9, 2, 0, 0 }, 113 { __LINE__, -12, 0, 105, 12, 12, 10, 2, 0, 0 }, 114 { __LINE__, -13, 0, 120, 13, 13, 10, 3, 0, 0 }, 115 { __LINE__, -14, 0, 120, 14, 14, 11, 3, 0, 0 }, 116 { __LINE__, -15, 0, 135, 15, 15, 12, 3, 0, 0 }, 117 { __LINE__, -16, 0, 150, 16, 16, 13, 3, 0, 0 }, 118 { __LINE__, -32, 0, 285, 32, 32, 26, 6, 0, 0 }, 119 { __LINE__, -64, 0, 570, 64, 64, 51, 13, 0, 0 }, 120 { __LINE__, -100, 0, 900, 100, 100, 80, 20, 0, 0 }, 121 { __LINE__, -200, 0, 1800, 200, 200, 160, 40, 0, 0 }, 122 { __LINE__, -300, 0, 2700, 300, 300, 240, 60, 0, 0 }, 123 { __LINE__, -400, 0, 3600, 400, 400, 320, 80, 0, 0 }, 124 }; 125 #define g_FREEMONO_count _countof(g_FREEMONO) 126 127 static const TEST_ENTRY g_MSGOTHIC[] = 128 { 129 { __LINE__, 400, 0, 3000, 400, 400, 344, 56, 0, 0 }, 130 { __LINE__, 300, 0, 2250, 300, 300, 258, 42, 0, 0 }, 131 { __LINE__, 200, 0, 1500, 200, 200, 172, 28, 0, 0 }, 132 { __LINE__, 100, 0, 750, 100, 100, 86, 14, 0, 0 }, 133 { __LINE__, 64, 0, 480, 64, 64, 55, 9, 0, 0 }, 134 { __LINE__, 32, 0, 240, 33, 33, 28, 5, 1, 0 }, 135 { __LINE__, 16, 0, 120, 16, 16, 14, 2, 0, 0 }, 136 { __LINE__, 15, 0, 120, 15, 15, 13, 2, 0, 0 }, 137 { __LINE__, 14, 0, 105, 14, 14, 12, 2, 0, 0 }, 138 { __LINE__, 13, 0, 105, 13, 13, 11, 2, 0, 0 }, 139 { __LINE__, 12, 0, 90, 12, 12, 10, 2, 0, 0 }, 140 { __LINE__, 11, 0, 90, 11, 11, 9, 2, 0, 0 }, 141 { __LINE__, 10, 0, 75, 10, 10, 9, 1, 0, 0 }, 142 { __LINE__, 9, 0, 75, 9, 9, 8, 1, 0, 0 }, 143 { __LINE__, 8, 0, 60, 8, 8, 7, 1, 0, 0 }, 144 { __LINE__, 7, 0, 60, 7, 7, 6, 1, 0, 0 }, 145 { __LINE__, 6, 0, 45, 6, 6, 5, 1, 0, 0 }, 146 { __LINE__, 5, 0, 45, 5, 5, 4, 1, 0, 0 }, 147 { __LINE__, 4, 0, 30, 4, 4, 3, 1, 0, 0 }, 148 { __LINE__, 3, 0, 30, 3, 3, 3, 0, 0, 0 }, 149 { __LINE__, 2, 0, 15, 2, 2, 2, 0, 0, 0 }, 150 { __LINE__, 1, 0, 15, 2, 2, 2, 0, 0, 0 }, 151 { __LINE__, 0, 0, -135, -18, -18, -15, -3, 0, 0 }, 152 { __LINE__, -1, 0, 15, 2, 2, 2, 0, 0, 0 }, 153 { __LINE__, -2, 0, 15, 2, 2, 2, 0, 0, 0 }, 154 { __LINE__, -3, 0, 30, 3, 3, 3, 0, 0, 0 }, 155 { __LINE__, -4, 0, 30, 4, 4, 3, 1, 0, 0 }, 156 { __LINE__, -5, 0, 45, 5, 5, 4, 1, 0, 0 }, 157 { __LINE__, -6, 0, 45, 6, 6, 5, 1, 0, 0 }, 158 { __LINE__, -7, 0, 60, 7, 7, 6, 1, 0, 0 }, 159 { __LINE__, -8, 0, 60, 8, 8, 7, 1, 0, 0 }, 160 { __LINE__, -9, 0, 75, 9, 9, 8, 1, 0, 0 }, 161 { __LINE__, -10, 0, 75, 10, 10, 9, 1, 0, 0 }, 162 { __LINE__, -11, 0, 90, 11, 11, 9, 2, 0, 0 }, 163 { __LINE__, -12, 0, 90, 12, 12, 10, 2, 0, 0 }, 164 { __LINE__, -13, 0, 105, 13, 13, 11, 2, 0, 0 }, 165 { __LINE__, -14, 0, 105, 14, 14, 12, 2, 0, 0 }, 166 { __LINE__, -15, 0, 120, 15, 15, 13, 2, 0, 0 }, 167 { __LINE__, -16, 0, 120, 16, 16, 14, 2, 0, 0 }, 168 { __LINE__, -32, 0, 240, 33, 33, 28, 5, 1, 0 }, 169 { __LINE__, -64, 0, 480, 64, 64, 55, 9, 0, 0 }, 170 { __LINE__, -100, 0, 750, 100, 100, 86, 14, 0, 0 }, 171 { __LINE__, -200, 0, 1500, 200, 200, 172, 28, 0, 0 }, 172 { __LINE__, -300, 0, 2250, 300, 300, 258, 42, 0, 0 }, 173 { __LINE__, -400, 0, 3000, 400, 400, 344, 56, 0, 0 }, 174 }; 175 #define g_MSGOTHIC_count _countof(g_MSGOTHIC) 176 177 static const TEST_ENTRY g_MSMINCHO[] = 178 { 179 { __LINE__, 400, 0, 3000, 400, 400, 344, 56, 0, 0 }, 180 { __LINE__, 300, 0, 2250, 300, 300, 258, 42, 0, 0 }, 181 { __LINE__, 200, 0, 1500, 200, 200, 172, 28, 0, 0 }, 182 { __LINE__, 100, 0, 750, 100, 100, 86, 14, 0, 0 }, 183 { __LINE__, 64, 0, 480, 64, 64, 55, 9, 0, 0 }, 184 { __LINE__, 32, 0, 240, 33, 33, 28, 5, 1, 0 }, 185 { __LINE__, 16, 0, 120, 16, 16, 14, 2, 0, 0 }, 186 { __LINE__, 15, 0, 120, 15, 15, 13, 2, 0, 0 }, 187 { __LINE__, 14, 0, 105, 14, 14, 12, 2, 0, 0 }, 188 { __LINE__, 13, 0, 105, 13, 13, 11, 2, 0, 0 }, 189 { __LINE__, 12, 0, 90, 12, 12, 10, 2, 0, 0 }, 190 { __LINE__, 11, 0, 90, 11, 11, 9, 2, 0, 0 }, 191 { __LINE__, 10, 0, 75, 10, 10, 9, 1, 0, 0 }, 192 { __LINE__, 9, 0, 75, 9, 9, 8, 1, 0, 0 }, 193 { __LINE__, 8, 0, 60, 8, 8, 7, 1, 0, 0 }, 194 { __LINE__, 7, 0, 60, 7, 7, 6, 1, 0, 0 }, 195 { __LINE__, 6, 0, 45, 6, 6, 5, 1, 0, 0 }, 196 { __LINE__, 5, 0, 45, 5, 5, 4, 1, 0, 0 }, 197 { __LINE__, 4, 0, 30, 4, 4, 3, 1, 0, 0 }, 198 { __LINE__, 3, 0, 30, 3, 3, 3, 0, 0, 0 }, 199 { __LINE__, 2, 0, 15, 2, 2, 2, 0, 0, 0 }, 200 { __LINE__, 1, 0, 15, 2, 2, 2, 0, 0, 0 }, 201 { __LINE__, 0, 0, -135, -18, -18, -15, -3, 0, 0 }, 202 { __LINE__, -1, 0, 15, 2, 2, 2, 0, 0, 0 }, 203 { __LINE__, -2, 0, 15, 2, 2, 2, 0, 0, 0 }, 204 { __LINE__, -3, 0, 30, 3, 3, 3, 0, 0, 0 }, 205 { __LINE__, -4, 0, 30, 4, 4, 3, 1, 0, 0 }, 206 { __LINE__, -5, 0, 45, 5, 5, 4, 1, 0, 0 }, 207 { __LINE__, -6, 0, 45, 6, 6, 5, 1, 0, 0 }, 208 { __LINE__, -7, 0, 60, 7, 7, 6, 1, 0, 0 }, 209 { __LINE__, -8, 0, 60, 8, 8, 7, 1, 0, 0 }, 210 { __LINE__, -9, 0, 75, 9, 9, 8, 1, 0, 0 }, 211 { __LINE__, -10, 0, 75, 10, 10, 9, 1, 0, 0 }, 212 { __LINE__, -11, 0, 90, 11, 11, 9, 2, 0, 0 }, 213 { __LINE__, -12, 0, 90, 12, 12, 10, 2, 0, 0 }, 214 { __LINE__, -13, 0, 105, 13, 13, 11, 2, 0, 0 }, 215 { __LINE__, -14, 0, 105, 14, 14, 12, 2, 0, 0 }, 216 { __LINE__, -15, 0, 120, 15, 15, 13, 2, 0, 0 }, 217 { __LINE__, -16, 0, 120, 16, 16, 14, 2, 0, 0 }, 218 { __LINE__, -32, 0, 240, 33, 33, 28, 5, 1, 0 }, 219 { __LINE__, -64, 0, 480, 64, 64, 55, 9, 0, 0 }, 220 { __LINE__, -100, 0, 750, 100, 100, 86, 14, 0, 0 }, 221 { __LINE__, -200, 0, 1500, 200, 200, 172, 28, 0, 0 }, 222 { __LINE__, -300, 0, 2250, 300, 300, 258, 42, 0, 0 }, 223 { __LINE__, -400, 0, 3000, 400, 400, 344, 56, 0, 0 }, 224 }; 225 #define g_MSMINCHO_count _countof(g_MSMINCHO) 226 227 static const TEST_ENTRY g_TAHOMA[] = 228 { 229 { __LINE__, 400, 0, 1953, 400, 400, 332, 68, 0, 0 }, 230 { __LINE__, 300, 0, 1466, 300, 300, 249, 51, 0, 0 }, 231 { __LINE__, 200, 0, 980, 200, 200, 166, 34, 0, 0 }, 232 { __LINE__, 100, 0, 490, 100, 100, 83, 17, 0, 0 }, 233 { __LINE__, 64, 0, 316, 64, 64, 53, 11, 0, 0 }, 234 { __LINE__, 32, 0, 156, 32, 32, 27, 5, 6, 0 }, 235 { __LINE__, 16, 0, 77, 16, 16, 13, 3, 0, 0 }, 236 { __LINE__, 15, 0, 73, 15, 15, 12, 3, 0, 0 }, 237 { __LINE__, 14, 0, 73, 14, 14, 12, 2, 0, 0 }, 238 { __LINE__, 13, 0, 64, 13, 13, 11, 2, 0, 0 }, 239 { __LINE__, 12, 0, 56, 12, 12, 10, 2, 0, 0 }, 240 { __LINE__, 11, 0, 55, 11, 11, 9, 2, 0, 0 }, 241 { __LINE__, 10, 0, 50, 10, 10, 8, 2, 0, 0 }, 242 { __LINE__, 9, 0, 41, 9, 9, 7, 2, 0, 0 }, 243 { __LINE__, 8, 0, 41, 8, 8, 7, 1, 0, 0 }, 244 { __LINE__, 7, 0, 36, 7, 7, 6, 1, 0, 0 }, 245 { __LINE__, 6, 0, 32, 6, 6, 5, 1, 0, 0 }, 246 { __LINE__, 5, 0, 22, 5, 5, 4, 1, 0, 0 }, 247 { __LINE__, 4, 0, 19, 4, 4, 3, 1, 0, 0 }, 248 { __LINE__, 3, 0, 13, 4, 4, 3, 0, 0, 0 }, 249 { __LINE__, 2, 0, 13, 2, 2, 2, 0, 0, 0 }, 250 { __LINE__, 1, 0, 13, 2, 2, 2, 0, 0, 0 }, 251 { __LINE__, 0, 0, -135, -18, -18, -15, -3, 0, 0 }, 252 { __LINE__, -1, 0, 13, 2, 2, 2, 0, 0, 0 }, 253 { __LINE__, -2, 0, 13, 2, 2, 2, 0, 0, 0 }, 254 { __LINE__, -3, 0, 19, 4, 4, 3, 0, 0, 0 }, 255 { __LINE__, -4, 0, 22, 5, 5, 4, 1, 0, 0 }, 256 { __LINE__, -5, 0, 32, 6, 6, 5, 1, 0, 0 }, 257 { __LINE__, -6, 0, 36, 7, 7, 6, 1, 0, 0 }, 258 { __LINE__, -7, 0, 41, 8, 8, 7, 1, 0, 0 }, 259 { __LINE__, -8, 0, 50, 10, 10, 8, 2, 0, 0 }, 260 { __LINE__, -9, 0, 55, 11, 11, 9, 2, 0, 0 }, 261 { __LINE__, -10, 0, 56, 12, 12, 10, 2, 0, 0 }, 262 { __LINE__, -11, 0, 64, 13, 13, 11, 2, 0, 0 }, 263 { __LINE__, -12, 0, 73, 14, 14, 12, 2, 0, 0 }, 264 { __LINE__, -13, 0, 77, 16, 16, 13, 3, 0, 0 }, 265 { __LINE__, -14, 0, 78, 17, 17, 14, 3, 0, 0 }, 266 { __LINE__, -15, 0, 89, 18, 18, 15, 3, 0, 0 }, 267 { __LINE__, -16, 0, 94, 19, 19, 16, 3, 0, 0 }, 268 { __LINE__, -32, 0, 189, 39, 39, 32, 7, 7, 0 }, 269 { __LINE__, -64, 0, 379, 77, 77, 64, 13, 0, 0 }, 270 { __LINE__, -100, 0, 589, 121, 121, 100, 21, 0, 0 }, 271 { __LINE__, -200, 0, 1182, 241, 241, 200, 41, 0, 0 }, 272 { __LINE__, -300, 0, 1770, 362, 362, 300, 62, 0, 0 }, 273 { __LINE__, -400, 0, 2361, 483, 483, 400, 83, 0, 0 }, 274 }; 275 #define g_TAHOMA_count _countof(g_TAHOMA) 276 277 #endif 278 279 typedef struct FONT_ENTRY 280 { 281 const char *entry_name; 282 const char *font_name; 283 const char *font_file; 284 size_t test_count; 285 const TEST_ENTRY *tests; 286 } FONT_ENTRY; 287 288 static FONT_ENTRY g_font_entries[] = 289 { 290 #ifdef EMIT_TESTCASES 291 { "FREEMONO", "FreeMono", "FreeMono.ttf" }, 292 { "MSGOTHIC", "MS Gothic", "msgothic.ttc" }, 293 { "MSMINCHO", "MS Mincho", "msmincho.ttc" }, 294 { "TAHOMA", "Tahoma", "tahoma.ttf" }, 295 #else 296 { "FREEMONO", "FreeMono", "FreeMono.ttf", g_FREEMONO_count, g_FREEMONO }, 297 { "MSGOTHIC", "MS Gothic", "msgothic.ttc", g_MSGOTHIC_count, g_MSGOTHIC }, 298 { "MSMINCHO", "MS Mincho", "msmincho.ttc", g_MSMINCHO_count, g_MSMINCHO }, 299 { "TAHOMA", "Tahoma", "Tahoma.ttf", g_TAHOMA_count, g_TAHOMA }, 300 #endif 301 }; 302 static size_t g_font_entry_count = _countof(g_font_entries); 303 304 START_TEST(GetTextMetrics) 305 { 306 size_t i, k; 307 LOGFONTA lf; 308 HFONT hFont; 309 HDC hDC; 310 HGDIOBJ hFontOld; 311 SIZE siz; 312 TEXTMETRIC tm; 313 char szPath[MAX_PATH]; 314 static const char *text = "This is a test."; 315 316 hDC = CreateCompatibleDC(NULL); 317 for (i = 0; i < g_font_entry_count; ++i) 318 { 319 FONT_ENTRY *font = &g_font_entries[i]; 320 ZeroMemory(&lf, sizeof(lf)); 321 lf.lfCharSet = DEFAULT_CHARSET; 322 lstrcpyA(lf.lfFaceName, font->font_name); 323 324 GetWindowsDirectoryA(szPath, MAX_PATH); 325 lstrcatA(szPath, "\\Fonts\\"); 326 lstrcatA(szPath, font->font_file); 327 if (GetFileAttributesA(szPath) == 0xFFFFFFFF) 328 { 329 skip("Font file '%s' doesn't exists\n", font->font_file); 330 continue; 331 } 332 333 trace("Testing '%s'.\n", font->font_file); 334 335 #ifdef EMIT_TESTCASES 336 printf("static const TEST_ENTRY g_%s[] =\n", font->entry_name); 337 printf("{\n"); 338 for (k = 0; k < g_test_entry_count; ++k) 339 { 340 const TEST_ENTRY *test = &g_test_entries[k]; 341 342 lf.lfHeight = test->lfHeight; 343 lf.lfWidth = test->lfWidth; 344 345 hFont = CreateFontIndirectA(&lf); 346 hFontOld = SelectObject(hDC, hFont); 347 { 348 GetTextExtentPoint32A(hDC, text, lstrlenA(text), &siz); 349 GetTextMetrics(hDC, &tm); 350 } 351 SelectObject(hDC, hFontOld); 352 DeleteObject(hFont); 353 354 printf(" { __LINE__, %ld, %ld, %ld, %ld, %ld, %ld, %ld, %ld, %ld },\n", 355 lf.lfHeight, lf.lfWidth, 356 siz.cx, siz.cy, 357 tm.tmHeight, tm.tmAscent, tm.tmDescent, tm.tmInternalLeading, tm.tmExternalLeading); 358 } 359 printf("};\n"); 360 printf("#define g_%s_count _countof(g_%s)\n\n", font->entry_name, font->entry_name); 361 #else 362 for (k = 0; k < font->test_count; ++k) 363 { 364 const TEST_ENTRY *test = &font->tests[k]; 365 366 lf.lfHeight = test->lfHeight; 367 lf.lfWidth = test->lfWidth; 368 369 hFont = CreateFontIndirectA(&lf); 370 hFontOld = SelectObject(hDC, hFont); 371 { 372 GetTextExtentPoint32A(hDC, text, lstrlenA(text), &siz); 373 GetTextMetrics(hDC, &tm); 374 } 375 SelectObject(hDC, hFontOld); 376 DeleteObject(hFont); 377 378 if (test->cxText > 0) 379 { 380 ok_(__FILE__, test->line)(labs(test->cxText - siz.cx) <= 1, "%s (%ld): cxText: labs(%ld - %ld) > 1\n", font->entry_name, test->lfHeight, test->cxText, siz.cx); 381 ok_(__FILE__, test->line)(labs(test->cxText - siz.cx) == 0, "%s (%ld): cxText: labs(%ld - %ld) != 0\n", font->entry_name, test->lfHeight, test->cxText, siz.cx); 382 } 383 if (test->cyText > 0) 384 { 385 ok_(__FILE__, test->line)(labs(test->cyText - siz.cy) <= 1, "%s (%ld): cyText: labs(%ld - %ld) > 1\n", font->entry_name, test->lfHeight, test->cyText, siz.cy); 386 ok_(__FILE__, test->line)(labs(test->cyText - siz.cy) == 0, "%s (%ld): cyText: labs(%ld - %ld) != 0\n", font->entry_name, test->lfHeight, test->cyText, siz.cy); 387 } 388 if (test->tmHeight > 0) 389 { 390 ok_(__FILE__, test->line)(labs(test->tmHeight - tm.tmHeight) <= 1, "%s (%ld): tmHeight: labs(%ld - %ld) > 1\n", font->entry_name, test->lfHeight, test->tmHeight, tm.tmHeight); 391 ok_(__FILE__, test->line)(labs(test->tmHeight - tm.tmHeight) == 0, "%s (%ld): tmHeight: labs(%ld - %ld) != 0\n", font->entry_name, test->lfHeight, test->tmHeight, tm.tmHeight); 392 } 393 if (test->tmAscent > 0) 394 { 395 ok_(__FILE__, test->line)(labs(test->tmAscent - tm.tmAscent) <= 1, "%s (%ld): tmAscent: labs(%ld - %ld) > 1\n", font->entry_name, test->lfHeight, test->tmAscent, tm.tmAscent); 396 ok_(__FILE__, test->line)(labs(test->tmAscent - tm.tmAscent) == 0, "%s (%ld): tmAscent: labs(%ld - %ld) != 0\n", font->entry_name, test->lfHeight, test->tmAscent, tm.tmAscent); 397 } 398 if (test->tmDescent > 0) 399 { 400 ok_(__FILE__, test->line)(labs(test->tmDescent - tm.tmDescent) <= 1, "%s (%ld): tmDescent: labs(%ld - %ld) > 1\n", font->entry_name, test->lfHeight, test->tmDescent, tm.tmDescent); 401 ok_(__FILE__, test->line)(labs(test->tmDescent - tm.tmDescent) == 0, "%s (%ld): tmDescent: labs(%ld - %ld) != 0\n", font->entry_name, test->lfHeight, test->tmDescent, tm.tmDescent); 402 } 403 if (test->tmInternalLeading > 0) 404 { 405 ok_(__FILE__, test->line)(labs(test->tmInternalLeading - tm.tmInternalLeading) <= 1, "%s (%ld): tmInternalLeading: labs(%ld - %ld) > 1\n", font->entry_name, test->lfHeight, test->tmInternalLeading, tm.tmInternalLeading); 406 ok_(__FILE__, test->line)(labs(test->tmInternalLeading - tm.tmInternalLeading) == 0, "%s (%ld): tmInternalLeading: labs(%ld - %ld) != 0\n", font->entry_name, test->lfHeight, test->tmInternalLeading, tm.tmInternalLeading); 407 } 408 if (test->tmExternalLeading > 0) 409 { 410 ok_(__FILE__, test->line)(labs(test->tmExternalLeading - tm.tmExternalLeading) <= 1, "%s (%ld): tmExternalLeading: labs(%ld - %ld) > 1\n", font->entry_name, test->lfHeight, test->tmExternalLeading, tm.tmExternalLeading); 411 ok_(__FILE__, test->line)(labs(test->tmExternalLeading - tm.tmExternalLeading) == 0, "%s (%ld): tmExternalLeading: labs(%ld - %ld) != 0\n", font->entry_name, test->lfHeight, test->tmExternalLeading, tm.tmExternalLeading); 412 } 413 } 414 #endif 415 } 416 DeleteDC(hDC); 417 } 418