1 /* 2 * PROJECT: ReactOS API tests 3 * LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+) 4 * PURPOSE: Test for DrawText 5 * COPYRIGHT: Copyright 2019-2020 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com> 6 */ 7 8 #include "precomp.h" 9 10 typedef struct YY 11 { 12 LONG top; 13 LONG bottom; 14 } YY; 15 16 typedef struct TEST_ENTRY 17 { 18 INT line; 19 UINT uFormat; 20 LPCSTR pszText; 21 INT ret; 22 LONG font_height; 23 RECT input; 24 YY output; 25 } TEST_ENTRY; 26 27 #define DT_1 (DT_CALCRECT | DT_SINGLELINE | DT_LEFT | DT_TOP) 28 #define DT_2 (DT_CALCRECT | DT_SINGLELINE | DT_LEFT | DT_VCENTER) 29 #define DT_3 (DT_CALCRECT | DT_LEFT | DT_TOP) 30 #define DT_4 (DT_CALCRECT | DT_LEFT | DT_VCENTER) 31 #define DT_5 (DT_CALCRECT | DT_LEFT | DT_TOP | DT_EDITCONTROL) 32 33 #define DT_6 (DT_SINGLELINE | DT_LEFT | DT_TOP) 34 #define DT_7 (DT_SINGLELINE | DT_LEFT | DT_VCENTER) 35 #define DT_8 (DT_LEFT | DT_TOP) 36 #define DT_9 (DT_LEFT | DT_VCENTER) 37 #define DT_10 (DT_LEFT | DT_TOP | DT_EDITCONTROL) 38 39 static const TEST_ENTRY s_entries[] = 40 { 41 { __LINE__, DT_1, "ABCabc123g", 12, -10, { 0, 0, 0, -2 }, { 0, 12 } }, 42 { __LINE__, DT_1, "ABCabc123g", 12, -10, { 0, 0, 0, -1 }, { 0, 12 } }, 43 { __LINE__, DT_1, "ABCabc123g", 12, -10, { 0, 0, 0, 0 }, { 0, 12 } }, 44 { __LINE__, DT_1, "ABCabc123g", 12, -10, { 0, 0, 0, 1 }, { 0, 12 } }, 45 { __LINE__, DT_1, "ABCabc123g", 12, -10, { 0, 0, 0, 2 }, { 0, 12 } }, 46 { __LINE__, DT_1, "ABCabc123g", 12, -10, { 0, 0, 0, 3 }, { 0, 12 } }, 47 { __LINE__, DT_1, "ABCabc123g", 12, -10, { 0, 0, 0, 4 }, { 0, 12 } }, 48 { __LINE__, DT_1, "ABCabc123g", 12, -10, { 0, 0, 0, 5 }, { 0, 12 } }, 49 { __LINE__, DT_1, "ABCabc123g", 12, -10, { 0, 0, 0, 6 }, { 0, 12 } }, 50 51 { __LINE__, DT_1, "ABCabc123g", 13, -11, { 0, 0, 0, -2 }, { 0, 13 } }, 52 { __LINE__, DT_1, "ABCabc123g", 13, -11, { 0, 0, 0, -1 }, { 0, 13 } }, 53 { __LINE__, DT_1, "ABCabc123g", 13, -11, { 0, 0, 0, 0 }, { 0, 13 } }, 54 { __LINE__, DT_1, "ABCabc123g", 13, -11, { 0, 0, 0, 1 }, { 0, 13 } }, 55 { __LINE__, DT_1, "ABCabc123g", 13, -11, { 0, 0, 0, 2 }, { 0, 13 } }, 56 { __LINE__, DT_1, "ABCabc123g", 13, -11, { 0, 0, 0, 3 }, { 0, 13 } }, 57 { __LINE__, DT_1, "ABCabc123g", 13, -11, { 0, 0, 0, 4 }, { 0, 13 } }, 58 { __LINE__, DT_1, "ABCabc123g", 13, -11, { 0, 0, 0, 5 }, { 0, 13 } }, 59 { __LINE__, DT_1, "ABCabc123g", 13, -11, { 0, 0, 0, 6 }, { 0, 13 } }, 60 61 { __LINE__, DT_1, "ABCabc123g", 14, -12, { 0, 0, 0, -2 }, { 0, 14 } }, 62 { __LINE__, DT_1, "ABCabc123g", 14, -12, { 0, 0, 0, -1 }, { 0, 14 } }, 63 { __LINE__, DT_1, "ABCabc123g", 14, -12, { 0, 0, 0, 0 }, { 0, 14 } }, 64 { __LINE__, DT_1, "ABCabc123g", 14, -12, { 0, 0, 0, 1 }, { 0, 14 } }, 65 { __LINE__, DT_1, "ABCabc123g", 14, -12, { 0, 0, 0, 2 }, { 0, 14 } }, 66 { __LINE__, DT_1, "ABCabc123g", 14, -12, { 0, 0, 0, 3 }, { 0, 14 } }, 67 { __LINE__, DT_1, "ABCabc123g", 14, -12, { 0, 0, 0, 4 }, { 0, 14 } }, 68 { __LINE__, DT_1, "ABCabc123g", 14, -12, { 0, 0, 0, 5 }, { 0, 14 } }, 69 { __LINE__, DT_1, "ABCabc123g", 14, -12, { 0, 0, 0, 6 }, { 0, 14 } }, 70 71 { __LINE__, DT_2, "ABCabc123g", 5, -10, { 0, 0, 0, -2 }, { 0, 5 } }, 72 { __LINE__, DT_2, "ABCabc123g", 6, -10, { 0, 0, 0, -1 }, { 0, 6 } }, 73 { __LINE__, DT_2, "ABCabc123g", 6, -10, { 0, 0, 0, 0 }, { 0, 6 } }, 74 { __LINE__, DT_2, "ABCabc123g", 7, -10, { 0, 0, 0, 1 }, { 0, 7 } }, 75 { __LINE__, DT_2, "ABCabc123g", 7, -10, { 0, 0, 0, 2 }, { 0, 7 } }, 76 { __LINE__, DT_2, "ABCabc123g", 8, -10, { 0, 0, 0, 3 }, { 0, 8 } }, 77 { __LINE__, DT_2, "ABCabc123g", 8, -10, { 0, 0, 0, 4 }, { 0, 8 } }, 78 { __LINE__, DT_2, "ABCabc123g", 9, -10, { 0, 0, 0, 5 }, { 0, 9 } }, 79 { __LINE__, DT_2, "ABCabc123g", 9, -10, { 0, 0, 0, 6 }, { 0, 9 } }, 80 81 { __LINE__, DT_2, "ABCabc123g", 6, -11, { 0, 0, 0, -2 }, { 0, 6 } }, 82 { __LINE__, DT_2, "ABCabc123g", 6, -11, { 0, 0, 0, -1 }, { 0, 6 } }, 83 { __LINE__, DT_2, "ABCabc123g", 7, -11, { 0, 0, 0, 0 }, { 0, 7 } }, 84 { __LINE__, DT_2, "ABCabc123g", 7, -11, { 0, 0, 0, 1 }, { 0, 7 } }, 85 { __LINE__, DT_2, "ABCabc123g", 8, -11, { 0, 0, 0, 2 }, { 0, 8 } }, 86 { __LINE__, DT_2, "ABCabc123g", 8, -11, { 0, 0, 0, 3 }, { 0, 8 } }, 87 { __LINE__, DT_2, "ABCabc123g", 9, -11, { 0, 0, 0, 4 }, { 0, 9 } }, 88 { __LINE__, DT_2, "ABCabc123g", 9, -11, { 0, 0, 0, 5 }, { 0, 9 } }, 89 { __LINE__, DT_2, "ABCabc123g", 10, -11, { 0, 0, 0, 6 }, { 0, 10 } }, 90 91 { __LINE__, DT_2, "ABCabc123g", 6, -12, { 0, 0, 0, -2 }, { 0, 6 } }, 92 { __LINE__, DT_2, "ABCabc123g", 7, -12, { 0, 0, 0, -1 }, { 0, 7 } }, 93 { __LINE__, DT_2, "ABCabc123g", 7, -12, { 0, 0, 0, 0 }, { 0, 7 } }, 94 { __LINE__, DT_2, "ABCabc123g", 8, -12, { 0, 0, 0, 1 }, { 0, 8 } }, 95 { __LINE__, DT_2, "ABCabc123g", 8, -12, { 0, 0, 0, 2 }, { 0, 8 } }, 96 { __LINE__, DT_2, "ABCabc123g", 9, -12, { 0, 0, 0, 3 }, { 0, 9 } }, 97 { __LINE__, DT_2, "ABCabc123g", 9, -12, { 0, 0, 0, 4 }, { 0, 9 } }, 98 { __LINE__, DT_2, "ABCabc123g", 10, -12, { 0, 0, 0, 5 }, { 0, 10 } }, 99 { __LINE__, DT_2, "ABCabc123g", 10, -12, { 0, 0, 0, 6 }, { 0, 10 } }, 100 101 { __LINE__, DT_3, "ABCabc\n123g", 24, -10, { 0, 0, 0, -2 }, { 0, 24 } }, 102 { __LINE__, DT_3, "ABCabc\n123g", 24, -10, { 0, 0, 0, -1 }, { 0, 24 } }, 103 { __LINE__, DT_3, "ABCabc\n123g", 24, -10, { 0, 0, 0, 0 }, { 0, 24 } }, 104 { __LINE__, DT_3, "ABCabc\n123g", 24, -10, { 0, 0, 0, 1 }, { 0, 24 } }, 105 { __LINE__, DT_3, "ABCabc\n123g", 24, -10, { 0, 0, 0, 2 }, { 0, 24 } }, 106 { __LINE__, DT_3, "ABCabc\n123g", 24, -10, { 0, 0, 0, 3 }, { 0, 24 } }, 107 { __LINE__, DT_3, "ABCabc\n123g", 24, -10, { 0, 0, 0, 4 }, { 0, 24 } }, 108 { __LINE__, DT_3, "ABCabc\n123g", 24, -10, { 0, 0, 0, 5 }, { 0, 24 } }, 109 { __LINE__, DT_3, "ABCabc\n123g", 24, -10, { 0, 0, 0, 6 }, { 0, 24 } }, 110 111 { __LINE__, DT_3, "ABCabc\n123g", 26, -11, { 0, 0, 0, -2 }, { 0, 26 } }, 112 { __LINE__, DT_3, "ABCabc\n123g", 26, -11, { 0, 0, 0, -1 }, { 0, 26 } }, 113 { __LINE__, DT_3, "ABCabc\n123g", 26, -11, { 0, 0, 0, 0 }, { 0, 26 } }, 114 { __LINE__, DT_3, "ABCabc\n123g", 26, -11, { 0, 0, 0, 1 }, { 0, 26 } }, 115 { __LINE__, DT_3, "ABCabc\n123g", 26, -11, { 0, 0, 0, 2 }, { 0, 26 } }, 116 { __LINE__, DT_3, "ABCabc\n123g", 26, -11, { 0, 0, 0, 3 }, { 0, 26 } }, 117 { __LINE__, DT_3, "ABCabc\n123g", 26, -11, { 0, 0, 0, 4 }, { 0, 26 } }, 118 { __LINE__, DT_3, "ABCabc\n123g", 26, -11, { 0, 0, 0, 5 }, { 0, 26 } }, 119 { __LINE__, DT_3, "ABCabc\n123g", 26, -11, { 0, 0, 0, 6 }, { 0, 26 } }, 120 121 { __LINE__, DT_3, "ABCabc\n123g", 28, -12, { 0, 0, 0, -2 }, { 0, 28 } }, 122 { __LINE__, DT_3, "ABCabc\n123g", 28, -12, { 0, 0, 0, -1 }, { 0, 28 } }, 123 { __LINE__, DT_3, "ABCabc\n123g", 28, -12, { 0, 0, 0, 0 }, { 0, 28 } }, 124 { __LINE__, DT_3, "ABCabc\n123g", 28, -12, { 0, 0, 0, 1 }, { 0, 28 } }, 125 { __LINE__, DT_3, "ABCabc\n123g", 28, -12, { 0, 0, 0, 2 }, { 0, 28 } }, 126 { __LINE__, DT_3, "ABCabc\n123g", 28, -12, { 0, 0, 0, 3 }, { 0, 28 } }, 127 { __LINE__, DT_3, "ABCabc\n123g", 28, -12, { 0, 0, 0, 4 }, { 0, 28 } }, 128 { __LINE__, DT_3, "ABCabc\n123g", 28, -12, { 0, 0, 0, 5 }, { 0, 28 } }, 129 { __LINE__, DT_3, "ABCabc\n123g", 28, -12, { 0, 0, 0, 6 }, { 0, 28 } }, 130 131 { __LINE__, DT_4, "ABCabc\n123g", 24, -10, { 0, 0, 0, -2 }, { 0, 24 } }, 132 { __LINE__, DT_4, "ABCabc\n123g", 24, -10, { 0, 0, 0, -1 }, { 0, 24 } }, 133 { __LINE__, DT_4, "ABCabc\n123g", 24, -10, { 0, 0, 0, 0 }, { 0, 24 } }, 134 { __LINE__, DT_4, "ABCabc\n123g", 24, -10, { 0, 0, 0, 1 }, { 0, 24 } }, 135 { __LINE__, DT_4, "ABCabc\n123g", 24, -10, { 0, 0, 0, 2 }, { 0, 24 } }, 136 { __LINE__, DT_4, "ABCabc\n123g", 24, -10, { 0, 0, 0, 3 }, { 0, 24 } }, 137 { __LINE__, DT_4, "ABCabc\n123g", 24, -10, { 0, 0, 0, 4 }, { 0, 24 } }, 138 { __LINE__, DT_4, "ABCabc\n123g", 24, -10, { 0, 0, 0, 5 }, { 0, 24 } }, 139 { __LINE__, DT_4, "ABCabc\n123g", 24, -10, { 0, 0, 0, 6 }, { 0, 24 } }, 140 141 { __LINE__, DT_4, "ABCabc\n123g", 26, -11, { 0, 0, 0, -2 }, { 0, 26 } }, 142 { __LINE__, DT_4, "ABCabc\n123g", 26, -11, { 0, 0, 0, -1 }, { 0, 26 } }, 143 { __LINE__, DT_4, "ABCabc\n123g", 26, -11, { 0, 0, 0, 0 }, { 0, 26 } }, 144 { __LINE__, DT_4, "ABCabc\n123g", 26, -11, { 0, 0, 0, 1 }, { 0, 26 } }, 145 { __LINE__, DT_4, "ABCabc\n123g", 26, -11, { 0, 0, 0, 2 }, { 0, 26 } }, 146 { __LINE__, DT_4, "ABCabc\n123g", 26, -11, { 0, 0, 0, 3 }, { 0, 26 } }, 147 { __LINE__, DT_4, "ABCabc\n123g", 26, -11, { 0, 0, 0, 4 }, { 0, 26 } }, 148 { __LINE__, DT_4, "ABCabc\n123g", 26, -11, { 0, 0, 0, 5 }, { 0, 26 } }, 149 { __LINE__, DT_4, "ABCabc\n123g", 26, -11, { 0, 0, 0, 6 }, { 0, 26 } }, 150 151 { __LINE__, DT_4, "ABCabc\n123g", 28, -12, { 0, 0, 0, -2 }, { 0, 28 } }, 152 { __LINE__, DT_4, "ABCabc\n123g", 28, -12, { 0, 0, 0, -1 }, { 0, 28 } }, 153 { __LINE__, DT_4, "ABCabc\n123g", 28, -12, { 0, 0, 0, 0 }, { 0, 28 } }, 154 { __LINE__, DT_4, "ABCabc\n123g", 28, -12, { 0, 0, 0, 1 }, { 0, 28 } }, 155 { __LINE__, DT_4, "ABCabc\n123g", 28, -12, { 0, 0, 0, 2 }, { 0, 28 } }, 156 { __LINE__, DT_4, "ABCabc\n123g", 28, -12, { 0, 0, 0, 3 }, { 0, 28 } }, 157 { __LINE__, DT_4, "ABCabc\n123g", 28, -12, { 0, 0, 0, 4 }, { 0, 28 } }, 158 { __LINE__, DT_4, "ABCabc\n123g", 28, -12, { 0, 0, 0, 5 }, { 0, 28 } }, 159 { __LINE__, DT_4, "ABCabc\n123g", 28, -12, { 0, 0, 0, 6 }, { 0, 28 } }, 160 161 { __LINE__, DT_5, "ABCabc\n123g", 24, -10, { 0, 0, 0, -2 }, { 0, 24 } }, 162 { __LINE__, DT_5, "ABCabc\n123g", 24, -10, { 0, 0, 0, -1 }, { 0, 24 } }, 163 { __LINE__, DT_5, "ABCabc\n123g", 24, -10, { 0, 0, 0, 0 }, { 0, 24 } }, 164 { __LINE__, DT_5, "ABCabc\n123g", 24, -10, { 0, 0, 0, 1 }, { 0, 24 } }, 165 { __LINE__, DT_5, "ABCabc\n123g", 24, -10, { 0, 0, 0, 2 }, { 0, 24 } }, 166 { __LINE__, DT_5, "ABCabc\n123g", 24, -10, { 0, 0, 0, 3 }, { 0, 24 } }, 167 { __LINE__, DT_5, "ABCabc\n123g", 24, -10, { 0, 0, 0, 4 }, { 0, 24 } }, 168 { __LINE__, DT_5, "ABCabc\n123g", 24, -10, { 0, 0, 0, 5 }, { 0, 24 } }, 169 { __LINE__, DT_5, "ABCabc\n123g", 24, -10, { 0, 0, 0, 6 }, { 0, 24 } }, 170 171 { __LINE__, DT_5, "ABCabc\n123g", 26, -11, { 0, 0, 0, -2 }, { 0, 26 } }, 172 { __LINE__, DT_5, "ABCabc\n123g", 26, -11, { 0, 0, 0, -1 }, { 0, 26 } }, 173 { __LINE__, DT_5, "ABCabc\n123g", 26, -11, { 0, 0, 0, 0 }, { 0, 26 } }, 174 { __LINE__, DT_5, "ABCabc\n123g", 26, -11, { 0, 0, 0, 1 }, { 0, 26 } }, 175 { __LINE__, DT_5, "ABCabc\n123g", 26, -11, { 0, 0, 0, 2 }, { 0, 26 } }, 176 { __LINE__, DT_5, "ABCabc\n123g", 26, -11, { 0, 0, 0, 3 }, { 0, 26 } }, 177 { __LINE__, DT_5, "ABCabc\n123g", 26, -11, { 0, 0, 0, 4 }, { 0, 26 } }, 178 { __LINE__, DT_5, "ABCabc\n123g", 26, -11, { 0, 0, 0, 5 }, { 0, 26 } }, 179 { __LINE__, DT_5, "ABCabc\n123g", 26, -11, { 0, 0, 0, 6 }, { 0, 26 } }, 180 181 { __LINE__, DT_5, "ABCabc\n123g", 28, -12, { 0, 0, 0, -2 }, { 0, 28 } }, 182 { __LINE__, DT_5, "ABCabc\n123g", 28, -12, { 0, 0, 0, -1 }, { 0, 28 } }, 183 { __LINE__, DT_5, "ABCabc\n123g", 28, -12, { 0, 0, 0, 0 }, { 0, 28 } }, 184 { __LINE__, DT_5, "ABCabc\n123g", 28, -12, { 0, 0, 0, 1 }, { 0, 28 } }, 185 { __LINE__, DT_5, "ABCabc\n123g", 28, -12, { 0, 0, 0, 2 }, { 0, 28 } }, 186 { __LINE__, DT_5, "ABCabc\n123g", 28, -12, { 0, 0, 0, 3 }, { 0, 28 } }, 187 { __LINE__, DT_5, "ABCabc\n123g", 28, -12, { 0, 0, 0, 4 }, { 0, 28 } }, 188 { __LINE__, DT_5, "ABCabc\n123g", 28, -12, { 0, 0, 0, 5 }, { 0, 28 } }, 189 { __LINE__, DT_5, "ABCabc\n123g", 28, -12, { 0, 0, 0, 6 }, { 0, 28 } }, 190 191 { __LINE__, DT_6, "ABCabc123g", 10, -8, { 0, 1, 30, 15 - 2 }, { 1, 12 } }, 192 { __LINE__, DT_6, "ABCabc123g", 10, -8, { 0, 1, 30, 15 - 1 }, { 1, 13 } }, 193 { __LINE__, DT_6, "ABCabc123g", 10, -8, { 0, 1, 30, 15 + 0 }, { 1, 14 } }, 194 { __LINE__, DT_6, "ABCabc123g", 10, -8, { 0, 1, 30, 15 + 1 }, { 1, 15 } }, 195 { __LINE__, DT_6, "ABCabc123g", 10, -8, { 0, 1, 30, 15 + 2 }, { 1, 16 } }, 196 { __LINE__, DT_6, "ABCabc123g", 10, -8, { 0, 1, 30, 15 + 3 }, { 1, 17 } }, 197 { __LINE__, DT_6, "ABCabc123g", 10, -8, { 0, 1, 30, 15 + 4 }, { 1, 18 } }, 198 { __LINE__, DT_6, "ABCabc123g", 10, -8, { 0, 1, 30, 15 + 5 }, { 1, 19 } }, 199 { __LINE__, DT_6, "ABCabc123g", 10, -8, { 0, 1, 30, 15 + 6 }, { 1, 20 } }, 200 201 { __LINE__, DT_6, "ABCabc123g", 11, -9, { 0, 1, 30, 15 - 2 }, { 1, 12 } }, 202 { __LINE__, DT_6, "ABCabc123g", 11, -9, { 0, 1, 30, 15 - 1 }, { 1, 13 } }, 203 { __LINE__, DT_6, "ABCabc123g", 11, -9, { 0, 1, 30, 15 + 0 }, { 1, 14 } }, 204 { __LINE__, DT_6, "ABCabc123g", 11, -9, { 0, 1, 30, 15 + 1 }, { 1, 15 } }, 205 { __LINE__, DT_6, "ABCabc123g", 11, -9, { 0, 1, 30, 15 + 2 }, { 1, 16 } }, 206 { __LINE__, DT_6, "ABCabc123g", 11, -9, { 0, 1, 30, 15 + 3 }, { 1, 17 } }, 207 { __LINE__, DT_6, "ABCabc123g", 11, -9, { 0, 1, 30, 15 + 4 }, { 1, 18 } }, 208 { __LINE__, DT_6, "ABCabc123g", 11, -9, { 0, 1, 30, 15 + 5 }, { 1, 19 } }, 209 { __LINE__, DT_6, "ABCabc123g", 11, -9, { 0, 1, 30, 15 + 6 }, { 1, 20 } }, 210 211 { __LINE__, DT_6, "ABCabc123g", 12, -10, { 0, 1, 30, 15 - 2 }, { 1, 12 } }, 212 { __LINE__, DT_6, "ABCabc123g", 12, -10, { 0, 1, 30, 15 - 1 }, { 1, 13 } }, 213 { __LINE__, DT_6, "ABCabc123g", 12, -10, { 0, 1, 30, 15 + 0 }, { 1, 14 } }, 214 { __LINE__, DT_6, "ABCabc123g", 12, -10, { 0, 1, 30, 15 + 1 }, { 1, 15 } }, 215 { __LINE__, DT_6, "ABCabc123g", 12, -10, { 0, 1, 30, 15 + 2 }, { 1, 16 } }, 216 { __LINE__, DT_6, "ABCabc123g", 12, -10, { 0, 1, 30, 15 + 3 }, { 1, 17 } }, 217 { __LINE__, DT_6, "ABCabc123g", 12, -10, { 0, 1, 30, 15 + 4 }, { 1, 18 } }, 218 { __LINE__, DT_6, "ABCabc123g", 12, -10, { 0, 1, 30, 15 + 5 }, { 1, 19 } }, 219 { __LINE__, DT_6, "ABCabc123g", 12, -10, { 0, 1, 30, 15 + 6 }, { 1, 20 } }, 220 221 { __LINE__, DT_7, "ABCabc123g", 11, -8, { 0, 1, 30, 15 - 2 }, { 1, 12 } }, 222 { __LINE__, DT_7, "ABCabc123g", 11, -8, { 0, 1, 30, 15 - 1 }, { 1, 13 } }, 223 { __LINE__, DT_7, "ABCabc123g", 12, -8, { 0, 1, 30, 15 + 0 }, { 1, 14 } }, 224 { __LINE__, DT_7, "ABCabc123g", 12, -8, { 0, 1, 30, 15 + 1 }, { 1, 15 } }, 225 { __LINE__, DT_7, "ABCabc123g", 13, -8, { 0, 1, 30, 15 + 2 }, { 1, 16 } }, 226 { __LINE__, DT_7, "ABCabc123g", 13, -8, { 0, 1, 30, 15 + 3 }, { 1, 17 } }, 227 { __LINE__, DT_7, "ABCabc123g", 14, -8, { 0, 1, 30, 15 + 4 }, { 1, 18 } }, 228 { __LINE__, DT_7, "ABCabc123g", 14, -8, { 0, 1, 30, 15 + 5 }, { 1, 19 } }, 229 { __LINE__, DT_7, "ABCabc123g", 15, -8, { 0, 1, 30, 15 + 6 }, { 1, 20 } }, 230 231 { __LINE__, DT_7, "ABCabc123g", 11, -9, { 0, 1, 30, 15 - 2 }, { 1, 12 } }, 232 { __LINE__, DT_7, "ABCabc123g", 12, -9, { 0, 1, 30, 15 - 1 }, { 1, 13 } }, 233 { __LINE__, DT_7, "ABCabc123g", 12, -9, { 0, 1, 30, 15 + 0 }, { 1, 14 } }, 234 { __LINE__, DT_7, "ABCabc123g", 13, -9, { 0, 1, 30, 15 + 1 }, { 1, 15 } }, 235 { __LINE__, DT_7, "ABCabc123g", 13, -9, { 0, 1, 30, 15 + 2 }, { 1, 16 } }, 236 { __LINE__, DT_7, "ABCabc123g", 14, -9, { 0, 1, 30, 15 + 3 }, { 1, 17 } }, 237 { __LINE__, DT_7, "ABCabc123g", 14, -9, { 0, 1, 30, 15 + 4 }, { 1, 18 } }, 238 { __LINE__, DT_7, "ABCabc123g", 15, -9, { 0, 1, 30, 15 + 5 }, { 1, 19 } }, 239 { __LINE__, DT_7, "ABCabc123g", 15, -9, { 0, 1, 30, 15 + 6 }, { 1, 20 } }, 240 241 { __LINE__, DT_7, "ABCabc123g", 12, -10, { 0, 1, 30, 15 - 2 }, { 1, 12 } }, 242 { __LINE__, DT_7, "ABCabc123g", 12, -10, { 0, 1, 30, 15 - 1 }, { 1, 13 } }, 243 { __LINE__, DT_7, "ABCabc123g", 13, -10, { 0, 1, 30, 15 + 0 }, { 1, 14 } }, 244 { __LINE__, DT_7, "ABCabc123g", 13, -10, { 0, 1, 30, 15 + 1 }, { 1, 15 } }, 245 { __LINE__, DT_7, "ABCabc123g", 14, -10, { 0, 1, 30, 15 + 2 }, { 1, 16 } }, 246 { __LINE__, DT_7, "ABCabc123g", 14, -10, { 0, 1, 30, 15 + 3 }, { 1, 17 } }, 247 { __LINE__, DT_7, "ABCabc123g", 15, -10, { 0, 1, 30, 15 + 4 }, { 1, 18 } }, 248 { __LINE__, DT_7, "ABCabc123g", 15, -10, { 0, 1, 30, 15 + 5 }, { 1, 19 } }, 249 { __LINE__, DT_7, "ABCabc123g", 16, -10, { 0, 1, 30, 15 + 6 }, { 1, 20 } }, 250 251 { __LINE__, DT_8, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 - 2 }, { 1, 12 } }, 252 { __LINE__, DT_8, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 - 1 }, { 1, 12 } }, 253 { __LINE__, DT_8, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 + 0 }, { 1, 12 } }, 254 { __LINE__, DT_8, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 + 1 }, { 1, 12 } }, 255 { __LINE__, DT_8, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 + 2 }, { 1, 12 } }, 256 { __LINE__, DT_8, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 + 3 }, { 1, 12 } }, 257 { __LINE__, DT_8, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 + 4 }, { 1, 12 } }, 258 { __LINE__, DT_8, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 + 5 }, { 1, 12 } }, 259 { __LINE__, DT_8, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 + 6 }, { 1, 12 } }, 260 261 { __LINE__, DT_8, "ABCabc\n123g", 22, -9, { 0, 1, 30, 15 - 2 }, { 1, 12 } }, 262 { __LINE__, DT_8, "ABCabc\n123g", 22, -9, { 0, 1, 30, 15 - 1 }, { 1, 13 } }, 263 { __LINE__, DT_8, "ABCabc\n123g", 22, -9, { 0, 1, 30, 15 + 0 }, { 1, 13 } }, 264 { __LINE__, DT_8, "ABCabc\n123g", 22, -9, { 0, 1, 30, 15 + 1 }, { 1, 13 } }, 265 { __LINE__, DT_8, "ABCabc\n123g", 22, -9, { 0, 1, 30, 15 + 2 }, { 1, 13 } }, 266 { __LINE__, DT_8, "ABCabc\n123g", 22, -9, { 0, 1, 30, 15 + 3 }, { 1, 13 } }, 267 { __LINE__, DT_8, "ABCabc\n123g", 22, -9, { 0, 1, 30, 15 + 4 }, { 1, 13 } }, 268 { __LINE__, DT_8, "ABCabc\n123g", 22, -9, { 0, 1, 30, 15 + 5 }, { 1, 13 } }, 269 { __LINE__, DT_8, "ABCabc\n123g", 22, -9, { 0, 1, 30, 15 + 6 }, { 1, 13 } }, 270 271 { __LINE__, DT_8, "ABCabc\n123g", 24, -10, { 0, 1, 30, 15 - 2 }, { 1, 12 } }, 272 { __LINE__, DT_8, "ABCabc\n123g", 24, -10, { 0, 1, 30, 15 - 1 }, { 1, 13 } }, 273 { __LINE__, DT_8, "ABCabc\n123g", 24, -10, { 0, 1, 30, 15 + 0 }, { 1, 14 } }, 274 { __LINE__, DT_8, "ABCabc\n123g", 24, -10, { 0, 1, 30, 15 + 1 }, { 1, 15 } }, 275 { __LINE__, DT_8, "ABCabc\n123g", 24, -10, { 0, 1, 30, 15 + 2 }, { 1, 15 } }, 276 { __LINE__, DT_8, "ABCabc\n123g", 24, -10, { 0, 1, 30, 15 + 3 }, { 1, 15 } }, 277 { __LINE__, DT_8, "ABCabc\n123g", 24, -10, { 0, 1, 30, 15 + 4 }, { 1, 15 } }, 278 { __LINE__, DT_8, "ABCabc\n123g", 24, -10, { 0, 1, 30, 15 + 5 }, { 1, 15 } }, 279 { __LINE__, DT_8, "ABCabc\n123g", 24, -10, { 0, 1, 30, 15 + 6 }, { 1, 15 } }, 280 281 { __LINE__, DT_9, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 - 2 }, { 1, 12 } }, 282 { __LINE__, DT_9, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 - 1 }, { 1, 12 } }, 283 { __LINE__, DT_9, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 + 0 }, { 1, 12 } }, 284 { __LINE__, DT_9, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 + 1 }, { 1, 12 } }, 285 { __LINE__, DT_9, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 + 2 }, { 1, 12 } }, 286 { __LINE__, DT_9, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 + 3 }, { 1, 12 } }, 287 { __LINE__, DT_9, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 + 4 }, { 1, 12 } }, 288 { __LINE__, DT_9, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 + 5 }, { 1, 12 } }, 289 { __LINE__, DT_9, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 + 6 }, { 1, 12 } }, 290 291 { __LINE__, DT_9, "ABCabc\n123g", 22, -9, { 0, 1, 30, 15 - 2 }, { 1, 12 } }, 292 { __LINE__, DT_9, "ABCabc\n123g", 22, -9, { 0, 1, 30, 15 - 1 }, { 1, 13 } }, 293 { __LINE__, DT_9, "ABCabc\n123g", 22, -9, { 0, 1, 30, 15 + 0 }, { 1, 13 } }, 294 { __LINE__, DT_9, "ABCabc\n123g", 22, -9, { 0, 1, 30, 15 + 1 }, { 1, 13 } }, 295 { __LINE__, DT_9, "ABCabc\n123g", 22, -9, { 0, 1, 30, 15 + 2 }, { 1, 13 } }, 296 { __LINE__, DT_9, "ABCabc\n123g", 22, -9, { 0, 1, 30, 15 + 3 }, { 1, 13 } }, 297 { __LINE__, DT_9, "ABCabc\n123g", 22, -9, { 0, 1, 30, 15 + 4 }, { 1, 13 } }, 298 { __LINE__, DT_9, "ABCabc\n123g", 22, -9, { 0, 1, 30, 15 + 5 }, { 1, 13 } }, 299 { __LINE__, DT_9, "ABCabc\n123g", 22, -9, { 0, 1, 30, 15 + 6 }, { 1, 13 } }, 300 301 { __LINE__, DT_9, "ABCabc\n123g", 24, -10, { 0, 1, 30, 15 - 2 }, { 1, 12 } }, 302 { __LINE__, DT_9, "ABCabc\n123g", 24, -10, { 0, 1, 30, 15 - 1 }, { 1, 13 } }, 303 { __LINE__, DT_9, "ABCabc\n123g", 24, -10, { 0, 1, 30, 15 + 0 }, { 1, 14 } }, 304 { __LINE__, DT_9, "ABCabc\n123g", 24, -10, { 0, 1, 30, 15 + 1 }, { 1, 15 } }, 305 { __LINE__, DT_9, "ABCabc\n123g", 24, -10, { 0, 1, 30, 15 + 2 }, { 1, 15 } }, 306 { __LINE__, DT_9, "ABCabc\n123g", 24, -10, { 0, 1, 30, 15 + 3 }, { 1, 15 } }, 307 { __LINE__, DT_9, "ABCabc\n123g", 24, -10, { 0, 1, 30, 15 + 4 }, { 1, 15 } }, 308 { __LINE__, DT_9, "ABCabc\n123g", 24, -10, { 0, 1, 30, 15 + 5 }, { 1, 15 } }, 309 { __LINE__, DT_9, "ABCabc\n123g", 24, -10, { 0, 1, 30, 15 + 6 }, { 1, 15 } }, 310 311 { __LINE__, DT_10, "ABCabc\n123g", 10, -8, { 0, 1, 30, 15 - 2 }, { 1, 12 } }, 312 { __LINE__, DT_10, "ABCabc\n123g", 10, -8, { 0, 1, 30, 15 - 1 }, { 1, 13 } }, 313 { __LINE__, DT_10, "ABCabc\n123g", 10, -8, { 0, 1, 30, 15 + 0 }, { 1, 14 } }, 314 { __LINE__, DT_10, "ABCabc\n123g", 10, -8, { 0, 1, 30, 15 + 1 }, { 1, 15 } }, 315 { __LINE__, DT_10, "ABCabc\n123g", 10, -8, { 0, 1, 30, 15 + 2 }, { 1, 16 } }, 316 { __LINE__, DT_10, "ABCabc\n123g", 10, -8, { 0, 1, 30, 15 + 3 }, { 1, 17 } }, 317 { __LINE__, DT_10, "ABCabc\n123g", 10, -8, { 0, 1, 30, 15 + 4 }, { 1, 18 } }, 318 { __LINE__, DT_10, "ABCabc\n123g", 10, -8, { 0, 1, 30, 15 + 5 }, { 1, 19 } }, 319 { __LINE__, DT_10, "ABCabc\n123g", 20, -8, { 0, 1, 30, 15 + 6 }, { 1, 12 } }, 320 321 { __LINE__, DT_10, "ABCabc\n123g", 11, -9, { 0, 1, 30, 15 - 2 }, { 1, 12 } }, 322 { __LINE__, DT_10, "ABCabc\n123g", 11, -9, { 0, 1, 30, 15 - 1 }, { 1, 13 } }, 323 { __LINE__, DT_10, "ABCabc\n123g", 11, -9, { 0, 1, 30, 15 + 0 }, { 1, 14 } }, 324 { __LINE__, DT_10, "ABCabc\n123g", 11, -9, { 0, 1, 30, 15 + 1 }, { 1, 15 } }, 325 { __LINE__, DT_10, "ABCabc\n123g", 11, -9, { 0, 1, 30, 15 + 2 }, { 1, 16 } }, 326 { __LINE__, DT_10, "ABCabc\n123g", 11, -9, { 0, 1, 30, 15 + 3 }, { 1, 17 } }, 327 { __LINE__, DT_10, "ABCabc\n123g", 11, -9, { 0, 1, 30, 15 + 4 }, { 1, 18 } }, 328 { __LINE__, DT_10, "ABCabc\n123g", 11, -9, { 0, 1, 30, 15 + 5 }, { 1, 19 } }, 329 { __LINE__, DT_10, "ABCabc\n123g", 11, -9, { 0, 1, 30, 15 + 6 }, { 1, 20 } }, 330 331 { __LINE__, DT_10, "ABCabc\n123g", 12, -10, { 0, 1, 30, 15 - 2 }, { 1, 12 } }, 332 { __LINE__, DT_10, "ABCabc\n123g", 12, -10, { 0, 1, 30, 15 - 1 }, { 1, 13 } }, 333 { __LINE__, DT_10, "ABCabc\n123g", 12, -10, { 0, 1, 30, 15 + 0 }, { 1, 14 } }, 334 { __LINE__, DT_10, "ABCabc\n123g", 12, -10, { 0, 1, 30, 15 + 1 }, { 1, 15 } }, 335 { __LINE__, DT_10, "ABCabc\n123g", 12, -10, { 0, 1, 30, 15 + 2 }, { 1, 16 } }, 336 { __LINE__, DT_10, "ABCabc\n123g", 12, -10, { 0, 1, 30, 15 + 3 }, { 1, 17 } }, 337 { __LINE__, DT_10, "ABCabc\n123g", 12, -10, { 0, 1, 30, 15 + 4 }, { 1, 18 } }, 338 { __LINE__, DT_10, "ABCabc\n123g", 12, -10, { 0, 1, 30, 15 + 5 }, { 1, 19 } }, 339 { __LINE__, DT_10, "ABCabc\n123g", 12, -10, { 0, 1, 30, 15 + 6 }, { 1, 20 } }, 340 }; 341 342 static void DoEntry(HDC hdc, const TEST_ENTRY *pEntry) 343 { 344 RECT rc; 345 INT ret; 346 HFONT hFont; 347 HGDIOBJ hFontOld; 348 LONG x, y, yMin, yMax; 349 LOGFONTW lf = { pEntry->font_height }; 350 lstrcpyW(lf.lfFaceName, L"Tahoma"); 351 352 hFont = CreateFontIndirectW(&lf); 353 ok(hFont != NULL, "hFont is NULL\n"); 354 355 hFontOld = SelectObject(hdc, hFont); 356 { 357 rc = pEntry->input; 358 359 if (!(pEntry->uFormat & DT_CALCRECT)) 360 FillRect(hdc, &rc, (HBRUSH)GetStockObject(WHITE_BRUSH)); 361 362 ret = DrawTextA(hdc, pEntry->pszText, -1, &rc, pEntry->uFormat); 363 ok(ret == pEntry->ret, 364 "Line %d: ret %d vs %d\n", pEntry->line, ret, pEntry->ret); 365 366 if (!(pEntry->uFormat & DT_CALCRECT)) 367 { 368 yMin = rc.bottom; 369 yMax = rc.top; 370 for (y = rc.top; y < rc.bottom; ++y) 371 { 372 BOOL bNonWhiteFound = FALSE; 373 for (x = rc.left; x < rc.right; ++x) 374 { 375 if (GetPixel(hdc, x, y) != RGB(255, 255, 255)) 376 { 377 bNonWhiteFound = TRUE; 378 break; 379 } 380 } 381 if (!bNonWhiteFound) 382 { 383 if (yMin > y) 384 yMin = y; 385 if (yMax < y) 386 yMax = y; 387 } 388 } 389 rc.top = yMin; 390 rc.bottom = yMax; 391 } 392 393 ok(rc.top == pEntry->output.top, 394 "Line %d: top %ld vs %ld\n", pEntry->line, rc.top, pEntry->output.top); 395 396 ok(rc.bottom == pEntry->output.bottom, 397 "Line %d: bottom %ld vs %ld\n", pEntry->line, rc.bottom, pEntry->output.bottom); 398 } 399 SelectObject(hdc, hFontOld); 400 DeleteObject(hFont); 401 } 402 403 START_TEST(DrawText) 404 { 405 SIZE_T i; 406 HBITMAP hbm; 407 HGDIOBJ hbmOld; 408 HDC hdc = CreateCompatibleDC(NULL); 409 ok(hdc != NULL, "hdc was NULL\n"); 410 411 hbm = CreateCompatibleBitmap(hdc, 100, 100); 412 hbmOld = SelectObject(hdc, hbm); 413 414 SetTextColor(hdc, RGB(0, 0, 0)); 415 SetBkColor(hdc, RGB(255, 255, 255)); 416 SetBkMode(hdc, OPAQUE); 417 for (i = 0; i < ARRAYSIZE(s_entries); ++i) 418 { 419 DoEntry(hdc, &s_entries[i]); 420 } 421 422 SelectObject(hdc, hbmOld); 423 DeleteObject(hbm); 424 DeleteDC(hdc); 425 } 426