4 * Copyright 2006 Jeff Latimer
5 * Copyright 2006 Hans Leidekker
6 * Copyright 2010 CodeWeavers, Aric Stewart
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 * Uniscribe allows for processing of complex scripts such as joining
24 * and filtering characters and bi-directional text with custom line breaks.
30 #include <wine/test.h>
34 //#include <windows.h>
37 typedef struct _itemTest
{
43 int fOverrideDirection
;
49 typedef struct _shapeTest_char
{
51 SCRIPT_CHARPROP CharProp
;
54 typedef struct _shapeTest_glyph
{
56 SCRIPT_GLYPHPROP GlyphProp
;
59 /* Uniscribe 1.6 calls */
60 static HRESULT (WINAPI
*pScriptItemizeOpenType
)( const WCHAR
*pwcInChars
, int cInChars
, int cMaxItems
, const SCRIPT_CONTROL
*psControl
, const SCRIPT_STATE
*psState
, SCRIPT_ITEM
*pItems
, ULONG
*pScriptTags
, int *pcItems
);
62 static HRESULT (WINAPI
*pScriptShapeOpenType
)( HDC hdc
, SCRIPT_CACHE
*psc
, SCRIPT_ANALYSIS
*psa
, OPENTYPE_TAG tagScript
, OPENTYPE_TAG tagLangSys
, int *rcRangeChars
, TEXTRANGE_PROPERTIES
**rpRangeProperties
, int cRanges
, const WCHAR
*pwcChars
, int cChars
, int cMaxGlyphs
, WORD
*pwLogClust
, SCRIPT_CHARPROP
*pCharProps
, WORD
*pwOutGlyphs
, SCRIPT_GLYPHPROP
*pOutGlyphProps
, int *pcGlyphs
);
64 static DWORD (WINAPI
*pGetGlyphIndicesW
)(HDC hdc
, LPCWSTR lpstr
, INT count
, LPWORD pgi
, DWORD flags
);
66 static HRESULT (WINAPI
*pScriptGetFontScriptTags
)( HDC hdc
, SCRIPT_CACHE
*psc
, SCRIPT_ANALYSIS
*psa
, int cMaxTags
, OPENTYPE_TAG
*pScriptTags
, int *pcTags
);
67 static HRESULT (WINAPI
*pScriptGetFontLanguageTags
)( HDC hdc
, SCRIPT_CACHE
*psc
, SCRIPT_ANALYSIS
*psa
, OPENTYPE_TAG tagScript
, int cMaxTags
, OPENTYPE_TAG
*pLangSysTags
, int *pcTags
);
68 static HRESULT (WINAPI
*pScriptGetFontFeatureTags
)( HDC hdc
, SCRIPT_CACHE
*psc
, SCRIPT_ANALYSIS
*psa
, OPENTYPE_TAG tagScript
, OPENTYPE_TAG tagLangSys
, int cMaxTags
, OPENTYPE_TAG
*pFeatureTags
, int *pcTags
);
70 static inline void _test_items_ok(LPCWSTR string
, DWORD cchString
,
71 SCRIPT_CONTROL
*Control
, SCRIPT_STATE
*State
,
72 DWORD nItems
, const itemTest
* items
, BOOL nItemsToDo
,
73 const INT nItemsBroken
[2])
77 SCRIPT_ITEM outpItems
[15];
78 ULONG tags
[15] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
80 if (pScriptItemizeOpenType
)
81 hr
= pScriptItemizeOpenType(string
, cchString
, 15, Control
, State
, outpItems
, tags
, &outnItems
);
83 hr
= ScriptItemize(string
, cchString
, 15, Control
, State
, outpItems
, &outnItems
);
85 winetest_ok(hr
== S_OK
, "ScriptItemize should return S_OK not %08x\n", hr
);
86 if (nItemsBroken
&& (broken(nItemsBroken
[0] == outnItems
) || broken(nItemsBroken
[1] == outnItems
)))
88 winetest_win_skip("This test broken on this platform\n");
91 todo_wine_if (nItemsToDo
)
92 winetest_ok(outnItems
== nItems
, "Wrong number of items\n");
93 for (x
= 0; x
<= outnItems
; x
++)
95 if (items
[x
].isBroken
&& broken(outpItems
[x
].iCharPos
== items
[x
].broken_value
[0]))
96 winetest_win_skip("This test broken on this platform\n");
97 else todo_wine_if (items
[x
].todo_flag
[0])
98 winetest_ok(outpItems
[x
].iCharPos
== items
[x
].iCharPos
, "%i:Wrong CharPos (%i)\n",x
,outpItems
[x
].iCharPos
);
100 if (items
[x
].isBroken
&& broken(outpItems
[x
].a
.fRTL
== items
[x
].broken_value
[1]))
101 winetest_win_skip("This test broken on this platform\n");
102 else todo_wine_if (items
[x
].todo_flag
[1])
103 winetest_ok(outpItems
[x
].a
.fRTL
== items
[x
].fRTL
, "%i:Wrong fRTL(%i)\n",x
,outpItems
[x
].a
.fRTL
);
105 if (items
[x
].isBroken
&& broken(outpItems
[x
].a
.fLayoutRTL
== items
[x
].broken_value
[2]))
106 winetest_win_skip("This test broken on this platform\n");
107 else todo_wine_if (items
[x
].todo_flag
[2])
108 winetest_ok(outpItems
[x
].a
.fLayoutRTL
== items
[x
].fLayoutRTL
, "%i:Wrong fLayoutRTL(%i)\n",x
,outpItems
[x
].a
.fLayoutRTL
);
110 if (items
[x
].isBroken
&& broken(outpItems
[x
].a
.s
.uBidiLevel
== items
[x
].broken_value
[3]))
111 winetest_win_skip("This test broken on this platform\n");
112 else todo_wine_if (items
[x
].todo_flag
[3])
113 winetest_ok(outpItems
[x
].a
.s
.uBidiLevel
== items
[x
].uBidiLevel
, "%i:Wrong BidiLevel(%i)\n",x
,outpItems
[x
].a
.s
.uBidiLevel
);
115 winetest_ok(outpItems
[x
].a
.eScript
!= SCRIPT_UNDEFINED
, "%i: Undefined script\n",x
);
116 if (pScriptItemizeOpenType
)
118 if (items
[x
].isBroken
&& broken(tags
[x
] == items
[x
].broken_value
[4]))
119 winetest_win_skip("This test broken on this platform\n");
120 else todo_wine_if (items
[x
].todo_flag
[4])
121 winetest_ok(tags
[x
] == items
[x
].scriptTag
,"%i:Incorrect Script Tag %x != %x\n",x
,tags
[x
],items
[x
].scriptTag
);
124 if (items
[x
].isBroken
&& broken(outpItems
[x
].a
.s
.fOverrideDirection
== items
[x
].broken_value
[5]))
125 winetest_win_skip("This test broken on this platform\n");
126 else todo_wine_if (items
[x
].todo_flag
[5])
127 winetest_ok(outpItems
[x
].a
.s
.fOverrideDirection
== items
[x
].fOverrideDirection
, "%i:Wrong fOverrideDirection(%i)\n",x
,outpItems
[x
].a
.s
.fOverrideDirection
);
131 #define test_items_ok(a,b,c,d,e,f,g,h) (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _test_items_ok(a,b,c,d,e,f,g,h)
133 #define MS_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
134 ( ( (ULONG)_x4 << 24 ) | \
135 ( (ULONG)_x3 << 16 ) | \
136 ( (ULONG)_x2 << 8 ) | \
139 #define latn_tag MS_MAKE_TAG('l','a','t','n')
140 #define arab_tag MS_MAKE_TAG('a','r','a','b')
141 #define thai_tag MS_MAKE_TAG('t','h','a','i')
142 #define hebr_tag MS_MAKE_TAG('h','e','b','r')
143 #define syrc_tag MS_MAKE_TAG('s','y','r','c')
144 #define deva_tag MS_MAKE_TAG('d','e','v','a')
145 #define beng_tag MS_MAKE_TAG('b','e','n','g')
146 #define guru_tag MS_MAKE_TAG('g','u','r','u')
147 #define gujr_tag MS_MAKE_TAG('g','u','j','r')
148 #define orya_tag MS_MAKE_TAG('o','r','y','a')
149 #define taml_tag MS_MAKE_TAG('t','a','m','l')
150 #define telu_tag MS_MAKE_TAG('t','e','l','u')
151 #define knda_tag MS_MAKE_TAG('k','n','d','a')
152 #define mlym_tag MS_MAKE_TAG('m','l','y','m')
153 #define mymr_tag MS_MAKE_TAG('m','y','m','r')
154 #define tale_tag MS_MAKE_TAG('t','a','l','e')
155 #define talu_tag MS_MAKE_TAG('t','a','l','u')
156 #define khmr_tag MS_MAKE_TAG('k','h','m','r')
157 #define hani_tag MS_MAKE_TAG('h','a','n','i')
158 #define bopo_tag MS_MAKE_TAG('b','o','p','o')
159 #define kana_tag MS_MAKE_TAG('k','a','n','a')
160 #define hang_tag MS_MAKE_TAG('h','a','n','g')
161 #define yi_tag MS_MAKE_TAG('y','i',' ',' ')
162 #define ethi_tag MS_MAKE_TAG('e','t','h','i')
163 #define mong_tag MS_MAKE_TAG('m','o','n','g')
164 #define tfng_tag MS_MAKE_TAG('t','f','n','g')
165 #define nko_tag MS_MAKE_TAG('n','k','o',' ')
166 #define vai_tag MS_MAKE_TAG('v','a','i',' ')
167 #define cher_tag MS_MAKE_TAG('c','h','e','r')
168 #define cans_tag MS_MAKE_TAG('c','a','n','s')
169 #define ogam_tag MS_MAKE_TAG('o','g','a','m')
170 #define runr_tag MS_MAKE_TAG('r','u','n','r')
171 #define brai_tag MS_MAKE_TAG('b','r','a','i')
172 #define dsrt_tag MS_MAKE_TAG('d','s','r','t')
173 #define osma_tag MS_MAKE_TAG('o','s','m','a')
174 #define math_tag MS_MAKE_TAG('m','a','t','h')
176 static void test_ScriptItemize( void )
178 static const WCHAR test1
[] = {'t', 'e', 's', 't',0};
179 static const itemTest t11
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,-1}};
180 static const itemTest t12
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,-1,FALSE
}};
182 static const WCHAR test1b
[] = {' ', ' ', ' ', ' ',0};
183 static const itemTest t1b1
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,-1,FALSE
}};
184 static const itemTest t1b2
[2] = {{{0,0,0,0,0,0},0,1,1,1,0,0,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,-1,FALSE
}};
186 static const WCHAR test1c
[] = {' ', ' ', ' ', '1', '2', ' ',0};
187 static const itemTest t1c1
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
188 static const itemTest t1c2
[4] = {{{0,0,0,0,0,0},0,1,1,1,0,0,FALSE
},{{0,0,0,0,0,0},3,0,1,2,0,0,FALSE
},{{0,0,0,0,0,0},5,1,1,1,0,0,FALSE
},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
191 static const WCHAR test2
[] = {'1','2','3','-','5','2',0x064a,0x064f,0x0633,0x0627,0x0648,0x0650,0x064a,'7','1','.',0};
192 static const itemTest t21
[7] = {{{0,0,0,0,0,0},0,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},3,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},6,1,1,1,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},13,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},15,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},16,0,0,0,0,-1,FALSE
}};
193 static const itemTest t22
[5] = {{{0,0,0,0,0,0},0,0,0,2,0,0,FALSE
},{{0,0,0,0,0,0},6,1,1,1,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},13,0,1,2,0,0,FALSE
},{{0,0,0,0,0,0},15,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},16,0,0,0,0,-1,FALSE
}};
194 static const itemTest t23
[5] = {{{0,0,0,0,0,0},0,0,1,2,0,0,FALSE
},{{0,0,0,0,0,0},6,1,1,1,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},13,0,1,2,0,0,FALSE
},{{0,0,0,0,0,0},15,1,1,1,0,0,FALSE
},{{0,0,0,0,0,0},16,0,0,0,0,-1,FALSE
}};
195 static const itemTest t24
[5] = {{{0,0,0,0,0,0},0,0,0,0,1,0,FALSE
},
196 {{0,0,0,0,0,0},6,0,0,0,1,arab_tag
,FALSE
},
197 {{0,0,0,0,0,0},13,0,1,0,1,0,FALSE
},
198 {{0,0,0,0,0,0},15,0,0,0,1,0,FALSE
},
199 {{0,0,0,0,0,0},16,0,0,0,0,-1,FALSE
}};
201 static const WCHAR test2b
[] = {'A','B','C','-','D','E','F',' ',0x0621,0x0623,0x0624,0};
202 static const itemTest t2b1
[5] = {{{0,0,0,0,0,0},0,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},3,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},8,1,1,1,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE
}};
203 static const itemTest t2b2
[5] = {{{0,0,0,0,0,0},0,0,0,2,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},3,0,0,2,0,0,FALSE
},{{0,0,0,0,0,0},4,0,0,2,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},7,1,1,1,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE
}};
204 static const itemTest t2b3
[3] = {{{0,0,0,0,0,0},0,0,0,2,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},7,1,1,1,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE
}};
205 static const itemTest t2b4
[5] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag
,FALSE
},
206 {{0,0,0,0,0,0},3,0,0,0,1,0,FALSE
},
207 {{0,0,0,0,0,0},4,0,0,0,1,latn_tag
,FALSE
},
208 {{0,0,0,0,0,0},8,0,0,0,1,arab_tag
,FALSE
},
209 {{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE
}};
210 static const int b2
[2] = {4,4};
213 static const WCHAR test2c
[] = {' ',0x0621,0x0623,0x0624,'A','B','C','-','D','E','F',0};
214 static const itemTest t2c1
[5] = {{{0,0,0,0,0,0},0,1,1,1,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},7,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},8,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE
}};
215 static const itemTest t2c2
[6] = {{{0,0,0,0,0,0},0,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},1,1,1,1,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},7,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},8,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE
}};
216 static const itemTest t2c3
[5] = {{{0,0,0,0,0,0},0,1,1,1,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},4,0,0,2,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},7,0,0,2,0,0,FALSE
},{{0,0,0,0,0,0},8,0,0,2,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE
}};
217 static const itemTest t2c4
[3] = {{{0,0,0,0,0,0},0,1,1,1,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},4,0,0,2,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE
}};
218 static const itemTest t2c5
[5] = {{{0,0,0,0,0,0},0,0,0,0,1,arab_tag
,FALSE
},
219 {{0,0,0,0,0,0},4,0,0,0,1,latn_tag
,FALSE
},
220 {{0,0,0,0,0,0},7,0,0,0,1,0,FALSE
},
221 {{0,0,0,0,0,0},8,0,0,0,1,latn_tag
,FALSE
},
222 {{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE
}};
225 static const WCHAR test2d
[] = {'A','B','C','-','D','E','F',0x0621,0x0623,0x0624,' ',0};
226 static const itemTest t2d1
[5] = {{{0,0,0,0,0,0},0,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},3,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},7,1,1,1,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE
}};
227 static const itemTest t2d2
[6] = {{{0,0,0,0,0,0},0,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},3,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},7,1,1,1,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},10,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE
}};
228 static const itemTest t2d3
[5] = {{{0,0,0,0,0,0},0,0,0,2,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},3,0,0,2,0,0,FALSE
},{{0,0,0,0,0,0},4,0,0,2,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},7,1,1,1,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE
}};
229 static const itemTest t2d4
[3] = {{{0,0,0,0,0,0},0,0,0,2,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},7,1,1,1,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE
}};
230 static const itemTest t2d5
[5] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag
,FALSE
},
231 {{0,0,0,0,0,0},3,0,0,0,1,0,FALSE
},
232 {{0,0,0,0,0,0},4,0,0,0,1,latn_tag
,FALSE
},
233 {{0,0,0,0,0,0},7,0,0,0,1,arab_tag
,FALSE
},
234 {{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE
}};
237 static const WCHAR test3
[] =
238 {0x0e04,0x0e27,0x0e32,0x0e21,0x0e1e,0x0e22,0x0e32,0x0e22,0x0e32, 0x0e21
239 ,0x0e2d,0x0e22,0x0e39,0x0e48,0x0e17,0x0e35,0x0e48,0x0e44,0x0e2b,0x0e19
240 ,0x0e04,0x0e27,0x0e32,0x0e21,0x0e2a, 0x0e33,0x0e40,0x0e23,0x0e47,0x0e08,
241 0x0e2d,0x0e22,0x0e39,0x0e48,0x0e17,0x0e35,0x0e48,0x0e19,0x0e31,0x0e48,0x0e19,0};
243 static const itemTest t31
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,thai_tag
,FALSE
},{{0,0,0,0,0,0},41,0,0,0,0,-1,FALSE
}};
244 static const itemTest t32
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,thai_tag
,FALSE
},{{0,0,0,0,0,0},41,0,0,0,0,-1,FALSE
}};
246 static const WCHAR test4
[] = {'1','2','3','-','5','2',' ','i','s',' ','7','1','.',0};
248 static const itemTest t41
[6] = {{{0,0,0,0,0,0},0,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},3,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},7,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},10,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},12,0,0,0,0,-1,FALSE
}};
249 static const itemTest t42
[5] = {{{0,0,0,0,0,0},0,0,1,2,0,0,FALSE
},{{0,0,0,0,0,0},6,1,1,1,0,0,FALSE
},{{0,0,0,0,0,0},7,0,0,2,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},10,0,0,2,0,0,FALSE
},{{0,0,0,0,0,0},12,0,0,0,0,-1,FALSE
}};
250 static const itemTest t43
[4] = {{{0,0,0,0,0,0},0,0,1,2,0,0,FALSE
},{{0,0,0,0,0,0},6,1,1,1,0,0,FALSE
},{{0,0,0,0,0,0},7,0,0,2,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},12,0,0,0,0,-1,FALSE
}};
251 static const int b43
[2] = {4,4};
254 static const WCHAR test5
[] =
255 {0x0627,0x0644,0x0635,0x0651,0x0650,0x062d,0x0629,0x064f,' ',0x062a,0x064e,
256 0x0627,0x062c,0x064c,' ',0x0639,0x064e,0x0644,0x0649,' ',
257 0x0631,0x064f,0x0624,0x0648,0x0633,0x0650,' ',0x0627,0x0644
258 ,0x0623,0x0635,0x0650,0x062d,0x0651,0x064e,0x0627,0x0621,0x0650,0};
259 static const itemTest t51
[2] = {{{0,0,0,0,0,0},0,1,1,1,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},38,0,0,0,0,-1,FALSE
}};
260 static const itemTest t52
[2] = {{{0,0,0,0,0,0},0,0,0,0,1,arab_tag
,FALSE
},
261 {{0,0,0,0,0,0},38,0,0,0,0,-1,FALSE
}};
265 static const WCHAR test6
[] = {0x05e9, 0x05dc, 0x05d5, 0x05dd, '.',0};
266 static const itemTest t61
[3] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,TRUE
,{-1,0,0,0,-1}},{{0,0,0,0,0,0},4,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
267 static const itemTest t62
[3] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,FALSE
},{{0,0,0,0,0,0},4,1,1,1,0,0,FALSE
},{{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
268 static const itemTest t63
[2] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,FALSE
},{{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
269 static const itemTest t64
[3] = {{{0,0,0,0,0,0},0,0,0,0,1,hebr_tag
,FALSE
},
270 {{0,0,0,0,0,0},4,0,0,0,1,0,FALSE
},
271 {{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
273 static const int b63
[2] = {2,2};
274 static const WCHAR test7
[] = {'p','a','r','t',' ','o','n','e',' ',0x05d7, 0x05dc, 0x05e7, ' ', 0x05e9, 0x05ea, 0x05d9, 0x05d9, 0x05dd, ' ','p','a','r','t',' ','t','h','r','e','e', 0};
275 static const itemTest t71
[4] = {{{0,0,0,0,0,0},0,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},9,1,1,1,0,hebr_tag
,TRUE
,{-1,0,0,0,-1}},{{0,0,0,0,0,0},19,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},29,0,0,0,0,-1,FALSE
}};
276 static const itemTest t72
[4] = {{{0,0,0,0,0,0},0,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},9,1,1,1,0,hebr_tag
,FALSE
},{{0,0,0,0,0,0},18,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},29,0,0,0,0,-1,FALSE
}};
277 static const itemTest t73
[4] = {{{0,0,0,0,0,0},0,0,0,2,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},8,1,1,1,0,hebr_tag
,FALSE
},{{0,0,0,0,0,0},19,0,0,2,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},29,0,0,0,0,-1,FALSE
}};
278 static const itemTest t74
[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag
,FALSE
},
279 {{0,0,0,0,0,0},9,0,0,0,1,hebr_tag
,FALSE
},
280 {{0,0,0,0,0,0},19,0,0,0,1,latn_tag
,FALSE
},
281 {{0,0,0,0,0,0},29,0,0,0,0,-1,FALSE
}};
283 static const WCHAR test8
[] = {0x0633, 0x0644, 0x0627, 0x0645,0};
284 static const itemTest t81
[2] = {{{0,0,0,0,0,0},0,1,1,1,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,-1,FALSE
}};
285 static const itemTest t82
[2] = {{{0,0,0,0,0,0},0,0,0,0,1,arab_tag
,FALSE
},
286 {{0,0,0,0,0,0},4,0,0,0,0,-1,FALSE
}};
288 /* Syriac (Like Arabic )*/
289 static const WCHAR test9
[] = {0x0710, 0x0712, 0x0712, 0x0714, '.',0};
290 static const itemTest t91
[3] = {{{0,0,0,0,0,0},0,1,1,1,0,syrc_tag
,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
291 static const itemTest t92
[3] = {{{0,0,0,0,0,0},0,1,1,1,0,syrc_tag
},{{0,0,0,0,0,0},4,1,1,1,0,0,FALSE
},{{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
292 static const itemTest t93
[2] = {{{0,0,0,0,0,0},0,1,1,1,0,syrc_tag
,FALSE
},{{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
293 static const itemTest t94
[3] = {{{0,0,0,0,0,0},0,0,0,0,1,syrc_tag
,FALSE
},
294 {{0,0,0,0,0,0},4,0,0,0,1,0,FALSE
},
295 {{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
296 static const int b93
[2] = {2,2};
298 static const WCHAR test10
[] = {0x0717, 0x0718, 0x071a, 0x071b,0};
299 static const itemTest t101
[2] = {{{0,0,0,0,0,0},0,1,1,1,0,syrc_tag
,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,-1,FALSE
}};
300 static const itemTest t102
[2] = {{{0,0,0,0,0,0},0,0,0,0,1,syrc_tag
,FALSE
},
301 {{0,0,0,0,0,0},4,0,0,0,0,-1,FALSE
}};
304 static const WCHAR test11
[] = {0x0926, 0x0947, 0x0935, 0x0928, 0x093e, 0x0917, 0x0930, 0x0940};
305 static const itemTest t111
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,deva_tag
,FALSE
},{{0,0,0,0,0,0},8,0,0,0,0,-1,FALSE
}};
306 static const itemTest t112
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,deva_tag
,FALSE
},{{0,0,0,0,0,0},8,0,0,0,0,-1,FALSE
}};
309 static const WCHAR test12
[] = {0x09ac, 0x09be, 0x0982, 0x09b2, 0x09be};
310 static const itemTest t121
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,beng_tag
,FALSE
},{{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
311 static const itemTest t122
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,beng_tag
,FALSE
},{{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
314 static const WCHAR test13
[] = {0x0a17, 0x0a41, 0x0a30, 0x0a2e, 0x0a41, 0x0a16, 0x0a40};
315 static const itemTest t131
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,guru_tag
,FALSE
},{{0,0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
316 static const itemTest t132
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,guru_tag
,FALSE
},{{0,0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
319 static const WCHAR test14
[] = {0x0a97, 0x0ac1, 0x0a9c, 0x0ab0, 0x0abe, 0x0aa4, 0x0ac0};
320 static const itemTest t141
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,gujr_tag
,FALSE
},{{0,0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
321 static const itemTest t142
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,gujr_tag
,FALSE
},{{0,0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
324 static const WCHAR test15
[] = {0x0b13, 0x0b21, 0x0b3c, 0x0b3f, 0x0b06};
325 static const itemTest t151
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,orya_tag
,FALSE
},{{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
326 static const itemTest t152
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,orya_tag
,FALSE
},{{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
329 static const WCHAR test16
[] = {0x0ba4, 0x0bae, 0x0bbf, 0x0bb4, 0x0bcd};
330 static const itemTest t161
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,taml_tag
,FALSE
},{{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
331 static const itemTest t162
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,taml_tag
,FALSE
},{{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
334 static const WCHAR test17
[] = {0x0c24, 0x0c46, 0x0c32, 0x0c41, 0x0c17, 0x0c41};
335 static const itemTest t171
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,telu_tag
,FALSE
},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
336 static const itemTest t172
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,telu_tag
,FALSE
},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
339 static const WCHAR test18
[] = {0x0c95, 0x0ca8, 0x0ccd, 0x0ca8, 0x0ca1};
340 static const itemTest t181
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,knda_tag
,FALSE
},{{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
341 static const itemTest t182
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,knda_tag
,FALSE
},{{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
344 static const WCHAR test19
[] = {0x0d2e, 0x0d32, 0x0d2f, 0x0d3e, 0x0d33, 0x0d02};
345 static const itemTest t191
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,mlym_tag
,FALSE
},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
346 static const itemTest t192
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,mlym_tag
,FALSE
},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
349 static const WCHAR test20
[] = {0x0309,'a','b','c','d',0};
350 static const itemTest t201
[3] = {{{0,0,0,0,0,0},0,0,0,0,0x0,0,FALSE
},{{0,0,0,0,0,0},1,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
351 static const itemTest t202
[3] = {{{0,0,0,0,0,0},0,0,0,2,0,0,TRUE
,{-1,1,1,1,-1}},{{0,0,0,0,0,0},1,0,0,2,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
353 static const WCHAR test21
[] = {0x0710, 0x0712, 0x0308, 0x0712, 0x0714,0};
354 static const itemTest t211
[2] = {{{0,0,0,0,0,0},0,1,1,1,0,syrc_tag
,FALSE
},{{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
355 static const itemTest t212
[2] = {{{0,0,0,0,0,0},0,0,0,0,1,syrc_tag
,FALSE
},
356 {{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
358 /* Latin Punctuation */
359 static const WCHAR test22
[] = {'#','$',',','!','\"','*',0};
360 static const itemTest t221
[3] = {{{0,0,0,0,0,0},0,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},3,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
361 static const itemTest t222
[3] = {{{0,0,0,0,0,0},0,1,1,1,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},3,1,1,1,0,0,FALSE
},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
362 static const itemTest t223
[2] = {{{0,0,0,0,0,0},0,1,1,1,0,latn_tag
,FALSE
},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
363 static const int b222
[2] = {1,1};
364 static const int b223
[2] = {2,2};
367 static const WCHAR test23
[] = {'1','2','3',0x00b2,0x00b3,0x2070,0};
368 static const itemTest t231
[3] = {{{0,0,0,0,0,0},0,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},3,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
369 static const itemTest t232
[3] = {{{0,0,0,0,0,0},0,0,1,2,0,0,FALSE
},{{0,0,0,0,0,0},3,0,1,2,0,0,FALSE
},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
372 static const WCHAR test24
[] = {0x1019,0x103c,0x1014,0x103a,0x1019,0x102c,0x1021,0x1000,0x1039,0x1001,0x101b,0x102c};
373 static const itemTest t241
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,mymr_tag
,FALSE
},{{0,0,0,0,0,0},12,0,0,0,0,-1,FALSE
}};
374 static const itemTest t242
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,mymr_tag
,TRUE
,{-1,1,1,1,-1}},{{0,0,0,0,0,0},12,0,0,0,0,-1,FALSE
}};
377 static const WCHAR test25
[] = {0x1956,0x196d,0x1970,0x1956,0x196c,0x1973,0x1951,0x1968,0x1952,0x1970};
378 static const itemTest t251
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,tale_tag
,TRUE
,{-1,-1,-1,-1,latn_tag
}},{{0,0,0,0,0,0},10,0,0,0,0,-1,FALSE
}};
379 static const itemTest t252
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,tale_tag
,TRUE
,{-1,1,1,1,latn_tag
}},{{0,0,0,0,0,0},10,0,0,0,0,-1,FALSE
}};
382 static const WCHAR test26
[] = {0x1992,0x19c4};
383 static const itemTest t261
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,talu_tag
,TRUE
,{-1,-1,-1,-1,latn_tag
}},{{0,0,0,0,0,0},2,0,0,0,0,-1,FALSE
}};
384 static const itemTest t262
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,talu_tag
,TRUE
,{-1,1,1,1,latn_tag
}},{{0,0,0,0,0,0},2,0,0,0,0,-1,FALSE
}};
387 static const WCHAR test27
[] = {0x1781,0x17c1,0x1798,0x179a,0x1797,0x17b6,0x179f,0x17b6};
388 static const itemTest t271
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,khmr_tag
,FALSE
},{{0,0,0,0,0,0},8,0,0,0,0,-1,FALSE
}};
389 static const itemTest t272
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,khmr_tag
,TRUE
,{-1,1,1,1,-1}},{{0,0,0,0,0,0},8,0,0,0,0,-1,FALSE
}};
392 static const WCHAR test28
[] = {0x8bed,0x7d20,0x6587,0x5b57};
393 static const itemTest t281
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,hani_tag
,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,-1,FALSE
}};
394 static const itemTest t282
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,hani_tag
,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,-1,FALSE
}};
397 static const WCHAR test29
[] = {0x2ff0,0x2ff3,0x2ffb,0x2ff0,0x65e5,0x65e5,0x5de5,0x7f51,0x4e02,0x4e5e};
398 static const itemTest t291
[3] = {{{0,0,0,0,0,0},0,0,0,0,0,hani_tag
,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,hani_tag
,FALSE
},{{0,0,0,0,0,0},10,0,0,0,0,-1,FALSE
}};
399 static const itemTest t292
[3] = {{{0,0,0,0,0,0},0,1,1,1,0,hani_tag
,FALSE
},{{0,0,0,0,0,0},4,0,0,2,0,hani_tag
,FALSE
},{{0,0,0,0,0,0},10,0,0,0,0,-1,FALSE
}};
402 static const WCHAR test30
[] = {0x3113,0x3128,0x3127,0x3123,0x3108,0x3128,0x310f,0x3120};
403 static const itemTest t301
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,bopo_tag
,FALSE
},{{0,0,0,0,0,0},8,0,0,0,0,-1,FALSE
}};
404 static const itemTest t302
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,bopo_tag
,FALSE
},{{0,0,0,0,0,0},8,0,0,0,0,-1,FALSE
}};
407 static const WCHAR test31
[] = {0x3072,0x3089,0x304b,0x306a,0x30ab,0x30bf,0x30ab,0x30ca};
408 static const itemTest t311
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,kana_tag
,FALSE
},{{0,0,0,0,0,0},8,0,0,0,0,-1,FALSE
}};
409 static const itemTest t312
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,kana_tag
,FALSE
},{{0,0,0,0,0,0},8,0,0,0,0,-1,FALSE
}};
410 static const int b311
[2] = {2,2};
411 static const int b312
[2] = {2,2};
414 static const WCHAR test32
[] = {0xd55c,0xad6d,0xc5b4};
415 static const itemTest t321
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,hang_tag
,FALSE
},{{0,0,0,0,0,0},3,0,0,0,0,-1,FALSE
}};
416 static const itemTest t322
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,hang_tag
,FALSE
},{{0,0,0,0,0,0},3,0,0,0,0,-1,FALSE
}};
419 static const WCHAR test33
[] = {0xa188,0xa320,0xa071,0xa0b7};
420 static const itemTest t331
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,yi_tag
,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,-1,FALSE
}};
421 static const itemTest t332
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,yi_tag
,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,-1,FALSE
}};
424 static const WCHAR test34
[] = {0x130d,0x12d5,0x12dd};
425 static const itemTest t341
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,ethi_tag
,FALSE
},{{0,0,0,0,0,0},3,0,0,0,0,-1,FALSE
}};
426 static const itemTest t342
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,ethi_tag
,FALSE
},{{0,0,0,0,0,0},3,0,0,0,0,-1,FALSE
}};
427 static const int b342
[2] = {2,2};
430 static const WCHAR test35
[] = {0x182e,0x1823,0x1829,0x182d,0x1823,0x182f,0x0020,0x182a,0x1822,0x1834,0x1822,0x182d,0x180c};
431 static const itemTest t351
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,mong_tag
,FALSE
},{{0,0,0,0,0,0},13,0,0,0,0,-1,FALSE
}};
432 static const int b351
[2] = {2,2};
433 static const itemTest t352
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,mong_tag
,TRUE
,{-1,1,1,1,-1}},{{0,0,0,0,0,0},13,0,0,0,0,-1,FALSE
}};
434 static const int b352
[2] = {2,3};
435 static const itemTest t353
[2] = {{{0,0,0,0,0,1},0,0,0,0,1,mong_tag
,TRUE
,{0,0,0,0,0}},{{0,0,0,0,0,0},13,0,0,0,0,-1,FALSE
}};
438 static const WCHAR test36
[] = {0x2d5c,0x2d49,0x2d3c,0x2d49,0x2d4f,0x2d30,0x2d56};
439 static const itemTest t361
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,tfng_tag
,TRUE
,{-1,-1,-1,-1,latn_tag
}},{{0,0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
440 static const itemTest t362
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,tfng_tag
,TRUE
,{-1,1,1,1,latn_tag
}},{{0,0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
443 static const WCHAR test37
[] = {0x07d2,0x07de,0x07cf};
444 static const itemTest t371
[2] = {{{0,0,0,0,0,0},0,1,1,1,0,nko_tag
,TRUE
,{-1,0,0,0,arab_tag
,0}},{{0,0,0,0,0,0},3,0,0,0,0,-1,FALSE
}};
445 static const itemTest t372
[2] = {{{0,0,0,0,0,0},0,1,1,1,0,nko_tag
,TRUE
,{-1,0,0,2,arab_tag
,0}},{{0,0,0,0,0,0},3,0,0,0,0,-1,FALSE
}};
446 static const itemTest t373
[2] = {{{0,0,0,0,0,0},0,0,0,0,1,nko_tag
,TRUE
,{-1,0,0,2,arab_tag
,0}}, {{0,0,0,0,0,0},3,0,0,0,0,-1,FALSE
}};
449 static const WCHAR test38
[] = {0xa559,0xa524};
450 static const itemTest t381
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,vai_tag
,TRUE
,{-1,-1,-1,-1,latn_tag
}},{{0,0,0,0,0,0},2,0,0,0,0,-1,FALSE
}};
451 static const itemTest t382
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,vai_tag
,TRUE
,{-1,1,1,1,latn_tag
}},{{0,0,0,0,0,0},2,0,0,0,0,-1,FALSE
}};
454 static const WCHAR test39
[] = {0x13e3,0x13b3,0x13a9,0x0020,0x13a6,0x13ec,0x13c2,0x13af,0x13cd,0x13d7};
455 static const itemTest t391
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,cher_tag
,FALSE
},{{0,0,0,0,0,0},10,0,0,0,0,-1,FALSE
}};
456 static const itemTest t392
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,cher_tag
,TRUE
,{-1,1,1,1,-1}},{{0,0,0,0,0,0},10,0,0,0,0,-1,FALSE
}};
458 /* Canadian Aboriginal Syllabics */
459 static const WCHAR test40
[] = {0x1403,0x14c4,0x1483,0x144e,0x1450,0x1466};
460 static const itemTest t401
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,cans_tag
,FALSE
},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
461 static const itemTest t402
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,cans_tag
,TRUE
,{-1,1,1,1,-1}},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
464 static const WCHAR test41
[] = {0x169b,0x1691,0x168c,0x1690,0x168b,0x169c};
465 static const itemTest t411
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,ogam_tag
,FALSE
},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
466 static const itemTest t412
[4] = {{{0,0,0,0,0,0},0,1,1,1,0,ogam_tag
,FALSE
},{{0,0,0,0,0,0},1,0,0,2,0,ogam_tag
,FALSE
},{{0,0,0,0,0,0},5,1,1,1,0,ogam_tag
,FALSE
},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
467 static const int b412
[2] = {1,1};
470 static const WCHAR test42
[] = {0x16a0,0x16a1,0x16a2,0x16a3,0x16a4,0x16a5};
471 static const itemTest t421
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,runr_tag
,FALSE
},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
472 static const itemTest t422
[4] = {{{0,0,0,0,0,0},0,0,0,2,0,runr_tag
,TRUE
,{-1,1,1,1,-1}},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
475 static const WCHAR test43
[] = {0x280f,0x2817,0x2811,0x280d,0x280a,0x2811,0x2817};
476 static const itemTest t431
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,brai_tag
,FALSE
},{{0,0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
477 static const itemTest t432
[4] = {{{0,0,0,0,0,0},0,0,0,2,0,brai_tag
,TRUE
,{-1,1,1,1,-1}},{{0,0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
479 /* Private and Surrogates Area */
480 static const WCHAR test44
[] = {0xe000, 0xe001, 0xd800, 0xd801};
481 static const itemTest t441
[3] = {{{0,0,0,0,0,0},0,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},2,0,0,0,0,0,FALSE
},{{0,0,0,0,0,0},4,0,0,0,0,-1,FALSE
}};
482 static const itemTest t442
[4] = {{{0,0,0,0,0,0},0,0,0,2,0,0,TRUE
,{-1,1,1,1,-1}},{{0,0,0,0,0,0},2,0,0,2,0,0,TRUE
,{-1,1,1,1,-1}},{{0,0,0,0,0,0},4,0,0,0,0,-1,FALSE
}};
485 static const WCHAR test45
[] = {0xd801,0xdc19,0xd801,0xdc32,0xd801,0xdc4c,0xd801,0xdc3c,0xd801,0xdc32,0xd801,0xdc4b,0xd801,0xdc2f,0xd801,0xdc4c,0xd801,0xdc3b,0xd801,0xdc32,0xd801,0xdc4a,0xd801,0xdc28};
486 static const itemTest t451
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,dsrt_tag
,TRUE
,{-1,-1,-1,-1,0x0}},{{0,0,0,0,0,0},24,0,0,0,0,-1,FALSE
}};
487 static const itemTest t452
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,dsrt_tag
,TRUE
,{-1,1,1,1,0x0}},{{0,0,0,0,0,0},24,0,0,0,0,-1,FALSE
}};
490 static const WCHAR test46
[] = {0xd801,0xdc8b,0xd801,0xdc98,0xd801,0xdc88,0xd801,0xdc91,0xd801,0xdc9b,0xd801,0xdc92,0xd801,0xdc95,0xd801,0xdc80};
491 static const itemTest t461
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,osma_tag
,TRUE
,{-1,-1,-1,-1,0x0}},{{0,0,0,0,0,0},16,0,0,0,0,-1,FALSE
}};
492 static const itemTest t462
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,osma_tag
,TRUE
,{-1,1,1,1,0x0}},{{0,0,0,0,0,0},16,0,0,0,0,-1,FALSE
}};
494 /* Mathematical Alphanumeric Symbols */
495 static const WCHAR test47
[] = {0xd835,0xdc00,0xd835,0xdc35,0xd835,0xdc6a,0xd835,0xdc9f,0xd835,0xdcd4,0xd835,0xdd09,0xd835,0xdd3e,0xd835,0xdd73,0xd835,0xdda8,0xd835,0xdddd,0xd835,0xde12,0xd835,0xde47,0xd835,0xde7c};
496 static const itemTest t471
[2] = {{{0,0,0,0,0,0},0,0,0,0,0,math_tag
,TRUE
,{-1,-1,-1,-1,0x0}},{{0,0,0,0,0,0},26,0,0,0,0,-1,FALSE
}};
497 static const itemTest t472
[2] = {{{0,0,0,0,0,0},0,0,0,2,0,math_tag
,TRUE
,{-1,1,1,1,0x0}},{{0,0,0,0,0,0},26,0,0,0,0,-1,FALSE
}};
499 /* Mathematical and Numeric combinations */
500 /* These have a leading hebrew character to force complicated itemization */
501 static const WCHAR test48
[] = {0x05e9,' ','1','2','3','.'};
502 static const itemTest t481
[4] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,FALSE
},
503 {{0,0,0,0,0},2,0,1,2,0,0,FALSE
},{{0,0,0,0,0},5,0,0,0,0,0,FALSE
},
504 {{0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
505 static const itemTest t482
[4] = {{{0,0,0,0,0,0},0,0,0,0,1,hebr_tag
,FALSE
},
506 {{0,0,0,0,0,0},2,0,1,0,1,0,FALSE
},
507 {{0,0,0,0,0,0},5,0,0,0,1,0,FALSE
},
508 {{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
510 static const WCHAR test49
[] = {0x05e9,' ','1','2','.','1','2'};
511 static const itemTest t491
[3] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,FALSE
},
512 {{0,0,0,0,0},2,0,1,2,0,0,FALSE
},{{0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
513 static const itemTest t492
[3] = {{{0,0,0,0,0,0},0,0,0,0,1,hebr_tag
,FALSE
},
514 {{0,0,0,0,0,0},2,0,1,0,1,0,FALSE
},
515 {{0,0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
517 static const WCHAR test50
[] = {0x05e9,' ','.','1','2','3'};
518 static const itemTest t501
[4] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,FALSE
},
519 {{0,0,0,0,0},2,1,1,1,0,0,FALSE
},{{0,0,0,0,0},3,0,1,2,0,0,FALSE
},
520 {{0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
521 static const itemTest t502
[4] = {{{0,0,0,0,0,0},0,0,0,0,1,hebr_tag
,FALSE
},
522 {{0,0,0,0,0,0},2,0,0,0,1,0,FALSE
},
523 {{0,0,0,0,0,0},3,0,1,0,1,0,FALSE
},
524 {{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
526 static const WCHAR test51
[] = {0x05e9,' ','a','b','.','1','2'};
527 static const itemTest t511
[5] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,FALSE
},
528 {{0,0,0,0,0},1,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0},4,0,0,0,0,0,FALSE
},
529 {{0,0,0,0,0},5,0,0,2,0,0,FALSE
},{{0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
530 static const itemTest t512
[5] = {{{0,0,0,0,0,0},0,0,0,0,1,hebr_tag
,FALSE
},
531 {{0,0,0,0,0,0},2,0,0,0,1,latn_tag
,FALSE
},
532 {{0,0,0,0,0,0},4,0,0,0,1,0,FALSE
},
533 {{0,0,0,0,0,0},5,0,0,0,1,0,FALSE
},
534 {{0,0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
536 static const WCHAR test52
[] = {0x05e9,' ','1','2','.','a','b'};
537 static const itemTest t521
[5] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,FALSE
},
538 {{0,0,0,0,0},2,0,1,2,0,0,FALSE
},{{0,0,0,0,0},4,0,0,0,0,0,FALSE
},
539 {{0,0,0,0,0},5,0,0,0,0,latn_tag
,FALSE
},{{0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
540 static const itemTest t522
[5] = {{{0,0,0,0,0,0},0,0,0,0,1,hebr_tag
,FALSE
},
541 {{0,0,0,0,0,0},2,0,1,0,1,0,FALSE
},
542 {{0,0,0,0,0,0},4,0,0,0,1,0,FALSE
},
543 {{0,0,0,0,0,0},5,0,0,0,1,latn_tag
,FALSE
},
544 {{0,0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
546 static const WCHAR test53
[] = {0x05e9,' ','1','2','.','.','1','2'};
547 static const itemTest t531
[5] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,FALSE
},
548 {{0,0,0,0,0},2,0,1,2,0,0,FALSE
},{{0,0,0,0,0},4,1,1,1,0,0,FALSE
},
549 {{0,0,0,0,0},6,0,1,2,0,0,FALSE
},{{0,0,0,0,0},8,0,0,0,0,-1,FALSE
}};
550 static const itemTest t532
[5] = {{{0,0,0,0,0,0},0,0,0,0,1,hebr_tag
,FALSE
},
551 {{0,0,0,0,0,0},2,0,1,0,1,0,FALSE
},
552 {{0,0,0,0,0,0},4,0,0,0,1,0,FALSE
},
553 {{0,0,0,0,0,0},6,0,1,0,1,0,FALSE
},
554 {{0,0,0,0,0,0},8,0,0,0,0,-1,FALSE
}};
556 static const WCHAR test54
[] = {0x05e9,' ','1','2','+','1','2'};
557 static const itemTest t541
[3] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,FALSE
},
558 {{0,0,0,0,0},2,0,1,2,0,0,FALSE
},{{0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
559 static const itemTest t542
[3] = {{{0,0,0,0,0,0},0,0,0,0,1,hebr_tag
,FALSE
},
560 {{0,0,0,0,0,0},2,0,1,0,1,0,FALSE
},
561 {{0,0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
562 static const WCHAR test55
[] = {0x05e9,' ','1','2','+','+','1','2'};
563 static const itemTest t551
[3] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,FALSE
},
564 {{0,0,0,0,0},2,0,1,2,0,0,FALSE
},{{0,0,0,0,0},8,0,0,0,0,-1,FALSE
}};
565 static const itemTest t552
[3] = {{{0,0,0,0,0,0},0,0,0,0,1,hebr_tag
,FALSE
},
566 {{0,0,0,0,0,0},2,0,1,0,1,0,FALSE
},
567 {{0,0,0,0,0,0},8,0,0,0,0,-1,FALSE
}};
570 static const WCHAR test56
[] = {0x0645, 0x06cc, 0x200c, 0x06a9, 0x0646, 0x0645}; /* می‌کنم */
571 static const itemTest t561
[] = {{{0,0,0,0,0,0},0,1,1,1,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
572 static const itemTest t562
[] = {{{0,0,0,0,0,0},0,0,0,0,1,arab_tag
,FALSE
},{{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
574 SCRIPT_ITEM items
[15];
575 SCRIPT_CONTROL Control
;
581 usp10
= LoadLibraryA("usp10.dll");
582 ok (usp10
!= 0,"Unable to LoadLibrary on usp10.dll\n");
583 pScriptItemizeOpenType
= (void*)GetProcAddress(usp10
, "ScriptItemizeOpenType");
584 pScriptShapeOpenType
= (void*)GetProcAddress(usp10
, "ScriptShapeOpenType");
585 pGetGlyphIndicesW
= (void*)GetProcAddress(GetModuleHandleA("gdi32.dll"), "GetGlyphIndicesW");
587 memset(&Control
, 0, sizeof(Control
));
588 memset(&State
, 0, sizeof(State
));
590 hr
= ScriptItemize(NULL
, 4, 10, &Control
, &State
, items
, NULL
);
591 ok (hr
== E_INVALIDARG
, "ScriptItemize should return E_INVALIDARG if pwcInChars is NULL\n");
593 hr
= ScriptItemize(test1
, 4, 10, &Control
, &State
, NULL
, NULL
);
594 ok (hr
== E_INVALIDARG
, "ScriptItemize should return E_INVALIDARG if pItems is NULL\n");
596 hr
= ScriptItemize(test1
, 4, 1, &Control
, &State
, items
, NULL
);
597 ok (hr
== E_INVALIDARG
, "ScriptItemize should return E_INVALIDARG if cMaxItems < 2.\n");
599 hr
= ScriptItemize(test1
, 0, 10, NULL
, NULL
, items
, &nItems
);
600 ok (hr
== E_INVALIDARG
, "ScriptItemize should return E_INVALIDARG if cInChars is 0\n");
602 test_items_ok(test1
,4,NULL
,NULL
,1,t11
,FALSE
,0);
603 test_items_ok(test1b
,4,NULL
,NULL
,1,t1b1
,FALSE
,0);
604 test_items_ok(test1c
,6,NULL
,NULL
,1,t1c1
,FALSE
,0);
605 test_items_ok(test2
,16,NULL
,NULL
,6,t21
,FALSE
,0);
606 test_items_ok(test2b
,11,NULL
,NULL
,4,t2b1
,FALSE
,0);
607 test_items_ok(test2c
,11,NULL
,NULL
,4,t2c1
,FALSE
,0);
608 test_items_ok(test2d
,11,NULL
,NULL
,4,t2d1
,FALSE
,0);
609 test_items_ok(test3
,41,NULL
,NULL
,1,t31
,FALSE
,0);
610 test_items_ok(test4
,12,NULL
,NULL
,5,t41
,FALSE
,0);
611 test_items_ok(test5
,38,NULL
,NULL
,1,t51
,FALSE
,0);
612 test_items_ok(test6
,5,NULL
,NULL
,2,t61
,FALSE
,0);
613 test_items_ok(test7
,29,NULL
,NULL
,3,t71
,FALSE
,0);
614 test_items_ok(test8
,4,NULL
,NULL
,1,t81
,FALSE
,0);
615 test_items_ok(test9
,5,NULL
,NULL
,2,t91
,FALSE
,0);
616 test_items_ok(test10
,4,NULL
,NULL
,1,t101
,FALSE
,0);
617 test_items_ok(test11
,8,NULL
,NULL
,1,t111
,FALSE
,0);
618 test_items_ok(test12
,5,NULL
,NULL
,1,t121
,FALSE
,0);
619 test_items_ok(test13
,7,NULL
,NULL
,1,t131
,FALSE
,0);
620 test_items_ok(test14
,7,NULL
,NULL
,1,t141
,FALSE
,0);
621 test_items_ok(test15
,5,NULL
,NULL
,1,t151
,FALSE
,0);
622 test_items_ok(test16
,5,NULL
,NULL
,1,t161
,FALSE
,0);
623 test_items_ok(test17
,6,NULL
,NULL
,1,t171
,FALSE
,0);
624 test_items_ok(test18
,5,NULL
,NULL
,1,t181
,FALSE
,0);
625 test_items_ok(test19
,6,NULL
,NULL
,1,t191
,FALSE
,0);
626 test_items_ok(test20
,5,NULL
,NULL
,2,t201
,FALSE
,0);
627 test_items_ok(test21
,5,NULL
,NULL
,1,t211
,FALSE
,0);
628 test_items_ok(test22
,6,NULL
,NULL
,2,t221
,FALSE
,0);
629 test_items_ok(test23
,6,NULL
,NULL
,2,t231
,FALSE
,0);
630 test_items_ok(test24
,12,NULL
,NULL
,1,t241
,FALSE
,0);
631 test_items_ok(test25
,10,NULL
,NULL
,1,t251
,FALSE
,0);
632 test_items_ok(test26
,2,NULL
,NULL
,1,t261
,FALSE
,0);
633 test_items_ok(test27
,8,NULL
,NULL
,1,t271
,FALSE
,0);
634 test_items_ok(test28
,4,NULL
,NULL
,1,t281
,FALSE
,0);
635 test_items_ok(test29
,10,NULL
,NULL
,2,t291
,FALSE
,0);
636 test_items_ok(test30
,8,NULL
,NULL
,1,t301
,FALSE
,0);
637 test_items_ok(test31
,8,NULL
,NULL
,1,t311
,FALSE
,b311
);
638 test_items_ok(test32
,3,NULL
,NULL
,1,t321
,FALSE
,0);
639 test_items_ok(test33
,4,NULL
,NULL
,1,t331
,FALSE
,0);
640 test_items_ok(test34
,3,NULL
,NULL
,1,t341
,FALSE
,0);
641 test_items_ok(test35
,13,NULL
,NULL
,1,t351
,FALSE
,b351
);
642 test_items_ok(test36
,7,NULL
,NULL
,1,t361
,FALSE
,0);
643 test_items_ok(test37
,3,NULL
,NULL
,1,t371
,FALSE
,0);
644 test_items_ok(test38
,2,NULL
,NULL
,1,t381
,FALSE
,0);
645 test_items_ok(test39
,10,NULL
,NULL
,1,t391
,FALSE
,0);
646 test_items_ok(test40
,6,NULL
,NULL
,1,t401
,FALSE
,0);
647 test_items_ok(test41
,6,NULL
,NULL
,1,t411
,FALSE
,0);
648 test_items_ok(test42
,6,NULL
,NULL
,1,t421
,FALSE
,0);
649 test_items_ok(test43
,7,NULL
,NULL
,1,t431
,FALSE
,0);
650 test_items_ok(test44
,4,NULL
,NULL
,2,t441
,FALSE
,0);
651 test_items_ok(test45
,24,NULL
,NULL
,1,t451
,FALSE
,0);
652 test_items_ok(test46
,16,NULL
,NULL
,1,t461
,FALSE
,0);
653 test_items_ok(test47
,26,NULL
,NULL
,1,t471
,FALSE
,0);
654 test_items_ok(test56
,6,NULL
,NULL
,1,t561
,FALSE
,0);
656 State
.uBidiLevel
= 0;
657 test_items_ok(test1
,4,&Control
,&State
,1,t11
,FALSE
,0);
658 test_items_ok(test1b
,4,&Control
,&State
,1,t1b1
,FALSE
,0);
659 test_items_ok(test1c
,6,&Control
,&State
,1,t1c1
,FALSE
,0);
660 test_items_ok(test2
,16,&Control
,&State
,4,t22
,FALSE
,0);
661 test_items_ok(test2b
,11,&Control
,&State
,4,t2b1
,FALSE
,0);
662 test_items_ok(test2c
,11,&Control
,&State
,5,t2c2
,FALSE
,0);
663 test_items_ok(test2d
,11,&Control
,&State
,5,t2d2
,FALSE
,0);
664 test_items_ok(test3
,41,&Control
,&State
,1,t31
,FALSE
,0);
665 test_items_ok(test4
,12,&Control
,&State
,5,t41
,FALSE
,0);
666 test_items_ok(test5
,38,&Control
,&State
,1,t51
,FALSE
,0);
667 test_items_ok(test6
,5,&Control
,&State
,2,t61
,FALSE
,0);
668 test_items_ok(test7
,29,&Control
,&State
,3,t72
,FALSE
,0);
669 test_items_ok(test8
,4,&Control
,&State
,1,t81
,FALSE
,0);
670 test_items_ok(test9
,5,&Control
,&State
,2,t91
,FALSE
,0);
671 test_items_ok(test10
,4,&Control
,&State
,1,t101
,FALSE
,0);
672 test_items_ok(test11
,8,&Control
,&State
,1,t111
,FALSE
,0);
673 test_items_ok(test12
,5,&Control
,&State
,1,t121
,FALSE
,0);
674 test_items_ok(test13
,7,&Control
,&State
,1,t131
,FALSE
,0);
675 test_items_ok(test14
,7,&Control
,&State
,1,t141
,FALSE
,0);
676 test_items_ok(test15
,5,&Control
,&State
,1,t151
,FALSE
,0);
677 test_items_ok(test16
,5,&Control
,&State
,1,t161
,FALSE
,0);
678 test_items_ok(test17
,6,&Control
,&State
,1,t171
,FALSE
,0);
679 test_items_ok(test18
,5,&Control
,&State
,1,t181
,FALSE
,0);
680 test_items_ok(test19
,6,&Control
,&State
,1,t191
,FALSE
,0);
681 test_items_ok(test20
,5,&Control
,&State
,2,t201
,FALSE
,0);
682 test_items_ok(test21
,5,&Control
,&State
,1,t211
,FALSE
,0);
683 test_items_ok(test22
,6,&Control
,&State
,2,t221
,FALSE
,0);
684 test_items_ok(test23
,6,&Control
,&State
,2,t231
,FALSE
,0);
685 test_items_ok(test24
,12,&Control
,&State
,1,t241
,FALSE
,0);
686 test_items_ok(test25
,10,&Control
,&State
,1,t251
,FALSE
,0);
687 test_items_ok(test26
,2,&Control
,&State
,1,t261
,FALSE
,0);
688 test_items_ok(test27
,8,&Control
,&State
,1,t271
,FALSE
,0);
689 test_items_ok(test28
,4,&Control
,&State
,1,t281
,FALSE
,0);
690 test_items_ok(test29
,10,&Control
,&State
,2,t291
,FALSE
,0);
691 test_items_ok(test30
,8,&Control
,&State
,1,t301
,FALSE
,0);
692 test_items_ok(test31
,8,&Control
,&State
,1,t311
,FALSE
,b311
);
693 test_items_ok(test32
,3,&Control
,&State
,1,t321
,FALSE
,0);
694 test_items_ok(test33
,4,&Control
,&State
,1,t331
,FALSE
,0);
695 test_items_ok(test34
,3,&Control
,&State
,1,t341
,FALSE
,0);
696 test_items_ok(test35
,13,&Control
,&State
,1,t351
,FALSE
,b351
);
697 test_items_ok(test36
,7,&Control
,&State
,1,t361
,FALSE
,0);
698 test_items_ok(test37
,3,&Control
,&State
,1,t371
,FALSE
,0);
699 test_items_ok(test38
,2,&Control
,&State
,1,t381
,FALSE
,0);
700 test_items_ok(test39
,10,&Control
,&State
,1,t391
,FALSE
,0);
701 test_items_ok(test40
,6,&Control
,&State
,1,t401
,FALSE
,0);
702 test_items_ok(test41
,6,&Control
,&State
,1,t411
,FALSE
,0);
703 test_items_ok(test42
,6,&Control
,&State
,1,t421
,FALSE
,0);
704 test_items_ok(test43
,7,&Control
,&State
,1,t431
,FALSE
,0);
705 test_items_ok(test44
,4,&Control
,&State
,2,t441
,FALSE
,0);
706 test_items_ok(test45
,24,&Control
,&State
,1,t451
,FALSE
,0);
707 test_items_ok(test46
,16,&Control
,&State
,1,t461
,FALSE
,0);
708 test_items_ok(test47
,26,&Control
,&State
,1,t471
,FALSE
,0);
709 test_items_ok(test48
,6,&Control
,&State
,3,t481
,FALSE
,0);
710 test_items_ok(test49
,7,&Control
,&State
,2,t491
,FALSE
,0);
711 test_items_ok(test50
,6,&Control
,&State
,3,t501
,FALSE
,0);
712 test_items_ok(test51
,7,&Control
,&State
,4,t511
,FALSE
,0);
713 test_items_ok(test52
,7,&Control
,&State
,4,t521
,FALSE
,0);
714 test_items_ok(test53
,8,&Control
,&State
,4,t531
,FALSE
,0);
715 test_items_ok(test54
,7,&Control
,&State
,2,t541
,FALSE
,0);
716 test_items_ok(test55
,8,&Control
,&State
,2,t551
,FALSE
,0);
717 test_items_ok(test56
,6,&Control
,&State
,1,t561
,FALSE
,0);
719 State
.uBidiLevel
= 1;
720 test_items_ok(test1
,4,&Control
,&State
,1,t12
,FALSE
,0);
721 test_items_ok(test1b
,4,&Control
,&State
,1,t1b2
,FALSE
,0);
722 test_items_ok(test1c
,6,&Control
,&State
,3,t1c2
,FALSE
,0);
723 test_items_ok(test2
,16,&Control
,&State
,4,t23
,FALSE
,0);
724 test_items_ok(test2b
,11,&Control
,&State
,4,t2b2
,FALSE
,0);
725 test_items_ok(test2c
,11,&Control
,&State
,4,t2c3
,FALSE
,0);
726 test_items_ok(test2d
,11,&Control
,&State
,4,t2d3
,FALSE
,0);
727 test_items_ok(test3
,41,&Control
,&State
,1,t32
,FALSE
,0);
728 test_items_ok(test4
,12,&Control
,&State
,4,t42
,FALSE
,0);
729 test_items_ok(test5
,38,&Control
,&State
,1,t51
,FALSE
,0);
730 test_items_ok(test6
,5,&Control
,&State
,2,t62
,FALSE
,0);
731 test_items_ok(test7
,29,&Control
,&State
,3,t73
,FALSE
,0);
732 test_items_ok(test8
,4,&Control
,&State
,1,t81
,FALSE
,0);
733 test_items_ok(test9
,5,&Control
,&State
,2,t92
,FALSE
,0);
734 test_items_ok(test10
,4,&Control
,&State
,1,t101
,FALSE
,0);
735 test_items_ok(test11
,8,&Control
,&State
,1,t112
,FALSE
,0);
736 test_items_ok(test12
,5,&Control
,&State
,1,t122
,FALSE
,0);
737 test_items_ok(test13
,7,&Control
,&State
,1,t132
,FALSE
,0);
738 test_items_ok(test14
,7,&Control
,&State
,1,t142
,FALSE
,0);
739 test_items_ok(test15
,5,&Control
,&State
,1,t152
,FALSE
,0);
740 test_items_ok(test16
,5,&Control
,&State
,1,t162
,FALSE
,0);
741 test_items_ok(test17
,6,&Control
,&State
,1,t172
,FALSE
,0);
742 test_items_ok(test18
,5,&Control
,&State
,1,t182
,FALSE
,0);
743 test_items_ok(test19
,6,&Control
,&State
,1,t192
,FALSE
,0);
744 test_items_ok(test20
,5,&Control
,&State
,2,t202
,FALSE
,0);
745 test_items_ok(test21
,5,&Control
,&State
,1,t211
,FALSE
,0);
746 test_items_ok(test22
,6,&Control
,&State
,2,t222
,FALSE
,b222
);
747 test_items_ok(test23
,6,&Control
,&State
,2,t232
,FALSE
,0);
748 test_items_ok(test24
,12,&Control
,&State
,1,t242
,FALSE
,0);
749 test_items_ok(test25
,10,&Control
,&State
,1,t252
,FALSE
,0);
750 test_items_ok(test26
,2,&Control
,&State
,1,t262
,FALSE
,0);
751 test_items_ok(test27
,8,&Control
,&State
,1,t272
,FALSE
,0);
752 test_items_ok(test28
,4,&Control
,&State
,1,t282
,FALSE
,0);
753 test_items_ok(test29
,10,&Control
,&State
,2,t292
,FALSE
,0);
754 test_items_ok(test30
,8,&Control
,&State
,1,t302
,FALSE
,0);
755 test_items_ok(test31
,8,&Control
,&State
,1,t312
,FALSE
,b312
);
756 test_items_ok(test32
,3,&Control
,&State
,1,t322
,FALSE
,0);
757 test_items_ok(test33
,4,&Control
,&State
,1,t332
,FALSE
,0);
758 test_items_ok(test34
,3,&Control
,&State
,1,t342
,FALSE
,b342
);
759 test_items_ok(test35
,13,&Control
,&State
,1,t352
,FALSE
,b352
);
760 test_items_ok(test36
,7,&Control
,&State
,1,t362
,FALSE
,0);
761 test_items_ok(test37
,3,&Control
,&State
,1,t372
,FALSE
,0);
762 test_items_ok(test38
,2,&Control
,&State
,1,t382
,FALSE
,0);
763 test_items_ok(test39
,10,&Control
,&State
,1,t392
,FALSE
,0);
764 test_items_ok(test40
,6,&Control
,&State
,1,t402
,FALSE
,0);
765 test_items_ok(test41
,6,&Control
,&State
,3,t412
,FALSE
,b412
);
766 test_items_ok(test42
,6,&Control
,&State
,1,t422
,FALSE
,0);
767 test_items_ok(test43
,7,&Control
,&State
,1,t432
,FALSE
,0);
768 test_items_ok(test44
,4,&Control
,&State
,2,t442
,FALSE
,0);
769 test_items_ok(test45
,24,&Control
,&State
,1,t452
,FALSE
,0);
770 test_items_ok(test46
,16,&Control
,&State
,1,t462
,FALSE
,0);
771 test_items_ok(test47
,26,&Control
,&State
,1,t472
,FALSE
,0);
772 test_items_ok(test56
,6,&Control
,&State
,1,t561
,FALSE
,0);
774 State
.uBidiLevel
= 1;
775 Control
.fMergeNeutralItems
= TRUE
;
776 test_items_ok(test1
,4,&Control
,&State
,1,t12
,FALSE
,0);
777 test_items_ok(test1b
,4,&Control
,&State
,1,t1b2
,FALSE
,0);
778 test_items_ok(test1c
,6,&Control
,&State
,3,t1c2
,FALSE
,0);
779 test_items_ok(test2
,16,&Control
,&State
,4,t23
,FALSE
,0);
780 test_items_ok(test2b
,11,&Control
,&State
,2,t2b3
,FALSE
,b2
);
781 test_items_ok(test2c
,11,&Control
,&State
,2,t2c4
,FALSE
,b2
);
782 test_items_ok(test2d
,11,&Control
,&State
,2,t2d4
,FALSE
,b2
);
783 test_items_ok(test3
,41,&Control
,&State
,1,t32
,FALSE
,0);
784 test_items_ok(test4
,12,&Control
,&State
,3,t43
,FALSE
,b43
);
785 test_items_ok(test5
,38,&Control
,&State
,1,t51
,FALSE
,0);
786 test_items_ok(test6
,5,&Control
,&State
,1,t63
,FALSE
,b63
);
787 test_items_ok(test7
,29,&Control
,&State
,3,t73
,FALSE
,0);
788 test_items_ok(test8
,4,&Control
,&State
,1,t81
,FALSE
,0);
789 test_items_ok(test9
,5,&Control
,&State
,1,t93
,FALSE
,b93
);
790 test_items_ok(test10
,4,&Control
,&State
,1,t101
,FALSE
,0);
791 test_items_ok(test11
,8,&Control
,&State
,1,t112
,FALSE
,0);
792 test_items_ok(test12
,5,&Control
,&State
,1,t122
,FALSE
,0);
793 test_items_ok(test13
,7,&Control
,&State
,1,t132
,FALSE
,0);
794 test_items_ok(test14
,7,&Control
,&State
,1,t142
,FALSE
,0);
795 test_items_ok(test15
,5,&Control
,&State
,1,t152
,FALSE
,0);
796 test_items_ok(test16
,5,&Control
,&State
,1,t162
,FALSE
,0);
797 test_items_ok(test17
,6,&Control
,&State
,1,t172
,FALSE
,0);
798 test_items_ok(test18
,5,&Control
,&State
,1,t182
,FALSE
,0);
799 test_items_ok(test19
,6,&Control
,&State
,1,t192
,FALSE
,0);
800 test_items_ok(test20
,5,&Control
,&State
,2,t202
,FALSE
,0);
801 test_items_ok(test21
,5,&Control
,&State
,1,t211
,FALSE
,0);
802 test_items_ok(test22
,6,&Control
,&State
,1,t223
,FALSE
,b223
);
803 test_items_ok(test23
,6,&Control
,&State
,2,t232
,FALSE
,0);
804 test_items_ok(test24
,12,&Control
,&State
,1,t242
,FALSE
,0);
805 test_items_ok(test25
,10,&Control
,&State
,1,t252
,FALSE
,0);
806 test_items_ok(test26
,2,&Control
,&State
,1,t262
,FALSE
,0);
807 test_items_ok(test27
,8,&Control
,&State
,1,t272
,FALSE
,0);
808 test_items_ok(test28
,4,&Control
,&State
,1,t282
,FALSE
,0);
809 test_items_ok(test29
,10,&Control
,&State
,2,t292
,FALSE
,0);
810 test_items_ok(test30
,8,&Control
,&State
,1,t302
,FALSE
,0);
811 test_items_ok(test31
,8,&Control
,&State
,1,t312
,FALSE
,b312
);
812 test_items_ok(test32
,3,&Control
,&State
,1,t322
,FALSE
,0);
813 test_items_ok(test33
,4,&Control
,&State
,1,t332
,FALSE
,0);
814 test_items_ok(test34
,3,&Control
,&State
,1,t342
,FALSE
,b342
);
815 test_items_ok(test35
,13,&Control
,&State
,1,t352
,FALSE
,b352
);
816 test_items_ok(test36
,7,&Control
,&State
,1,t362
,FALSE
,0);
817 test_items_ok(test37
,3,&Control
,&State
,1,t372
,FALSE
,0);
818 test_items_ok(test38
,2,&Control
,&State
,1,t382
,FALSE
,0);
819 test_items_ok(test39
,10,&Control
,&State
,1,t392
,FALSE
,0);
820 test_items_ok(test40
,6,&Control
,&State
,1,t402
,FALSE
,0);
821 test_items_ok(test41
,6,&Control
,&State
,3,t412
,FALSE
,b412
);
822 test_items_ok(test42
,6,&Control
,&State
,1,t422
,FALSE
,0);
823 test_items_ok(test43
,7,&Control
,&State
,1,t432
,FALSE
,0);
824 test_items_ok(test44
,4,&Control
,&State
,2,t442
,FALSE
,0);
825 test_items_ok(test45
,24,&Control
,&State
,1,t452
,FALSE
,0);
826 test_items_ok(test46
,16,&Control
,&State
,1,t462
,FALSE
,0);
827 test_items_ok(test47
,26,&Control
,&State
,1,t472
,FALSE
,0);
828 test_items_ok(test56
,6,&Control
,&State
,1,t561
,FALSE
,0);
830 State
.uBidiLevel
= 0;
831 Control
.fMergeNeutralItems
= FALSE
;
832 State
.fOverrideDirection
= 1;
833 test_items_ok(test1
,4,&Control
,&State
,1,t11
,FALSE
,0);
834 test_items_ok(test1b
,4,&Control
,&State
,1,t1b1
,FALSE
,0);
835 test_items_ok(test1c
,6,&Control
,&State
,1,t1c1
,FALSE
,0);
836 test_items_ok(test2
,16,&Control
,&State
,4,t24
,FALSE
,0);
837 test_items_ok(test2b
,11,&Control
,&State
,4,t2b4
,FALSE
,0);
838 test_items_ok(test2c
,11,&Control
,&State
,4,t2c5
,FALSE
,0);
839 test_items_ok(test2d
,11,&Control
,&State
,4,t2d5
,FALSE
,0);
840 test_items_ok(test3
,41,&Control
,&State
,1,t31
,FALSE
,0);
841 test_items_ok(test4
,12,&Control
,&State
,5,t41
,FALSE
,0);
842 test_items_ok(test5
,38,&Control
,&State
,1,t52
,FALSE
,0);
843 test_items_ok(test6
,5,&Control
,&State
,2,t64
,FALSE
,0);
844 test_items_ok(test7
,29,&Control
,&State
,3,t74
,FALSE
,0);
845 test_items_ok(test8
,4,&Control
,&State
,1,t82
,FALSE
,0);
846 test_items_ok(test9
,5,&Control
,&State
,2,t94
,FALSE
,0);
847 test_items_ok(test10
,4,&Control
,&State
,1,t102
,FALSE
,0);
848 test_items_ok(test11
,8,&Control
,&State
,1,t111
,FALSE
,0);
849 test_items_ok(test12
,5,&Control
,&State
,1,t121
,FALSE
,0);
850 test_items_ok(test13
,7,&Control
,&State
,1,t131
,FALSE
,0);
851 test_items_ok(test14
,7,&Control
,&State
,1,t141
,FALSE
,0);
852 test_items_ok(test15
,5,&Control
,&State
,1,t151
,FALSE
,0);
853 test_items_ok(test16
,5,&Control
,&State
,1,t161
,FALSE
,0);
854 test_items_ok(test17
,6,&Control
,&State
,1,t171
,FALSE
,0);
855 test_items_ok(test18
,5,&Control
,&State
,1,t181
,FALSE
,0);
856 test_items_ok(test19
,6,&Control
,&State
,1,t191
,FALSE
,0);
857 test_items_ok(test20
,5,&Control
,&State
,2,t201
,FALSE
,0);
858 test_items_ok(test21
,5,&Control
,&State
,1,t212
,FALSE
,0);
859 test_items_ok(test22
,6,&Control
,&State
,2,t221
,FALSE
,0);
860 test_items_ok(test23
,6,&Control
,&State
,2,t231
,FALSE
,0);
861 test_items_ok(test24
,12,&Control
,&State
,1,t241
,FALSE
,0);
862 test_items_ok(test25
,10,&Control
,&State
,1,t251
,FALSE
,0);
863 test_items_ok(test26
,2,&Control
,&State
,1,t261
,FALSE
,0);
864 test_items_ok(test27
,8,&Control
,&State
,1,t271
,FALSE
,0);
865 test_items_ok(test28
,4,&Control
,&State
,1,t281
,FALSE
,0);
866 test_items_ok(test29
,10,&Control
,&State
,2,t291
,FALSE
,0);
867 test_items_ok(test30
,8,&Control
,&State
,1,t301
,FALSE
,0);
868 test_items_ok(test31
,8,&Control
,&State
,1,t311
,FALSE
,b311
);
869 test_items_ok(test32
,3,&Control
,&State
,1,t321
,FALSE
,0);
870 test_items_ok(test33
,4,&Control
,&State
,1,t331
,FALSE
,0);
871 test_items_ok(test34
,3,&Control
,&State
,1,t341
,FALSE
,0);
872 test_items_ok(test35
,13,&Control
,&State
,1,t353
,FALSE
,b351
);
873 test_items_ok(test36
,7,&Control
,&State
,1,t361
,FALSE
,0);
874 test_items_ok(test37
,3,&Control
,&State
,1,t373
,FALSE
,0);
875 test_items_ok(test38
,2,&Control
,&State
,1,t381
,FALSE
,0);
876 test_items_ok(test39
,10,&Control
,&State
,1,t391
,FALSE
,0);
877 test_items_ok(test40
,6,&Control
,&State
,1,t401
,FALSE
,0);
878 test_items_ok(test41
,6,&Control
,&State
,1,t411
,FALSE
,0);
879 test_items_ok(test42
,6,&Control
,&State
,1,t421
,FALSE
,0);
880 test_items_ok(test43
,7,&Control
,&State
,1,t431
,FALSE
,0);
881 test_items_ok(test44
,4,&Control
,&State
,2,t441
,FALSE
,0);
882 test_items_ok(test45
,24,&Control
,&State
,1,t451
,FALSE
,0);
883 test_items_ok(test46
,16,&Control
,&State
,1,t461
,FALSE
,0);
884 test_items_ok(test47
,26,&Control
,&State
,1,t471
,FALSE
,0);
885 test_items_ok(test48
,6,&Control
,&State
,3,t482
,FALSE
,0);
886 test_items_ok(test49
,7,&Control
,&State
,2,t492
,FALSE
,0);
887 test_items_ok(test50
,6,&Control
,&State
,3,t502
,FALSE
,0);
888 test_items_ok(test51
,7,&Control
,&State
,4,t512
,FALSE
,0);
889 test_items_ok(test52
,7,&Control
,&State
,4,t522
,FALSE
,0);
890 test_items_ok(test53
,8,&Control
,&State
,4,t532
,FALSE
,0);
891 test_items_ok(test54
,7,&Control
,&State
,2,t542
,FALSE
,0);
892 test_items_ok(test55
,8,&Control
,&State
,2,t552
,FALSE
,0);
893 test_items_ok(test56
,6,&Control
,&State
,1,t562
,FALSE
,0);
896 static inline void _test_shape_ok(int valid
, HDC hdc
, LPCWSTR string
,
897 DWORD cchString
, SCRIPT_CONTROL
*Control
,
898 SCRIPT_STATE
*State
, DWORD item
, DWORD nGlyphs
,
899 const shapeTest_char
* charItems
,
900 const shapeTest_glyph
* glyphItems
)
903 int x
, outnItems
=0, outnGlyphs
=0;
904 SCRIPT_ITEM outpItems
[15];
905 SCRIPT_CACHE sc
= NULL
;
908 int maxGlyphs
= cchString
* 1.5;
909 SCRIPT_GLYPHPROP
*glyphProp
;
910 SCRIPT_CHARPROP
*charProp
;
913 hr
= pScriptItemizeOpenType(string
, cchString
, 15, Control
, State
, outpItems
, tags
, &outnItems
);
914 if (hr
== USP_E_SCRIPT_NOT_IN_FONT
)
917 winetest_win_skip("Select font does not support script\n");
919 winetest_trace("Select font does not support script\n");
923 winetest_ok(hr
== S_OK
, "ScriptItemizeOpenType should return S_OK not %08x\n", hr
);
925 winetest_trace("ScriptItemizeOpenType should return S_OK not %08x\n", hr
);
927 if (outnItems
<= item
)
930 winetest_win_skip("Did not get enough items\n");
932 winetest_trace("Did not get enough items\n");
936 logclust
= HeapAlloc(GetProcessHeap(), 0, sizeof(WORD
) * cchString
);
937 memset(logclust
,'a',sizeof(WORD
) * cchString
);
938 charProp
= HeapAlloc(GetProcessHeap(), 0, sizeof(SCRIPT_CHARPROP
) * cchString
);
939 memset(charProp
,'a',sizeof(SCRIPT_CHARPROP
) * cchString
);
940 glyphs
= HeapAlloc(GetProcessHeap(), 0, sizeof(WORD
) * maxGlyphs
);
941 memset(glyphs
,'a',sizeof(WORD
) * cchString
);
942 glyphProp
= HeapAlloc(GetProcessHeap(), 0, sizeof(SCRIPT_GLYPHPROP
) * maxGlyphs
);
943 memset(glyphProp
,'a',sizeof(SCRIPT_GLYPHPROP
) * cchString
);
945 hr
= pScriptShapeOpenType(hdc
, &sc
, &outpItems
[item
].a
, tags
[item
], 0x00000000, NULL
, NULL
, 0, string
, cchString
, maxGlyphs
, logclust
, charProp
, glyphs
, glyphProp
, &outnGlyphs
);
947 winetest_ok(hr
== S_OK
, "ScriptShapeOpenType failed (%x)\n",hr
);
949 winetest_trace("ScriptShapeOpenType failed (%x)\n",hr
);
953 for (x
= 0; x
< cchString
; x
++)
956 winetest_ok(logclust
[x
] == charItems
[x
].wLogClust
, "%i: invalid LogClust(%i)\n",x
,logclust
[x
]);
957 else if (logclust
[x
] != charItems
[x
].wLogClust
)
958 winetest_trace("%i: invalid LogClust(%i)\n",x
,logclust
[x
]);
960 winetest_ok(charProp
[x
].fCanGlyphAlone
== charItems
[x
].CharProp
.fCanGlyphAlone
, "%i: invalid fCanGlyphAlone\n",x
);
961 else if (charProp
[x
].fCanGlyphAlone
!= charItems
[x
].CharProp
.fCanGlyphAlone
)
962 winetest_trace("%i: invalid fCanGlyphAlone\n",x
);
966 winetest_ok(nGlyphs
== outnGlyphs
, "got incorrect number of glyphs (%i)\n",outnGlyphs
);
967 else if (nGlyphs
!= outnGlyphs
)
968 winetest_trace("got incorrect number of glyphs (%i)\n",outnGlyphs
);
969 for (x
= 0; x
< outnGlyphs
; x
++)
971 if (glyphItems
[x
].Glyph
)
974 winetest_ok(glyphs
[x
]!=0, "%i: Glyph not present when it should be\n",x
);
975 else if (glyphs
[x
]==0)
976 winetest_trace("%i: Glyph not present when it should be\n",x
);
981 winetest_ok(glyphs
[x
]==0, "%i: Glyph present when it should not be\n",x
);
982 else if (glyphs
[x
]!=0)
983 winetest_trace("%i: Glyph present when it should not be\n",x
);
986 winetest_ok(glyphProp
[x
].sva
.uJustification
== glyphItems
[x
].GlyphProp
.sva
.uJustification
, "%i: uJustification incorrect (%i)\n",x
,glyphProp
[x
].sva
.uJustification
);
987 else if (glyphProp
[x
].sva
.uJustification
!= glyphItems
[x
].GlyphProp
.sva
.uJustification
)
988 winetest_trace("%i: uJustification incorrect (%i)\n",x
,glyphProp
[x
].sva
.uJustification
);
990 winetest_ok(glyphProp
[x
].sva
.fClusterStart
== glyphItems
[x
].GlyphProp
.sva
.fClusterStart
, "%i: fClusterStart incorrect (%i)\n",x
,glyphProp
[x
].sva
.fClusterStart
);
991 else if (glyphProp
[x
].sva
.fClusterStart
!= glyphItems
[x
].GlyphProp
.sva
.fClusterStart
)
992 winetest_trace("%i: fClusterStart incorrect (%i)\n",x
,glyphProp
[x
].sva
.fClusterStart
);
994 winetest_ok(glyphProp
[x
].sva
.fDiacritic
== glyphItems
[x
].GlyphProp
.sva
.fDiacritic
, "%i: fDiacritic incorrect (%i)\n",x
,glyphProp
[x
].sva
.fDiacritic
);
995 else if (glyphProp
[x
].sva
.fDiacritic
!= glyphItems
[x
].GlyphProp
.sva
.fDiacritic
)
996 winetest_trace("%i: fDiacritic incorrect (%i)\n",x
,glyphProp
[x
].sva
.fDiacritic
);
998 winetest_ok(glyphProp
[x
].sva
.fZeroWidth
== glyphItems
[x
].GlyphProp
.sva
.fZeroWidth
, "%i: fZeroWidth incorrect (%i)\n",x
,glyphProp
[x
].sva
.fZeroWidth
);
999 else if (glyphProp
[x
].sva
.fZeroWidth
!= glyphItems
[x
].GlyphProp
.sva
.fZeroWidth
)
1000 winetest_trace("%i: fZeroWidth incorrect (%i)\n",x
,glyphProp
[x
].sva
.fZeroWidth
);
1004 HeapFree(GetProcessHeap(),0,logclust
);
1005 HeapFree(GetProcessHeap(),0,charProp
);
1006 HeapFree(GetProcessHeap(),0,glyphs
);
1007 HeapFree(GetProcessHeap(),0,glyphProp
);
1008 ScriptFreeCache(&sc
);
1011 #define test_shape_ok(a,b,c,d,e,f,g,h,i) (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _test_shape_ok(1,a,b,c,d,e,f,g,h,i)
1013 #define test_shape_ok_valid(v,a,b,c,d,e,f,g,h,i) (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _test_shape_ok(v,a,b,c,d,e,f,g,h,i)
1015 typedef struct tagRangeP
{
1020 static int CALLBACK
enumFontProc( const LOGFONTA
*lpelfe
, const TEXTMETRICA
*lpntme
, DWORD FontType
, LPARAM lParam
)
1022 NEWTEXTMETRICEXA
*ntme
= (NEWTEXTMETRICEXA
*)lpntme
;
1023 fontEnumParam
*rp
= (fontEnumParam
*) lParam
;
1028 if (FontType
!= TRUETYPE_FONTTYPE
)
1032 while (i
>= sizeof(DWORD
)*8)
1035 i
-= (sizeof(DWORD
)*8);
1042 if (ntme
->ntmFontSig
.fsUsb
[idx
] & mask
)
1044 memcpy(&(rp
->lf
),lpelfe
,sizeof(LOGFONTA
));
1050 static int _find_font_for_range(HDC hdc
, const CHAR
*recommended
, BYTE range
, const WCHAR check
, HFONT
*hfont
, HFONT
*origFont
)
1053 fontEnumParam lParam
;
1055 lParam
.range
= range
;
1056 memset(&lParam
.lf
,0,sizeof(LOGFONTA
));
1061 lstrcpyA(lParam
.lf
.lfFaceName
, recommended
);
1062 if (!EnumFontFamiliesExA(hdc
, &lParam
.lf
, enumFontProc
, (LPARAM
)&lParam
, 0))
1064 *hfont
= CreateFontIndirectA(&lParam
.lf
);
1067 winetest_trace("using font %s\n",lParam
.lf
.lfFaceName
);
1075 memset(&lParam
.lf
,0,sizeof(LOGFONTA
));
1076 lParam
.lf
.lfCharSet
= DEFAULT_CHARSET
;
1078 if (!EnumFontFamiliesExA(hdc
, &lParam
.lf
, enumFontProc
, (LPARAM
)&lParam
, 0) && lParam
.lf
.lfFaceName
[0])
1080 *hfont
= CreateFontIndirectA(&lParam
.lf
);
1082 winetest_trace("trying font %s: failures will only be warnings\n",lParam
.lf
.lfFaceName
);
1090 *origFont
= SelectObject(hdc
,*hfont
);
1091 if (pGetGlyphIndicesW
&& (pGetGlyphIndicesW(hdc
, &check
, 1, &glyph
, 0) == GDI_ERROR
|| glyph
==0))
1093 winetest_trace(" Font fails to contain required glyphs\n");
1094 SelectObject(hdc
,*origFont
);
1095 DeleteObject(*hfont
);
1103 winetest_trace("Failed to find usable font\n");
1108 #define find_font_for_range(a,b,c,d,e,f) (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _find_font_for_range(a,b,c,d,e,f)
1110 static void test_ScriptShapeOpenType(HDC hdc
)
1113 SCRIPT_CACHE sc
= NULL
;
1114 WORD glyphs
[4], logclust
[4];
1115 SCRIPT_GLYPHPROP glyphProp
[4];
1116 SCRIPT_ITEM items
[2];
1118 SCRIPT_CONTROL Control
;
1121 HFONT hfont
, hfont_orig
;
1123 shapeTest_glyph glyph_test
[4];
1125 static const WCHAR test1
[] = {'w', 'i', 'n', 'e',0};
1126 static const shapeTest_char t1_c
[] = {{0,{0,0}},{1,{0,0}},{2,{0,0}},{3,{0,0}}};
1127 static const shapeTest_glyph t1_g
[] = {
1128 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1129 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1130 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1131 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}} };
1133 static const WCHAR test2
[] = {0x202B, 'i', 'n', 0x202C,0};
1134 static const shapeTest_char t2_c
[] = {{0,{0,0}},{1,{0,0}},{2,{0,0}},{3,{0,0}}};
1135 static const shapeTest_glyph t2_g
[] = {
1136 {0,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1137 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1138 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1139 {0,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}} };
1142 static const WCHAR test_hebrew
[] = {0x05e9, 0x05dc, 0x05d5, 0x05dd,0};
1143 static const shapeTest_char hebrew_c
[] = {{3,{0,0}},{2,{0,0}},{1,{0,0}},{0,{0,0}}};
1144 static const shapeTest_glyph hebrew_g
[] = {
1145 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1146 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1147 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1148 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}} };
1151 static const WCHAR test_arabic
[] = {0x0633,0x0644,0x0627,0x0645,0};
1152 static const shapeTest_char arabic_c
[] = {{2,{0,0}},{1,{0,0}},{1,{0,0}},{0,{0,0}}};
1153 static const shapeTest_glyph arabic_g
[] = {
1154 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1155 {1,{{SCRIPT_JUSTIFY_ARABIC_NORMAL
,1,0,0,0,0},0}},
1156 {1,{{SCRIPT_JUSTIFY_ARABIC_SEEN
,1,0,0,0,0},0}} };
1159 static const WCHAR test_thai
[] = {0x0e2a, 0x0e04, 0x0e23, 0x0e34, 0x0e1b, 0x0e15, 0x0e4c, 0x0e44, 0x0e17, 0x0e22,};
1160 static const shapeTest_char thai_c
[] = {{0,{0,0}},{1,{0,0}},{2,{0,0}},{2,{0,0}},{4,{0,0}},{5,{0,0}},{5,{0,0}},{7,{0,0}},{8,{0,0}},{9,{0,0}}};
1161 static const shapeTest_glyph thai_g
[] = {
1162 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1163 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1164 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1165 {1,{{SCRIPT_JUSTIFY_CHARACTER
,0,1,1,0,0},0}},
1166 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1167 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1168 {1,{{SCRIPT_JUSTIFY_CHARACTER
,0,1,1,0,0},0}},
1169 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1170 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1171 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}}};
1174 static const WCHAR test_syriac
[] = {0x0710, 0x0710, 0x0710, 0x0728, 0x0718, 0x0723,0};
1175 static const shapeTest_char syriac_c
[] = {{5,{0,0}},{4,{0,0}},{3,{0,0}},{2,{0,0}},{1,{0,0}},{0,{0,0}}};
1176 static const shapeTest_glyph syriac_g
[] = {
1177 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1178 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1179 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1180 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1181 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1182 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}} };
1185 static const WCHAR test_thaana
[] = {0x078a, 0x07ae, 0x0792, 0x07b0, 0x0020, 0x0796, 0x07aa, 0x0789, 0x07b0, 0x0795, 0x07ac, 0x0791, 0x07b0};
1186 static const shapeTest_char thaana_c
[] = {{12,{0,0}},{12,{0,0}},{10,{0,0}},{10,{0,0}},{8,{1,0}},{7,{0,0}},{7,{0,0}},{5,{0,0}},{5,{0,0}},{3,{0,0}},{3,{0,0}},{1,{0,0}},{1,{0,0}}};
1187 static const shapeTest_glyph thaana_g
[] = {
1188 {1,{{SCRIPT_JUSTIFY_NONE
,0,1,1,0,0},0}},
1189 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1190 {1,{{SCRIPT_JUSTIFY_NONE
,0,1,1,0,0},0}},
1191 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1192 {1,{{SCRIPT_JUSTIFY_NONE
,0,1,1,0,0},0}},
1193 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1194 {1,{{SCRIPT_JUSTIFY_NONE
,0,1,1,0,0},0}},
1195 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1196 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1197 {1,{{SCRIPT_JUSTIFY_NONE
,0,1,1,0,0},0}},
1198 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1199 {1,{{SCRIPT_JUSTIFY_NONE
,0,1,1,0,0},0}},
1200 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}} };
1203 static const WCHAR test_phagspa
[] = {0xa84f, 0xa861, 0xa843, 0x0020, 0xa863, 0xa861, 0xa859, 0x0020, 0xa850, 0xa85c, 0xa85e};
1204 static const shapeTest_char phagspa_c
[] = {{0,{0,0}},{1,{0,0}},{2,{0,0}},{3,{1,0}},{4,{0,0}},{5,{0,0}},{6,{0,0}},{7,{1,0}},{8,{0,0}},{9,{0,0}},{10,{0,0}}};
1205 static const shapeTest_glyph phagspa_g
[] = {
1206 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1207 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1208 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1209 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1210 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1211 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1212 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1213 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1214 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1215 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1216 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}} };
1219 static const WCHAR test_lao
[] = {0x0ead, 0x0eb1, 0x0e81, 0x0eaa, 0x0ead, 0x0e99, 0x0ea5, 0x0eb2, 0x0ea7, 0};
1220 static const shapeTest_char lao_c
[] = {{0,{0,0}},{0,{0,0}},{2,{0,0}},{3,{0,0}},{4,{0,0}},{5,{0,0}},{6,{0,0}},{7,{0,0}},{8,{0,0}}};
1221 static const shapeTest_glyph lao_g
[] = {
1222 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1223 {1,{{SCRIPT_JUSTIFY_CHARACTER
,0,1,1,0,0},0}},
1224 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1225 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1226 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1227 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1228 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1229 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1230 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}} };
1233 static const WCHAR test_tibetan
[] = {0x0f04, 0x0f05, 0x0f0e, 0x0020, 0x0f51, 0x0f7c, 0x0f53, 0x0f0b, 0x0f5a, 0x0f53, 0x0f0b, 0x0f51, 0x0f44, 0x0f0b, 0x0f54, 0x0f7c, 0x0f0d};
1234 static const shapeTest_char tibetan_c
[] = {{0,{0,0}},{1,{0,0}},{2,{0,0}},{3,{1,0}},{4,{0,0}},{4,{0,0}},{6,{0,0}},{7,{0,0}},{8,{0,0}},{9,{0,0}},{10,{0,0}},{11,{0,0}},{12,{0,0}},{13,{0,0}},{14,{0,0}},{14,{0,0}},{16,{0,0}}};
1235 static const shapeTest_glyph tibetan_g
[] = {
1236 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1237 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1238 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1239 {1,{{SCRIPT_JUSTIFY_BLANK
,1,0,0,0,0},0}},
1240 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1241 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1242 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1243 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1244 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1245 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1246 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1247 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1248 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1249 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1250 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1251 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1252 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}} };
1255 static const WCHAR test_devanagari
[] = {0x0926, 0x0947, 0x0935, 0x0928, 0x093e, 0x0917, 0x0930, 0x0940};
1256 static const shapeTest_char devanagari_c
[] = {{0,{0,0}},{0,{0,0}},{2,{0,0}},{3,{0,0}},{3,{0,0}},{5,{0,0}},{6,{0,0}},{6,{0,0}}};
1257 static const shapeTest_glyph devanagari_g
[] = {
1258 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1259 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1260 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1261 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1262 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1263 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1264 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1265 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}} };
1268 static const WCHAR test_bengali
[] = {0x09ac, 0x09be, 0x0982, 0x09b2, 0x09be};
1269 static const shapeTest_char bengali_c
[] = {{0,{0,0}},{0,{0,0}},{0,{0,0}},{3,{0,0}},{3,{0,0}}};
1270 static const shapeTest_glyph bengali_g
[] = {
1271 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1272 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1273 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1274 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1275 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}} };
1278 static const WCHAR test_gurmukhi
[] = {0x0a17, 0x0a41, 0x0a30, 0x0a2e, 0x0a41, 0x0a16, 0x0a40};
1279 static const shapeTest_char gurmukhi_c
[] = {{0,{0,0}},{0,{0,0}},{2,{0,0}},{3,{0,0}},{3,{0,0}},{5,{0,0}},{5,{0,0}}};
1280 static const shapeTest_glyph gurmukhi_g
[] = {
1281 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1282 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1283 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1284 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1285 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1286 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1287 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}} };
1290 static const WCHAR test_gujarati
[] = {0x0a97, 0x0ac1, 0x0a9c, 0x0ab0, 0x0abe, 0x0aa4, 0x0ac0};
1291 static const shapeTest_char gujarati_c
[] = {{0,{0,0}},{0,{0,0}},{2,{0,0}},{3,{0,0}},{3,{0,0}},{5,{0,0}},{5,{0,0}}};
1292 static const shapeTest_glyph gujarati_g
[] = {
1293 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1294 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1295 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1296 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1297 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1298 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1299 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}} };
1302 static const WCHAR test_oriya
[] = {0x0b13, 0x0b21, 0x0b3c, 0x0b3f, 0x0b06};
1303 static const shapeTest_char oriya_c
[] = {{0,{0,0}},{1,{0,0}},{1,{0,0}},{1,{0,0}},{3,{0,0}}};
1304 static const shapeTest_glyph oriya_g
[] = {
1305 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1306 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1307 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1308 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}} };
1311 static const WCHAR test_tamil
[] = {0x0ba4, 0x0bae, 0x0bbf, 0x0bb4, 0x0bcd};
1312 static const shapeTest_char tamil_c
[] = {{0,{0,0}},{1,{0,0}},{1,{0,0}},{3,{0,0}},{3,{0,0}}};
1313 static const shapeTest_glyph tamil_g
[] = {
1314 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1315 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1316 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1317 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}} };
1320 static const WCHAR test_telugu
[] = {0x0c24, 0x0c46, 0x0c32, 0x0c41, 0x0c17, 0x0c41};
1321 static const shapeTest_char telugu_c
[] = {{0,{0,0}},{0,{0,0}},{2,{0,0}},{2,{0,0}},{4,{0,0}},{4,{0,0}}};
1322 static const shapeTest_glyph telugu_g
[] = {
1323 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1324 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1325 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1326 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1327 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1328 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}} };
1331 static const WCHAR test_malayalam
[] = {0x0d2e, 0x0d32, 0x0d2f, 0x0d3e, 0x0d33, 0x0d02};
1332 static const shapeTest_char malayalam_c
[] = {{0,{0,0}},{1,{0,0}},{2,{0,0}},{2,{0,0}},{4,{0,0}},{4,{0,0}}};
1333 static const shapeTest_glyph malayalam_g
[] = {
1334 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1335 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1336 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1337 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1338 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1339 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}} };
1342 static const WCHAR test_kannada
[] = {0x0c95, 0x0ca8, 0x0ccd, 0x0ca8, 0x0ca1};
1343 static const shapeTest_char kannada_c
[] = {{0,{0,0}},{1,{0,0}},{1,{0,0}},{1,{0,0}},{3,{0,0}}};
1344 static const shapeTest_glyph kannada_g
[] = {
1345 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1346 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1347 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1348 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1349 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}} };
1351 if (!pScriptItemizeOpenType
|| !pScriptShapeOpenType
)
1353 win_skip("ScriptShapeOpenType not available on this platform\n");
1357 memset(&Control
, 0 , sizeof(Control
));
1358 memset(&State
, 0 , sizeof(State
));
1360 hr
= pScriptItemizeOpenType(test1
, 4, 2, &Control
, &State
, items
, tags
, &outnItems
);
1361 ok(hr
== S_OK
, "ScriptItemizeOpenType should return S_OK not %08x\n", hr
);
1362 ok(items
[0].a
.fNoGlyphIndex
== FALSE
, "fNoGlyphIndex TRUE\n");
1364 hr
= pScriptShapeOpenType(hdc
, &sc
, &items
[0].a
, tags
[0], 0x00000000, NULL
, NULL
, 0, test1
, 4, 4, NULL
, NULL
, glyphs
, NULL
, &nb
);
1365 ok(hr
== E_INVALIDARG
, "ScriptShapeOpenType should return E_INVALIDARG not %08x\n", hr
);
1367 hr
= pScriptShapeOpenType(hdc
, &sc
, &items
[0].a
, tags
[0], 0x00000000, NULL
, NULL
, 0, test1
, 4, 4, NULL
, NULL
, glyphs
, glyphProp
, NULL
);
1368 ok(hr
== E_INVALIDARG
, "ScriptShapeOpenType should return E_INVALIDARG not %08x\n", hr
);
1370 hr
= pScriptShapeOpenType(NULL
, &sc
, &items
[0].a
, tags
[0], 0x00000000, NULL
, NULL
, 0, test1
, 4, 4, NULL
, NULL
, glyphs
, glyphProp
, &nb
);
1371 ok(hr
== E_INVALIDARG
, "ScriptShapeOpenType should return E_PENDING not %08x\n", hr
);
1373 hr
= pScriptShapeOpenType(hdc
, &sc
, &items
[0].a
, tags
[0], 0x00000000, NULL
, NULL
, 0, test1
, 4, 4, NULL
, NULL
, glyphs
, glyphProp
, &nb
);
1374 ok( hr
== E_INVALIDARG
,
1375 "ScriptShapeOpenType should return E_FAIL or E_INVALIDARG, not %08x\n", hr
);
1376 hr
= pScriptShapeOpenType(hdc
, &sc
, &items
[0].a
, tags
[0], 0x00000000, NULL
, NULL
, 0, test1
, 4, 4, logclust
, NULL
, glyphs
, glyphProp
, &nb
);
1377 ok(hr
== E_INVALIDARG
, "ScriptShapeOpenType should return E_INVALIDARG not %08x\n", hr
);
1379 ScriptFreeCache(&sc
);
1381 test_shape_ok(hdc
, test1
, 4, &Control
, &State
, 0, 4, t1_c
, t1_g
);
1383 /* newer Tahoma has zerowidth space glyphs for 0x202b and 0x202c */
1384 memcpy(glyph_test
, t2_g
, sizeof(glyph_test
));
1385 GetGlyphIndicesW(hdc
, test2
, 4, glyphs
, 0);
1387 glyph_test
[0].Glyph
= 1;
1389 glyph_test
[3].Glyph
= 1;
1391 test_shape_ok(hdc
, test2
, 4, &Control
, &State
, 1, 4, t2_c
, glyph_test
);
1393 test_valid
= find_font_for_range(hdc
, "Microsoft Sans Serif", 11, test_hebrew
[0], &hfont
, &hfont_orig
);
1396 test_shape_ok_valid(test_valid
, hdc
, test_hebrew
, 4, &Control
, &State
, 0, 4, hebrew_c
, hebrew_g
);
1397 SelectObject(hdc
, hfont_orig
);
1398 DeleteObject(hfont
);
1401 test_valid
= find_font_for_range(hdc
, "Microsoft Sans Serif", 13, test_arabic
[0], &hfont
, &hfont_orig
);
1404 test_shape_ok_valid(test_valid
, hdc
, test_arabic
, 4, &Control
, &State
, 0, 3, arabic_c
, arabic_g
);
1405 SelectObject(hdc
, hfont_orig
);
1406 DeleteObject(hfont
);
1409 test_valid
= find_font_for_range(hdc
, "Microsoft Sans Serif", 24, test_thai
[0], &hfont
, &hfont_orig
);
1412 test_shape_ok_valid(test_valid
, hdc
, test_thai
, 10, &Control
, &State
, 0, 10, thai_c
, thai_g
);
1413 SelectObject(hdc
, hfont_orig
);
1414 DeleteObject(hfont
);
1417 test_valid
= find_font_for_range(hdc
, "Estrangelo Edessa", 71, test_syriac
[0], &hfont
, &hfont_orig
);
1420 test_shape_ok_valid(test_valid
, hdc
, test_syriac
, 6, &Control
, &State
, 0, 6, syriac_c
, syriac_g
);
1421 SelectObject(hdc
, hfont_orig
);
1422 DeleteObject(hfont
);
1425 test_valid
= find_font_for_range(hdc
, "MV Boli", 72, test_thaana
[0], &hfont
, &hfont_orig
);
1428 test_shape_ok_valid(test_valid
, hdc
, test_thaana
, 13, &Control
, &State
, 0, 13, thaana_c
, thaana_g
);
1429 SelectObject(hdc
, hfont_orig
);
1430 DeleteObject(hfont
);
1433 test_valid
= find_font_for_range(hdc
, "Microsoft PhagsPa", 53, test_phagspa
[0], &hfont
, &hfont_orig
);
1436 test_shape_ok_valid(test_valid
, hdc
, test_phagspa
, 11, &Control
, &State
, 0, 11, phagspa_c
, phagspa_g
);
1437 SelectObject(hdc
, hfont_orig
);
1438 DeleteObject(hfont
);
1441 test_valid
= find_font_for_range(hdc
, "DokChampa", 25, test_lao
[0], &hfont
, &hfont_orig
);
1444 test_shape_ok_valid(test_valid
, hdc
, test_lao
, 9, &Control
, &State
, 0, 9, lao_c
, lao_g
);
1445 SelectObject(hdc
, hfont_orig
);
1446 DeleteObject(hfont
);
1449 test_valid
= find_font_for_range(hdc
, "Microsoft Himalaya", 70, test_tibetan
[0], &hfont
, &hfont_orig
);
1452 test_shape_ok_valid(test_valid
, hdc
, test_tibetan
, 17, &Control
, &State
, 0, 17, tibetan_c
, tibetan_g
);
1453 SelectObject(hdc
, hfont_orig
);
1454 DeleteObject(hfont
);
1457 test_valid
= find_font_for_range(hdc
, "Mangal", 15, test_devanagari
[0], &hfont
, &hfont_orig
);
1460 test_shape_ok_valid(test_valid
, hdc
, test_devanagari
, 8, &Control
, &State
, 0, 8, devanagari_c
, devanagari_g
);
1461 SelectObject(hdc
, hfont_orig
);
1462 DeleteObject(hfont
);
1465 test_valid
= find_font_for_range(hdc
, "Vrinda", 16, test_bengali
[0], &hfont
, &hfont_orig
);
1468 test_shape_ok_valid(test_valid
, hdc
, test_bengali
, 5, &Control
, &State
, 0, 5, bengali_c
, bengali_g
);
1469 SelectObject(hdc
, hfont_orig
);
1470 DeleteObject(hfont
);
1473 test_valid
= find_font_for_range(hdc
, "Raavi", 17, test_gurmukhi
[0], &hfont
, &hfont_orig
);
1476 test_shape_ok_valid(test_valid
, hdc
, test_gurmukhi
, 7, &Control
, &State
, 0, 7, gurmukhi_c
, gurmukhi_g
);
1477 SelectObject(hdc
, hfont_orig
);
1478 DeleteObject(hfont
);
1481 test_valid
= find_font_for_range(hdc
, "Shruti", 18, test_gujarati
[0], &hfont
, &hfont_orig
);
1484 test_shape_ok_valid(test_valid
, hdc
, test_gujarati
, 7, &Control
, &State
, 0, 7, gujarati_c
, gujarati_g
);
1485 SelectObject(hdc
, hfont_orig
);
1486 DeleteObject(hfont
);
1489 test_valid
= find_font_for_range(hdc
, "Kalinga", 19, test_oriya
[0], &hfont
, &hfont_orig
);
1492 test_shape_ok_valid(test_valid
, hdc
, test_oriya
, 5, &Control
, &State
, 0, 4, oriya_c
, oriya_g
);
1493 SelectObject(hdc
, hfont_orig
);
1494 DeleteObject(hfont
);
1497 test_valid
= find_font_for_range(hdc
, "Latha", 20, test_tamil
[0], &hfont
, &hfont_orig
);
1500 test_shape_ok_valid(test_valid
, hdc
, test_tamil
, 5, &Control
, &State
, 0, 4, tamil_c
, tamil_g
);
1501 SelectObject(hdc
, hfont_orig
);
1502 DeleteObject(hfont
);
1505 test_valid
= find_font_for_range(hdc
, "Gautami", 21, test_telugu
[0], &hfont
, &hfont_orig
);
1508 test_shape_ok_valid(test_valid
, hdc
, test_telugu
, 6, &Control
, &State
, 0, 6, telugu_c
, telugu_g
);
1509 SelectObject(hdc
, hfont_orig
);
1510 DeleteObject(hfont
);
1513 test_valid
= find_font_for_range(hdc
, "Kartika", 23, test_malayalam
[0], &hfont
, &hfont_orig
);
1516 test_shape_ok_valid(test_valid
, hdc
, test_malayalam
, 6, &Control
, &State
, 0, 6, malayalam_c
, malayalam_g
);
1517 SelectObject(hdc
, hfont_orig
);
1518 DeleteObject(hfont
);
1521 test_valid
= find_font_for_range(hdc
, "Tunga", 22, test_kannada
[0], &hfont
, &hfont_orig
);
1524 test_shape_ok_valid(test_valid
, hdc
, test_kannada
, 5, &Control
, &State
, 0, 4, kannada_c
, kannada_g
);
1525 SelectObject(hdc
, hfont_orig
);
1526 DeleteObject(hfont
);
1530 static void test_ScriptShape(HDC hdc
)
1532 static const WCHAR test1
[] = {'w', 'i', 'n', 'e',0};
1533 static const WCHAR test2
[] = {0x202B, 'i', 'n', 0x202C,0};
1535 SCRIPT_CACHE sc
= NULL
;
1536 WORD glyphs
[4], glyphs2
[4], logclust
[4], glyphs3
[4];
1537 SCRIPT_VISATTR attrs
[4];
1538 SCRIPT_ITEM items
[2];
1541 hr
= ScriptItemize(test1
, 4, 2, NULL
, NULL
, items
, NULL
);
1542 ok(hr
== S_OK
, "ScriptItemize should return S_OK not %08x\n", hr
);
1543 ok(items
[0].a
.fNoGlyphIndex
== FALSE
, "fNoGlyphIndex TRUE\n");
1545 hr
= ScriptShape(hdc
, &sc
, test1
, 4, 4, &items
[0].a
, glyphs
, NULL
, NULL
, &nb
);
1546 ok(hr
== E_INVALIDARG
, "ScriptShape should return E_INVALIDARG not %08x\n", hr
);
1548 hr
= ScriptShape(hdc
, &sc
, test1
, 4, 4, &items
[0].a
, glyphs
, NULL
, attrs
, NULL
);
1549 ok(hr
== E_INVALIDARG
, "ScriptShape should return E_INVALIDARG not %08x\n", hr
);
1551 hr
= ScriptShape(NULL
, &sc
, test1
, 4, 4, &items
[0].a
, glyphs
, NULL
, attrs
, &nb
);
1552 ok(hr
== E_PENDING
, "ScriptShape should return E_PENDING not %08x\n", hr
);
1554 hr
= ScriptShape(hdc
, &sc
, test1
, 4, 4, &items
[0].a
, glyphs
, NULL
, attrs
, &nb
);
1555 ok(broken(hr
== S_OK
) ||
1556 hr
== E_INVALIDARG
|| /* Vista, W2K8 */
1557 hr
== E_FAIL
, /* WIN7 */
1558 "ScriptShape should return E_FAIL or E_INVALIDARG, not %08x\n", hr
);
1559 ok(items
[0].a
.fNoGlyphIndex
== FALSE
, "fNoGlyphIndex TRUE\n");
1561 hr
= ScriptShape(hdc
, &sc
, test1
, 4, 4, &items
[0].a
, glyphs
, logclust
, attrs
, &nb
);
1562 ok(hr
== S_OK
, "ScriptShape should return S_OK not %08x\n", hr
);
1563 ok(items
[0].a
.fNoGlyphIndex
== FALSE
, "fNoGlyphIndex TRUE\n");
1566 memset(glyphs
,-1,sizeof(glyphs
));
1567 memset(logclust
,-1,sizeof(logclust
));
1568 memset(attrs
,-1,sizeof(attrs
));
1569 hr
= ScriptShape(NULL
, &sc
, test1
, 4, 4, &items
[0].a
, glyphs
, logclust
, attrs
, &nb
);
1570 ok(hr
== S_OK
, "ScriptShape should return S_OK not %08x\n", hr
);
1571 ok(nb
== 4, "Wrong number of items\n");
1572 ok(logclust
[0] == 0, "clusters out of order\n");
1573 ok(logclust
[1] == 1, "clusters out of order\n");
1574 ok(logclust
[2] == 2, "clusters out of order\n");
1575 ok(logclust
[3] == 3, "clusters out of order\n");
1576 ok(attrs
[0].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1577 ok(attrs
[1].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1578 ok(attrs
[2].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1579 ok(attrs
[3].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1580 ok(attrs
[0].fClusterStart
== 1, "fClusterStart incorrect\n");
1581 ok(attrs
[1].fClusterStart
== 1, "fClusterStart incorrect\n");
1582 ok(attrs
[2].fClusterStart
== 1, "fClusterStart incorrect\n");
1583 ok(attrs
[3].fClusterStart
== 1, "fClusterStart incorrect\n");
1584 ok(attrs
[0].fDiacritic
== 0, "fDiacritic incorrect\n");
1585 ok(attrs
[1].fDiacritic
== 0, "fDiacritic incorrect\n");
1586 ok(attrs
[2].fDiacritic
== 0, "fDiacritic incorrect\n");
1587 ok(attrs
[3].fDiacritic
== 0, "fDiacritic incorrect\n");
1588 ok(attrs
[0].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1589 ok(attrs
[1].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1590 ok(attrs
[2].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1591 ok(attrs
[3].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1593 ScriptFreeCache(&sc
);
1596 memset(glyphs2
,-1,sizeof(glyphs2
));
1597 memset(glyphs3
,-1,sizeof(glyphs3
));
1598 memset(logclust
,-1,sizeof(logclust
));
1599 memset(attrs
,-1,sizeof(attrs
));
1601 GetGlyphIndicesW(hdc
, test2
, 4, glyphs3
, 0);
1603 hr
= ScriptShape(hdc
, &sc
, test2
, 4, 4, &items
[0].a
, glyphs2
, logclust
, attrs
, &nb
);
1604 ok(hr
== S_OK
, "ScriptShape should return S_OK not %08x\n", hr
);
1605 ok(nb
== 4, "Wrong number of items\n");
1606 ok(glyphs2
[0] == glyphs3
[0], "Incorrect glyph for 0x202B\n");
1607 ok(glyphs2
[3] == glyphs3
[3], "Incorrect glyph for 0x202C\n");
1608 ok(logclust
[0] == 0, "clusters out of order\n");
1609 ok(logclust
[1] == 1, "clusters out of order\n");
1610 ok(logclust
[2] == 2, "clusters out of order\n");
1611 ok(logclust
[3] == 3, "clusters out of order\n");
1612 ok(attrs
[0].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1613 ok(attrs
[1].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1614 ok(attrs
[2].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1615 ok(attrs
[3].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1616 ok(attrs
[0].fClusterStart
== 1, "fClusterStart incorrect\n");
1617 ok(attrs
[1].fClusterStart
== 1, "fClusterStart incorrect\n");
1618 ok(attrs
[2].fClusterStart
== 1, "fClusterStart incorrect\n");
1619 ok(attrs
[3].fClusterStart
== 1, "fClusterStart incorrect\n");
1620 ok(attrs
[0].fDiacritic
== 0, "fDiacritic incorrect\n");
1621 ok(attrs
[1].fDiacritic
== 0, "fDiacritic incorrect\n");
1622 ok(attrs
[2].fDiacritic
== 0, "fDiacritic incorrect\n");
1623 ok(attrs
[3].fDiacritic
== 0, "fDiacritic incorrect\n");
1624 ok(attrs
[0].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1625 ok(attrs
[1].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1626 ok(attrs
[2].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1627 ok(attrs
[3].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1629 /* modify LTR to RTL */
1630 items
[0].a
.fRTL
= 1;
1631 memset(glyphs2
,-1,sizeof(glyphs2
));
1632 memset(logclust
,-1,sizeof(logclust
));
1633 memset(attrs
,-1,sizeof(attrs
));
1634 hr
= ScriptShape(hdc
, &sc
, test1
, 4, 4, &items
[0].a
, glyphs2
, logclust
, attrs
, &nb
);
1635 ok(hr
== S_OK
, "ScriptShape should return S_OK not %08x\n", hr
);
1636 ok(nb
== 4, "Wrong number of items\n");
1637 ok(glyphs2
[0] == glyphs
[3], "Glyphs not reordered properly\n");
1638 ok(glyphs2
[1] == glyphs
[2], "Glyphs not reordered properly\n");
1639 ok(glyphs2
[2] == glyphs
[1], "Glyphs not reordered properly\n");
1640 ok(glyphs2
[3] == glyphs
[0], "Glyphs not reordered properly\n");
1641 ok(logclust
[0] == 3, "clusters out of order\n");
1642 ok(logclust
[1] == 2, "clusters out of order\n");
1643 ok(logclust
[2] == 1, "clusters out of order\n");
1644 ok(logclust
[3] == 0, "clusters out of order\n");
1645 ok(attrs
[0].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1646 ok(attrs
[1].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1647 ok(attrs
[2].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1648 ok(attrs
[3].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1649 ok(attrs
[0].fClusterStart
== 1, "fClusterStart incorrect\n");
1650 ok(attrs
[1].fClusterStart
== 1, "fClusterStart incorrect\n");
1651 ok(attrs
[2].fClusterStart
== 1, "fClusterStart incorrect\n");
1652 ok(attrs
[3].fClusterStart
== 1, "fClusterStart incorrect\n");
1653 ok(attrs
[0].fDiacritic
== 0, "fDiacritic incorrect\n");
1654 ok(attrs
[1].fDiacritic
== 0, "fDiacritic incorrect\n");
1655 ok(attrs
[2].fDiacritic
== 0, "fDiacritic incorrect\n");
1656 ok(attrs
[3].fDiacritic
== 0, "fDiacritic incorrect\n");
1657 ok(attrs
[0].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1658 ok(attrs
[1].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1659 ok(attrs
[2].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1660 ok(attrs
[3].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1662 ScriptFreeCache(&sc
);
1664 /* some control characters are shown as blank */
1665 for (i
= 0; i
< 2; i
++)
1667 static const WCHAR space
[] = {' ', 0};
1668 static const WCHAR blanks
[] = {'\t', '\r', '\n', 0x001C, 0x001D, 0x001E, 0x001F,0};
1669 HFONT font
, oldfont
= NULL
;
1672 font
= GetCurrentObject(hdc
, OBJ_FONT
);
1673 GetObjectA(font
, sizeof(lf
), &lf
);
1675 lstrcpyA(lf
.lfFaceName
, "MS Sans Serif");
1676 font
= CreateFontIndirectA(&lf
);
1677 oldfont
= SelectObject(hdc
, font
);
1680 hr
= ScriptItemize(space
, 1, 2, NULL
, NULL
, items
, NULL
);
1681 ok(hr
== S_OK
, "%s: expected S_OK, got %08x\n", lf
.lfFaceName
, hr
);
1683 hr
= ScriptShape(hdc
, &sc
, space
, 1, 1, &items
[0].a
, glyphs
, logclust
, attrs
, &nb
);
1684 ok(hr
== S_OK
, "%s: expected S_OK, got %08x\n", lf
.lfFaceName
, hr
);
1685 ok(nb
== 1, "%s: expected 1, got %d\n", lf
.lfFaceName
, nb
);
1687 for (j
= 0; blanks
[j
]; j
++)
1689 hr
= ScriptItemize(&blanks
[j
], 1, 2, NULL
, NULL
, items
, NULL
);
1690 ok(hr
== S_OK
, "%s: [%02x] expected S_OK, got %08x\n", lf
.lfFaceName
, blanks
[j
], hr
);
1692 hr
= ScriptShape(hdc
, &sc
, &blanks
[j
], 1, 1, &items
[0].a
, glyphs2
, logclust
, attrs
, &nb
);
1693 ok(hr
== S_OK
, "%s: [%02x] expected S_OK, got %08x\n", lf
.lfFaceName
, blanks
[j
], hr
);
1694 ok(nb
== 1, "%s: [%02x] expected 1, got %d\n", lf
.lfFaceName
, blanks
[j
], nb
);
1696 ok(glyphs
[0] == glyphs2
[0] ||
1697 broken(glyphs2
[0] == blanks
[j
] && (blanks
[j
] < 0x10)),
1698 "%s: [%02x] expected %04x, got %04x\n", lf
.lfFaceName
, blanks
[j
], glyphs
[0], glyphs2
[0]);
1701 DeleteObject(SelectObject(hdc
, oldfont
));
1702 ScriptFreeCache(&sc
);
1706 static void test_ScriptPlace(HDC hdc
)
1708 static const WCHAR test1
[] = {'t', 'e', 's', 't',0};
1711 SCRIPT_CACHE sc
= NULL
;
1712 WORD glyphs
[4], logclust
[4];
1713 SCRIPT_VISATTR attrs
[4];
1714 SCRIPT_ITEM items
[2];
1719 hr
= ScriptItemize(test1
, 4, 2, NULL
, NULL
, items
, NULL
);
1720 ok(hr
== S_OK
, "ScriptItemize should return S_OK not %08x\n", hr
);
1721 ok(items
[0].a
.fNoGlyphIndex
== FALSE
, "fNoGlyphIndex TRUE\n");
1723 hr
= ScriptShape(hdc
, &sc
, test1
, 4, 4, &items
[0].a
, glyphs
, logclust
, attrs
, &nb
);
1724 ok(hr
== S_OK
, "ScriptShape should return S_OK not %08x\n", hr
);
1725 ok(items
[0].a
.fNoGlyphIndex
== FALSE
, "fNoGlyphIndex TRUE\n");
1727 hr
= ScriptPlace(hdc
, &sc
, glyphs
, 4, NULL
, &items
[0].a
, widths
, NULL
, NULL
);
1728 ok(hr
== E_INVALIDARG
, "ScriptPlace should return E_INVALIDARG not %08x\n", hr
);
1730 hr
= ScriptPlace(NULL
, &sc
, glyphs
, 4, attrs
, &items
[0].a
, widths
, NULL
, NULL
);
1731 ok(broken(hr
== E_PENDING
) ||
1732 hr
== E_INVALIDARG
|| /* Vista, W2K8 */
1733 hr
== E_FAIL
, /* WIN7 */
1734 "ScriptPlace should return E_FAIL or E_INVALIDARG, not %08x\n", hr
);
1736 hr
= ScriptPlace(NULL
, &sc
, glyphs
, 4, attrs
, &items
[0].a
, widths
, offset
, NULL
);
1737 ok(hr
== E_PENDING
, "ScriptPlace should return E_PENDING not %08x\n", hr
);
1739 hr
= ScriptPlace(NULL
, &sc
, glyphs
, 4, attrs
, &items
[0].a
, widths
, NULL
, abc
);
1740 ok(broken(hr
== E_PENDING
) ||
1741 hr
== E_INVALIDARG
|| /* Vista, W2K8 */
1742 hr
== E_FAIL
, /* WIN7 */
1743 "ScriptPlace should return E_FAIL or E_INVALIDARG, not %08x\n", hr
);
1745 hr
= ScriptPlace(hdc
, &sc
, glyphs
, 4, attrs
, &items
[0].a
, widths
, offset
, NULL
);
1746 ok(hr
== S_OK
, "ScriptPlace should return S_OK not %08x\n", hr
);
1747 ok(items
[0].a
.fNoGlyphIndex
== FALSE
, "fNoGlyphIndex TRUE\n");
1751 int old_width
= widths
[0];
1752 attrs
[0].fZeroWidth
= 1;
1754 hr
= ScriptPlace(hdc
, &sc
, glyphs
, 4, attrs
, &items
[0].a
, widths
, offset
, NULL
);
1755 ok(hr
== S_OK
, "ScriptPlace should return S_OK not %08x\n", hr
);
1756 ok(widths
[0] == 0, "got width %d\n", widths
[0]);
1757 widths
[0] = old_width
;
1760 skip("Glyph already has zero-width - skipping fZeroWidth test\n");
1762 ret
= ExtTextOutW(hdc
, 1, 1, 0, NULL
, glyphs
, 4, widths
);
1763 ok(ret
, "ExtTextOutW should return TRUE\n");
1765 ScriptFreeCache(&sc
);
1768 static void test_ScriptItemIzeShapePlace(HDC hdc
, unsigned short pwOutGlyphs
[256])
1772 const SCRIPT_PROPERTIES
**ppSp
;
1776 SCRIPT_ITEM pItem
[255];
1778 WCHAR TestItem1
[] = {'T', 'e', 's', 't', 'a', 0};
1779 WCHAR TestItem2
[] = {'T', 'e', 's', 't', 'b', 0};
1780 WCHAR TestItem3
[] = {'T', 'e', 's', 't', 'c',' ','1','2','3',' ',' ','e','n','d',0};
1781 WCHAR TestItem4
[] = {'T', 'e', 's', 't', 'd',' ',0x0684,0x0694,0x06a4,' ',' ','\r','\n','e','n','d',0};
1782 WCHAR TestItem5
[] = {0x0684,'T','e','s','t','e',' ',0x0684,0x0694,0x06a4,' ',' ','e','n','d',0};
1783 WCHAR TestItem6
[] = {'T', 'e', 's', 't', 'f',' ',' ',' ','\r','\n','e','n','d',0};
1788 unsigned short pwOutGlyphs1
[256];
1789 unsigned short pwOutGlyphs2
[256];
1790 unsigned short pwLogClust
[256];
1791 SCRIPT_VISATTR psva
[256];
1794 GOFFSET pGoffset
[256];
1798 /* Start testing usp10 functions */
1799 /* This test determines that the pointer returned by ScriptGetProperties is valid
1800 * by checking a known value in the table */
1801 hr
= ScriptGetProperties(&ppSp
, &iMaxProps
);
1802 ok(hr
== S_OK
, "ScriptGetProperties failed: 0x%08x\n", hr
);
1803 trace("number of script properties %d\n", iMaxProps
);
1804 ok (iMaxProps
> 0, "Number of scripts returned should not be 0\n");
1806 ok( ppSp
[0]->langid
== 0, "Langid[0] not = to 0\n"); /* Check a known value to ensure */
1809 /* This is a valid test that will cause parsing to take place */
1812 hr
= ScriptItemize(TestItem1
, cInChars
, cMaxItems
, NULL
, NULL
, pItem
, &pcItems
);
1813 ok (hr
== S_OK
, "ScriptItemize should return S_OK, returned %08x\n", hr
);
1814 /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is *
1816 ok (pcItems
> 0, "The number of SCRIPT_ITEMS should be greater than 0\n");
1818 ok (pItem
[0].iCharPos
== 0 && pItem
[1].iCharPos
== cInChars
,
1819 "Start pos not = 0 (%d) or end pos not = %d (%d)\n",
1820 pItem
[0].iCharPos
, cInChars
, pItem
[1].iCharPos
);
1822 /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue
1823 * ie. ScriptItemize has succeeded and that pItem has been set */
1826 psc
= NULL
; /* must be null on first call */
1828 cMaxGlyphs
= cInChars
;
1829 hr
= ScriptShape(NULL
, &psc
, TestItem1
, cChars
,
1830 cMaxGlyphs
, &pItem
[0].a
,
1831 pwOutGlyphs1
, pwLogClust
, psva
, &pcGlyphs
);
1832 ok (hr
== E_PENDING
, "If psc is NULL (%08x) the E_PENDING should be returned\n", hr
);
1834 hr
= ScriptShape(hdc
, &psc
, TestItem1
, cChars
,
1835 cMaxGlyphs
, &pItem
[0].a
,
1836 pwOutGlyphs1
, pwLogClust
, psva
, &pcGlyphs
);
1837 ok (hr
== E_OUTOFMEMORY
, "If not enough output area cChars (%d) is > than CMaxGlyphs "
1838 "(%d) but not E_OUTOFMEMORY\n",
1839 cChars
, cMaxGlyphs
);
1841 hr
= ScriptShape(hdc
, &psc
, TestItem1
, cChars
,
1842 cMaxGlyphs
, &pItem
[0].a
,
1843 pwOutGlyphs1
, pwLogClust
, psva
, &pcGlyphs
);
1844 ok (hr
== S_OK
, "ScriptShape should return S_OK not (%08x)\n", hr
);
1845 ok (psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
1846 ok (pcGlyphs
== cChars
, "Chars in (%d) should equal Glyphs out (%d)\n", cChars
, pcGlyphs
);
1848 hr
= ScriptPlace(hdc
, &psc
, pwOutGlyphs1
, pcGlyphs
, psva
, &pItem
[0].a
, piAdvance
,
1850 ok (hr
== S_OK
, "ScriptPlace should return S_OK not (%08x)\n", hr
);
1851 hr
= ScriptPlace(NULL
, &psc
, pwOutGlyphs1
, pcGlyphs
, psva
, &pItem
[0].a
, piAdvance
,
1853 ok (hr
== S_OK
, "ScriptPlace should return S_OK not (%08x)\n", hr
);
1854 for (cnt
=0; cnt
< pcGlyphs
; cnt
++)
1855 pwOutGlyphs
[cnt
] = pwOutGlyphs1
[cnt
]; /* Send to next function */
1858 /* This test will check to make sure that SCRIPT_CACHE is reused and that not translation *
1859 * takes place if fNoGlyphIndex is set. */
1863 hr
= ScriptItemize(TestItem2
, cInChars
, cMaxItems
, NULL
, NULL
, pItem
, &pcItems
);
1864 ok (hr
== S_OK
, "ScriptItemize should return S_OK, returned %08x\n", hr
);
1865 /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is *
1867 ok (pItem
[0].iCharPos
== 0 && pItem
[1].iCharPos
== cInChars
,
1868 "Start pos not = 0 (%d) or end pos not = %d (%d)\n",
1869 pItem
[0].iCharPos
, cInChars
, pItem
[1].iCharPos
);
1870 /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue */
1874 pItem
[0].a
.fNoGlyphIndex
= 1; /* say no translate */
1875 hr
= ScriptShape(NULL
, &psc
, TestItem2
, cChars
,
1876 cMaxGlyphs
, &pItem
[0].a
,
1877 pwOutGlyphs2
, pwLogClust
, psva
, &pcGlyphs
);
1878 ok (hr
!= E_PENDING
, "If psc should not be NULL (%08x) and the E_PENDING should be returned\n", hr
);
1879 ok (hr
== S_OK
, "ScriptShape should return S_OK not (%08x)\n", hr
);
1880 ok (psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
1881 ok (pcGlyphs
== cChars
, "Chars in (%d) should equal Glyphs out (%d)\n", cChars
, pcGlyphs
);
1882 for (cnt
=0; cnt
< cChars
&& TestItem2
[cnt
] == pwOutGlyphs2
[cnt
]; cnt
++) {}
1883 ok (cnt
== cChars
, "Translation to place when told not to. WCHAR %d - %04x != %04x\n",
1884 cnt
, TestItem2
[cnt
], pwOutGlyphs2
[cnt
]);
1886 hr
= ScriptPlace(hdc
, &psc
, pwOutGlyphs2
, pcGlyphs
, psva
, &pItem
[0].a
, piAdvance
,
1888 ok (hr
== S_OK
, "ScriptPlace should return S_OK not (%08x)\n", hr
);
1891 ScriptFreeCache( &psc
);
1892 ok (!psc
, "psc is not null after ScriptFreeCache\n");
1896 /* This is a valid test that will cause parsing to take place and create 3 script_items */
1897 cInChars
= (sizeof(TestItem3
)/2)-1;
1899 hr
= ScriptItemize(TestItem3
, cInChars
, cMaxItems
, NULL
, NULL
, pItem
, &pcItems
);
1900 ok (hr
== S_OK
, "ScriptItemize should return S_OK, returned %08x\n", hr
);
1903 ok (pcItems
== 3, "The number of SCRIPT_ITEMS should be 3 not %d\n", pcItems
);
1906 ok (pItem
[0].iCharPos
== 0 && pItem
[1].iCharPos
== 6,
1907 "Start pos [0] not = 0 (%d) or end pos [1] not = %d\n",
1908 pItem
[0].iCharPos
, pItem
[1].iCharPos
);
1909 ok (pItem
[1].iCharPos
== 6 && pItem
[2].iCharPos
== 11,
1910 "Start pos [1] not = 6 (%d) or end pos [2] not = 11 (%d)\n",
1911 pItem
[1].iCharPos
, pItem
[2].iCharPos
);
1912 ok (pItem
[2].iCharPos
== 11 && pItem
[3].iCharPos
== cInChars
,
1913 "Start pos [2] not = 11 (%d) or end [3] pos not = 14 (%d), cInChars = %d\n",
1914 pItem
[2].iCharPos
, pItem
[3].iCharPos
, cInChars
);
1918 /* This is a valid test that will cause parsing to take place and create 5 script_items */
1919 cInChars
= (sizeof(TestItem4
)/2)-1;
1921 hr
= ScriptItemize(TestItem4
, cInChars
, cMaxItems
, NULL
, NULL
, pItem
, &pcItems
);
1922 ok (hr
== S_OK
, "ScriptItemize should return S_OK, returned %08x\n", hr
);
1925 ok (pcItems
== 5, "The number of SCRIPT_ITEMS should be 5 not %d\n", pcItems
);
1928 ok (pItem
[0].iCharPos
== 0 && pItem
[1].iCharPos
== 6,
1929 "Start pos [0] not = 0 (%d) or end pos [1] not = %d\n",
1930 pItem
[0].iCharPos
, pItem
[1].iCharPos
);
1931 ok (pItem
[0].a
.s
.uBidiLevel
== 0, "Should have been bidi=0 not %d\n",
1932 pItem
[0].a
.s
.uBidiLevel
);
1933 ok (pItem
[1].iCharPos
== 6 && pItem
[2].iCharPos
== 11,
1934 "Start pos [1] not = 6 (%d) or end pos [2] not = 11 (%d)\n",
1935 pItem
[1].iCharPos
, pItem
[2].iCharPos
);
1936 ok (pItem
[1].a
.s
.uBidiLevel
== 1, "Should have been bidi=1 not %d\n",
1937 pItem
[1].a
.s
.uBidiLevel
);
1938 ok (pItem
[2].iCharPos
== 11 && pItem
[3].iCharPos
== 12,
1939 "Start pos [2] not = 11 (%d) or end [3] pos not = 12 (%d)\n",
1940 pItem
[2].iCharPos
, pItem
[3].iCharPos
);
1941 ok (pItem
[2].a
.s
.uBidiLevel
== 0, "Should have been bidi=0 not %d\n",
1942 pItem
[2].a
.s
.uBidiLevel
);
1943 ok (pItem
[3].iCharPos
== 12 && pItem
[4].iCharPos
== 13,
1944 "Start pos [3] not = 12 (%d) or end [4] pos not = 13 (%d)\n",
1945 pItem
[3].iCharPos
, pItem
[4].iCharPos
);
1946 ok (pItem
[3].a
.s
.uBidiLevel
== 0, "Should have been bidi=0 not %d\n",
1947 pItem
[3].a
.s
.uBidiLevel
);
1948 ok (pItem
[4].iCharPos
== 13 && pItem
[5].iCharPos
== cInChars
,
1949 "Start pos [4] not = 13 (%d) or end [5] pos not = 16 (%d), cInChars = %d\n",
1950 pItem
[4].iCharPos
, pItem
[5].iCharPos
, cInChars
);
1955 * This test is for when the first unicode character requires bidi support
1957 cInChars
= (sizeof(TestItem5
)-1)/sizeof(WCHAR
);
1958 hr
= ScriptItemize(TestItem5
, cInChars
, cMaxItems
, NULL
, NULL
, pItem
, &pcItems
);
1959 ok (hr
== S_OK
, "ScriptItemize should return S_OK, returned %08x\n", hr
);
1960 ok (pcItems
== 4, "There should have been 4 items, found %d\n", pcItems
);
1961 ok (pItem
[0].a
.s
.uBidiLevel
== 1, "The first character should have been bidi=1 not %d\n",
1962 pItem
[0].a
.s
.uBidiLevel
);
1964 /* This test checks to make sure that the test to see if there are sufficient buffers to store *
1965 * the pointer to the last char works. Note that windows often needs a greater number of *
1966 * SCRIPT_ITEMS to process a string than is returned in pcItems. */
1967 cInChars
= (sizeof(TestItem6
)/2)-1;
1969 hr
= ScriptItemize(TestItem6
, cInChars
, cMaxItems
, NULL
, NULL
, pItem
, &pcItems
);
1970 ok (hr
== E_OUTOFMEMORY
, "ScriptItemize should return E_OUTOFMEMORY, returned %08x\n", hr
);
1974 static void test_ScriptGetCMap(HDC hdc
, unsigned short pwOutGlyphs
[256])
1977 SCRIPT_CACHE psc
= NULL
;
1980 unsigned short pwOutGlyphs2
[256];
1981 unsigned short pwOutGlyphs3
[256];
1985 static const WCHAR TestItem1
[] = {'T', 'e', 's', 't', 'a', 0};
1986 static const WCHAR TestItem2
[] = {0x202B, 'i', 'n', 0x202C,0};
1987 static const WCHAR TestItem3
[] = {'a','b','c','d','(','<','{','[',0x2039,0};
1988 static const WCHAR TestItem3b
[] = {'a','b','c','d',')','>','}',']',0x203A,0};
1990 /* Check to make sure that SCRIPT_CACHE gets allocated ok */
1992 cInChars
= cChars
= 5;
1993 /* Some sanity checks for ScriptGetCMap */
1995 hr
= ScriptGetCMap(NULL
, NULL
, NULL
, 0, 0, NULL
);
1996 ok( hr
== E_INVALIDARG
, "(NULL,NULL,NULL,0,0,NULL), "
1997 "expected E_INVALIDARG, got %08x\n", hr
);
1999 hr
= ScriptGetCMap(NULL
, NULL
, TestItem1
, cInChars
, dwFlags
, pwOutGlyphs3
);
2000 ok( hr
== E_INVALIDARG
, "(NULL,NULL,TestItem1, cInChars, dwFlags, pwOutGlyphs3), "
2001 "expected E_INVALIDARG, got %08x\n", hr
);
2003 /* Set psc to NULL, to be able to check if a pointer is returned in psc */
2005 hr
= ScriptGetCMap(NULL
, &psc
, TestItem1
, cInChars
, 0, pwOutGlyphs3
);
2006 ok( hr
== E_PENDING
, "(NULL,&psc,NULL,0,0,NULL), expected E_PENDING, "
2008 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2010 /* Set psc to NULL but add hdc, to be able to check if a pointer is returned in psc */
2012 hr
= ScriptGetCMap(hdc
, &psc
, TestItem1
, cInChars
, 0, pwOutGlyphs3
);
2013 ok( hr
== S_OK
, "ScriptGetCMap(NULL,&psc,NULL,0,0,NULL), expected S_OK, "
2015 ok( psc
!= NULL
, "ScritpGetCMap expected psc to be not NULL\n");
2016 ScriptFreeCache( &psc
);
2018 /* Set psc to NULL, to be able to check if a pointer is returned in psc */
2020 hr
= ScriptGetCMap(NULL
, &psc
, TestItem1
, cInChars
, dwFlags
, pwOutGlyphs3
);
2021 ok( hr
== E_PENDING
, "(NULL,&psc,), expected E_PENDING, got %08x\n", hr
);
2022 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2023 /* Check to see if the results are the same as those returned by ScriptShape */
2024 hr
= ScriptGetCMap(hdc
, &psc
, TestItem1
, cInChars
, dwFlags
, pwOutGlyphs3
);
2025 ok (hr
== S_OK
, "ScriptGetCMap should return S_OK not (%08x)\n", hr
);
2026 ok (psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2027 for (cnt
=0; cnt
< cChars
&& pwOutGlyphs
[cnt
] == pwOutGlyphs3
[cnt
]; cnt
++) {}
2028 ok (cnt
== cInChars
, "Translation not correct. WCHAR %d - %04x != %04x\n",
2029 cnt
, pwOutGlyphs
[cnt
], pwOutGlyphs3
[cnt
]);
2031 ScriptFreeCache( &psc
);
2032 ok (!psc
, "psc is not null after ScriptFreeCache\n");
2034 /* ScriptGetCMap returns whatever font defines, no special treatment for control chars */
2035 cInChars
= cChars
= 4;
2036 GetGlyphIndicesW(hdc
, TestItem2
, cInChars
, pwOutGlyphs2
, 0);
2038 hr
= ScriptGetCMap(hdc
, &psc
, TestItem2
, cInChars
, dwFlags
, pwOutGlyphs3
);
2039 if (pwOutGlyphs3
[0] == 0 || pwOutGlyphs3
[3] == 0)
2040 ok(hr
== S_FALSE
, "ScriptGetCMap should return S_FALSE not (%08x)\n", hr
);
2042 ok(hr
== S_OK
, "ScriptGetCMap should return S_OK not (%08x)\n", hr
);
2044 ok(psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2045 ok(pwOutGlyphs3
[0] == pwOutGlyphs2
[0], "expected glyph %d, got %d\n", pwOutGlyphs2
[0], pwOutGlyphs3
[0]);
2046 ok(pwOutGlyphs3
[3] == pwOutGlyphs2
[3], "expected glyph %d, got %d\n", pwOutGlyphs2
[3], pwOutGlyphs3
[3]);
2048 cInChars
= cChars
= 9;
2049 hr
= ScriptGetCMap(hdc
, &psc
, TestItem3b
, cInChars
, dwFlags
, pwOutGlyphs2
);
2050 ok (hr
== S_OK
, "ScriptGetCMap should return S_OK not (%08x)\n", hr
);
2051 ok (psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2053 cInChars
= cChars
= 9;
2055 hr
= ScriptGetCMap(hdc
, &psc
, TestItem3
, cInChars
, dwFlags
, pwOutGlyphs3
);
2056 ok (hr
== S_OK
, "ScriptGetCMap should return S_OK not (%08x)\n", hr
);
2057 ok (psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2058 ok(pwOutGlyphs3
[0] == pwOutGlyphs2
[0], "glyph incorrectly altered\n");
2059 ok(pwOutGlyphs3
[1] == pwOutGlyphs2
[1], "glyph incorrectly altered\n");
2060 ok(pwOutGlyphs3
[2] == pwOutGlyphs2
[2], "glyph incorrectly altered\n");
2061 ok(pwOutGlyphs3
[3] == pwOutGlyphs2
[3], "glyph incorrectly altered\n");
2062 ok(pwOutGlyphs3
[4] == pwOutGlyphs2
[4], "glyph not mirrored correctly\n");
2063 ok(pwOutGlyphs3
[5] == pwOutGlyphs2
[5], "glyph not mirrored correctly\n");
2064 ok(pwOutGlyphs3
[6] == pwOutGlyphs2
[6], "glyph not mirrored correctly\n");
2065 ok(pwOutGlyphs3
[7] == pwOutGlyphs2
[7], "glyph not mirrored correctly\n");
2066 ok(pwOutGlyphs3
[8] == pwOutGlyphs2
[8], "glyph not mirrored correctly\n");
2068 ScriptFreeCache( &psc
);
2069 ok (!psc
, "psc is not null after ScriptFreeCache\n");
2072 #define MAX_ENUM_FONTS 4096
2074 struct enum_font_data
2077 ENUMLOGFONTA elf
[MAX_ENUM_FONTS
];
2080 static INT CALLBACK
enum_bitmap_font_proc(const LOGFONTA
*lf
, const TEXTMETRICA
*ntm
, DWORD type
, LPARAM lParam
)
2082 struct enum_font_data
*efnd
= (struct enum_font_data
*)lParam
;
2084 if (type
& (TRUETYPE_FONTTYPE
| DEVICE_FONTTYPE
)) return 1;
2086 if (efnd
->total
< MAX_ENUM_FONTS
)
2088 efnd
->elf
[efnd
->total
++] = *(ENUMLOGFONTA
*)lf
;
2091 trace("enum tests invalid; you have more than %d fonts\n", MAX_ENUM_FONTS
);
2096 static INT CALLBACK
enum_truetype_proc(const LOGFONTA
*lf
, const TEXTMETRICA
*ntm
, DWORD type
, LPARAM lParam
)
2098 struct enum_font_data
*efnd
= (struct enum_font_data
*)lParam
;
2100 if (!(type
& (TRUETYPE_FONTTYPE
| DEVICE_FONTTYPE
))) return 1;
2102 if (efnd
->total
< MAX_ENUM_FONTS
)
2104 efnd
->elf
[efnd
->total
++] = *(ENUMLOGFONTA
*)lf
;
2107 trace("enum tests invalid; you have more than %d fonts\n", MAX_ENUM_FONTS
);
2112 static void test_ScriptGetFontProperties(HDC hdc
)
2115 SCRIPT_CACHE psc
,old_psc
;
2116 SCRIPT_FONTPROPERTIES sfp
;
2117 HFONT font
, oldfont
;
2119 struct enum_font_data efnd
;
2124 WORD system_lang_id
= PRIMARYLANGID(GetSystemDefaultLangID());
2125 static const WCHAR invalids
[] = {0x0020, 0x200B, 0xF71B};
2126 /* U+0020: numeric space
2127 U+200B: zero width space
2128 U+F71B: unknown, found by black box testing */
2129 BOOL is_arial
, is_times_new_roman
, is_arabic
= (system_lang_id
== LANG_ARABIC
);
2131 /* Some sanity checks for ScriptGetFontProperties */
2133 hr
= ScriptGetFontProperties(NULL
,NULL
,NULL
);
2134 ok( hr
== E_INVALIDARG
, "(NULL,NULL,NULL), expected E_INVALIDARG, got %08x\n", hr
);
2136 hr
= ScriptGetFontProperties(NULL
,NULL
,&sfp
);
2137 ok( hr
== E_INVALIDARG
, "(NULL,NULL,&sfp), expected E_INVALIDARG, got %08x\n", hr
);
2139 /* Set psc to NULL, to be able to check if a pointer is returned in psc */
2141 hr
= ScriptGetFontProperties(NULL
,&psc
,NULL
);
2142 ok( hr
== E_INVALIDARG
, "(NULL,&psc,NULL), expected E_INVALIDARG, got %08x\n", hr
);
2143 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2145 /* Set psc to NULL, to be able to check if a pointer is returned in psc */
2147 hr
= ScriptGetFontProperties(NULL
,&psc
,&sfp
);
2148 ok( hr
== E_PENDING
, "(NULL,&psc,&sfp), expected E_PENDING, got %08x\n", hr
);
2149 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2151 hr
= ScriptGetFontProperties(hdc
,NULL
,NULL
);
2152 ok( hr
== E_INVALIDARG
, "(hdc,NULL,NULL), expected E_INVALIDARG, got %08x\n", hr
);
2154 hr
= ScriptGetFontProperties(hdc
,NULL
,&sfp
);
2155 ok( hr
== E_INVALIDARG
, "(hdc,NULL,&sfp), expected E_INVALIDARG, got %08x\n", hr
);
2157 /* Set psc to NULL, to be able to check if a pointer is returned in psc */
2159 hr
= ScriptGetFontProperties(hdc
,&psc
,NULL
);
2160 ok( hr
== E_INVALIDARG
, "(hdc,&psc,NULL), expected E_INVALIDARG, got %08x\n", hr
);
2161 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2163 /* Pass an invalid sfp */
2165 sfp
.cBytes
= sizeof(SCRIPT_FONTPROPERTIES
) - 1;
2166 hr
= ScriptGetFontProperties(hdc
,&psc
,&sfp
);
2167 ok( hr
== E_INVALIDARG
, "(hdc,&psc,&sfp) invalid, expected E_INVALIDARG, got %08x\n", hr
);
2168 ok( psc
!= NULL
, "Expected a pointer in psc, got NULL\n");
2169 ScriptFreeCache(&psc
);
2170 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2172 /* Give it the correct cBytes, we don't care about what's coming back */
2173 sfp
.cBytes
= sizeof(SCRIPT_FONTPROPERTIES
);
2175 hr
= ScriptGetFontProperties(hdc
,&psc
,&sfp
);
2176 ok( hr
== S_OK
, "(hdc,&psc,&sfp) partly initialized, expected S_OK, got %08x\n", hr
);
2177 ok( psc
!= NULL
, "Expected a pointer in psc, got NULL\n");
2179 /* Save the psc pointer */
2181 /* Now a NULL hdc again */
2182 hr
= ScriptGetFontProperties(NULL
,&psc
,&sfp
);
2183 ok( hr
== S_OK
, "(NULL,&psc,&sfp), expected S_OK, got %08x\n", hr
);
2184 ok( psc
== old_psc
, "Expected psc not to be changed, was %p is now %p\n", old_psc
, psc
);
2185 ScriptFreeCache(&psc
);
2186 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2188 pGetGlyphIndicesW
= (void*)GetProcAddress(GetModuleHandleA("gdi32.dll"), "GetGlyphIndicesW");
2189 if (!pGetGlyphIndicesW
)
2191 win_skip("Skip on WINNT4\n");
2194 memset(&lf
, 0, sizeof(lf
));
2195 lf
.lfCharSet
= DEFAULT_CHARSET
;
2197 EnumFontFamiliesA(hdc
, NULL
, enum_bitmap_font_proc
, (LPARAM
)&efnd
);
2199 for (i
= 0; i
< efnd
.total
; i
++)
2201 if (strlen((char *)efnd
.elf
[i
].elfFullName
) >= LF_FACESIZE
)
2203 trace("Font name to long to test: %s\n",(char *)efnd
.elf
[i
].elfFullName
);
2206 lstrcpyA(lf
.lfFaceName
, (char *)efnd
.elf
[i
].elfFullName
);
2207 font
= CreateFontIndirectA(&lf
);
2208 oldfont
= SelectObject(hdc
, font
);
2210 sfp
.cBytes
= sizeof(SCRIPT_FONTPROPERTIES
);
2212 hr
= ScriptGetFontProperties(hdc
, &psc
, &sfp
);
2213 ok(hr
== S_OK
, "ScriptGetFontProperties expected S_OK, got %08x\n", hr
);
2214 if (winetest_interactive
)
2216 trace("bitmap font %s\n", lf
.lfFaceName
);
2217 trace("wgBlank %04x\n", sfp
.wgBlank
);
2218 trace("wgDefault %04x\n", sfp
.wgDefault
);
2219 trace("wgInvalid %04x\n", sfp
.wgInvalid
);
2220 trace("wgKashida %04x\n", sfp
.wgKashida
);
2221 trace("iKashidaWidth %d\n", sfp
.iKashidaWidth
);
2224 ret
= GetTextMetricsA(hdc
, &tmA
);
2225 ok(ret
!= 0, "GetTextMetricsA failed!\n");
2227 ret
= pGetGlyphIndicesW(hdc
, invalids
, 1, gi
, GGI_MARK_NONEXISTING_GLYPHS
);
2228 ok(ret
!= GDI_ERROR
, "GetGlyphIndicesW failed!\n");
2230 ok(sfp
.wgBlank
== tmA
.tmBreakChar
|| sfp
.wgBlank
== gi
[0], "bitmap font %s wgBlank %04x tmBreakChar %04x Space %04x\n", lf
.lfFaceName
, sfp
.wgBlank
, tmA
.tmBreakChar
, gi
[0]);
2232 ok(sfp
.wgDefault
== 0 || sfp
.wgDefault
== tmA
.tmDefaultChar
|| broken(sfp
.wgDefault
== (0x100 | tmA
.tmDefaultChar
)), "bitmap font %s wgDefault %04x, tmDefaultChar %04x\n", lf
.lfFaceName
, sfp
.wgDefault
, tmA
.tmDefaultChar
);
2234 ok(sfp
.wgInvalid
== sfp
.wgBlank
|| broken(is_arabic
), "bitmap font %s wgInvalid %02x wgBlank %02x\n", lf
.lfFaceName
, sfp
.wgInvalid
, sfp
.wgBlank
);
2236 ok(sfp
.wgKashida
== 0xFFFF || broken(is_arabic
), "bitmap font %s wgKashida %02x\n", lf
.lfFaceName
, sfp
.wgKashida
);
2238 ScriptFreeCache(&psc
);
2240 SelectObject(hdc
, oldfont
);
2245 EnumFontFamiliesA(hdc
, NULL
, enum_truetype_proc
, (LPARAM
)&efnd
);
2247 for (i
= 0; i
< efnd
.total
; i
++)
2249 if (strlen((char *)efnd
.elf
[i
].elfFullName
) >= LF_FACESIZE
)
2251 trace("Font name to long to test: %s\n",(char *)efnd
.elf
[i
].elfFullName
);
2254 lstrcpyA(lf
.lfFaceName
, (char *)efnd
.elf
[i
].elfFullName
);
2255 font
= CreateFontIndirectA(&lf
);
2256 oldfont
= SelectObject(hdc
, font
);
2258 sfp
.cBytes
= sizeof(SCRIPT_FONTPROPERTIES
);
2260 hr
= ScriptGetFontProperties(hdc
, &psc
, &sfp
);
2261 ok(hr
== S_OK
, "ScriptGetFontProperties expected S_OK, got %08x\n", hr
);
2262 if (winetest_interactive
)
2264 trace("truetype font %s\n", lf
.lfFaceName
);
2265 trace("wgBlank %04x\n", sfp
.wgBlank
);
2266 trace("wgDefault %04x\n", sfp
.wgDefault
);
2267 trace("wgInvalid %04x\n", sfp
.wgInvalid
);
2268 trace("wgKashida %04x\n", sfp
.wgKashida
);
2269 trace("iKashidaWidth %d\n", sfp
.iKashidaWidth
);
2272 str
[0] = 0x0020; /* U+0020: numeric space */
2273 ret
= pGetGlyphIndicesW(hdc
, str
, 1, gi
, 0);
2274 ok(ret
!= GDI_ERROR
, "GetGlyphIndicesW failed!\n");
2275 ok(sfp
.wgBlank
== gi
[0], "truetype font %s wgBlank %04x gi[0] %04x\n", lf
.lfFaceName
, sfp
.wgBlank
, gi
[0]);
2277 ok(sfp
.wgDefault
== 0 || broken(is_arabic
), "truetype font %s wgDefault %04x\n", lf
.lfFaceName
, sfp
.wgDefault
);
2279 ret
= pGetGlyphIndicesW(hdc
, invalids
, 3, gi
, GGI_MARK_NONEXISTING_GLYPHS
);
2280 ok(ret
!= GDI_ERROR
, "GetGlyphIndicesW failed!\n");
2281 if (gi
[2] != 0xFFFF) /* index of default non exist char */
2282 ok(sfp
.wgInvalid
== gi
[2], "truetype font %s wgInvalid %04x gi[2] %04x\n", lf
.lfFaceName
, sfp
.wgInvalid
, gi
[2]);
2283 else if (gi
[1] != 0xFFFF)
2284 ok(sfp
.wgInvalid
== gi
[1], "truetype font %s wgInvalid %04x gi[1] %04x\n", lf
.lfFaceName
, sfp
.wgInvalid
, gi
[1]);
2285 else if (gi
[0] != 0xFFFF)
2286 ok(sfp
.wgInvalid
== gi
[0], "truetype font %s wgInvalid %04x gi[0] %04x\n", lf
.lfFaceName
, sfp
.wgInvalid
, gi
[0]);
2288 ok(sfp
.wgInvalid
== 0, "truetype font %s wgInvalid %04x expect 0\n", lf
.lfFaceName
, sfp
.wgInvalid
);
2290 str
[0] = 0x0640; /* U+0640: kashida */
2291 ret
= pGetGlyphIndicesW(hdc
, str
, 1, gi
, GGI_MARK_NONEXISTING_GLYPHS
);
2292 ok(ret
!= GDI_ERROR
, "GetGlyphIndicesW failed!\n");
2293 is_arial
= !lstrcmpA(lf
.lfFaceName
, "Arial");
2294 is_times_new_roman
= !lstrcmpA(lf
.lfFaceName
, "Times New Roman");
2295 ok(sfp
.wgKashida
== gi
[0] || broken(is_arial
|| is_times_new_roman
) || broken(is_arabic
), "truetype font %s wgKashida %04x gi[0] %04x\n", lf
.lfFaceName
, sfp
.wgKashida
, gi
[0]);
2297 ScriptFreeCache(&psc
);
2299 SelectObject(hdc
, oldfont
);
2304 static void test_ScriptTextOut(HDC hdc
)
2310 SCRIPT_ITEM pItem
[255];
2312 WCHAR TestItem1
[] = {'T', 'e', 's', 't', 'a', 0};
2317 unsigned short pwOutGlyphs1
[256];
2318 WORD pwLogClust
[256];
2319 SCRIPT_VISATTR psva
[256];
2322 GOFFSET pGoffset
[256];
2327 BOOL fTrailing
= FALSE
;
2328 SCRIPT_LOGATTR
*psla
;
2329 SCRIPT_LOGATTR sla
[256];
2331 /* This is a valid test that will cause parsing to take place */
2334 hr
= ScriptItemize(TestItem1
, cInChars
, cMaxItems
, NULL
, NULL
, pItem
, &pcItems
);
2335 ok (hr
== S_OK
, "ScriptItemize should return S_OK, returned %08x\n", hr
);
2336 /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is *
2338 ok (pcItems
> 0, "The number of SCRIPT_ITEMS should be greater than 0\n");
2340 ok (pItem
[0].iCharPos
== 0 && pItem
[1].iCharPos
== cInChars
,
2341 "Start pos not = 0 (%d) or end pos not = %d (%d)\n",
2342 pItem
[0].iCharPos
, cInChars
, pItem
[1].iCharPos
);
2344 /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue
2345 * ie. ScriptItemize has succeeded and that pItem has been set */
2348 psc
= NULL
; /* must be null on first call */
2351 hr
= ScriptShape(hdc
, &psc
, TestItem1
, cChars
,
2352 cMaxGlyphs
, &pItem
[0].a
,
2353 pwOutGlyphs1
, pwLogClust
, psva
, &pcGlyphs
);
2354 ok (hr
== S_OK
, "ScriptShape should return S_OK not (%08x)\n", hr
);
2355 ok (psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2356 ok (pcGlyphs
== cChars
, "Chars in (%d) should equal Glyphs out (%d)\n", cChars
, pcGlyphs
);
2358 /* Note hdc is needed as glyph info is not yet in psc */
2359 hr
= ScriptPlace(hdc
, &psc
, pwOutGlyphs1
, pcGlyphs
, psva
, &pItem
[0].a
, piAdvance
,
2361 ok (hr
== S_OK
, "Should return S_OK not (%08x)\n", hr
);
2362 ScriptFreeCache(&psc
); /* Get rid of psc for next test set */
2363 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2365 hr
= ScriptTextOut(NULL
, NULL
, 0, 0, 0, NULL
, NULL
, NULL
, 0, NULL
, 0, NULL
, NULL
, NULL
);
2366 ok (hr
== E_INVALIDARG
, "Should return 0 not (%08x)\n", hr
);
2368 hr
= ScriptTextOut(NULL
, NULL
, 0, 0, 0, NULL
, &pItem
[0].a
, NULL
, 0, pwOutGlyphs1
, pcGlyphs
,
2369 piAdvance
, NULL
, pGoffset
);
2370 ok( hr
== E_INVALIDARG
, "(NULL,NULL,TestItem1, cInChars, dwFlags, pwOutGlyphs3), "
2371 "expected E_INVALIDARG, got %08x\n", hr
);
2373 /* Set psc to NULL, to be able to check if a pointer is returned in psc */
2375 hr
= ScriptTextOut(NULL
, &psc
, 0, 0, 0, NULL
, NULL
, NULL
, 0, NULL
, 0,
2377 ok( hr
== E_INVALIDARG
, "(NULL,&psc,NULL,0,0,0,NULL,), expected E_INVALIDARG, "
2379 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2381 /* hdc is required for this one rather than the usual optional */
2383 hr
= ScriptTextOut(NULL
, &psc
, 0, 0, 0, NULL
, &pItem
[0].a
, NULL
, 0, pwOutGlyphs1
, pcGlyphs
,
2384 piAdvance
, NULL
, pGoffset
);
2385 ok( hr
== E_INVALIDARG
, "(NULL,&psc,), expected E_INVALIDARG, got %08x\n", hr
);
2386 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2388 /* Set that it returns 0 status */
2389 hr
= ScriptTextOut(hdc
, &psc
, 0, 0, 0, NULL
, &pItem
[0].a
, NULL
, 0, pwOutGlyphs1
, pcGlyphs
,
2390 piAdvance
, NULL
, pGoffset
);
2391 ok (hr
== S_OK
, "ScriptTextOut should return S_OK not (%08x)\n", hr
);
2393 /* Test Rect Rgn is acceptable */
2398 hr
= ScriptTextOut(hdc
, &psc
, 0, 0, 0, &rect
, &pItem
[0].a
, NULL
, 0, pwOutGlyphs1
, pcGlyphs
,
2399 piAdvance
, NULL
, pGoffset
);
2400 ok (hr
== S_OK
, "ScriptTextOut should return S_OK not (%08x)\n", hr
);
2403 hr
= ScriptCPtoX(iCP
, fTrailing
, cChars
, pcGlyphs
, (const WORD
*) &pwLogClust
,
2404 (const SCRIPT_VISATTR
*) &psva
, (const int *)&piAdvance
, &pItem
[0].a
, &piX
);
2405 ok(hr
== S_OK
, "ScriptCPtoX Stub should return S_OK not %08x\n", hr
);
2407 psla
= (SCRIPT_LOGATTR
*)&sla
;
2408 hr
= ScriptBreak(TestItem1
, cChars
, &pItem
[0].a
, psla
);
2409 ok(hr
== S_OK
, "ScriptBreak Stub should return S_OK not %08x\n", hr
);
2411 /* Clean up and go */
2412 ScriptFreeCache(&psc
);
2413 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2418 static void test_ScriptTextOut2(HDC hdc
)
2420 /* Intent is to validate that the HDC passed into ScriptTextOut is
2421 * used instead of the (possibly) invalid cached one
2428 SCRIPT_ITEM pItem
[255];
2430 WCHAR TestItem1
[] = {'T', 'e', 's', 't', 'a', 0};
2435 unsigned short pwOutGlyphs1
[256];
2436 WORD pwLogClust
[256];
2437 SCRIPT_VISATTR psva
[256];
2440 GOFFSET pGoffset
[256];
2443 /* Create an extra DC that will be used until the ScriptTextOut */
2444 hdc1
= CreateCompatibleDC(hdc
);
2445 ok (hdc1
!= 0, "CreateCompatibleDC failed to create a DC\n");
2446 hdc2
= CreateCompatibleDC(hdc
);
2447 ok (hdc2
!= 0, "CreateCompatibleDC failed to create a DC\n");
2449 /* This is a valid test that will cause parsing to take place */
2452 hr
= ScriptItemize(TestItem1
, cInChars
, cMaxItems
, NULL
, NULL
, pItem
, &pcItems
);
2453 ok (hr
== S_OK
, "ScriptItemize should return S_OK, returned %08x\n", hr
);
2454 /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is *
2456 ok (pcItems
> 0, "The number of SCRIPT_ITEMS should be greater than 0\n");
2458 ok (pItem
[0].iCharPos
== 0 && pItem
[1].iCharPos
== cInChars
,
2459 "Start pos not = 0 (%d) or end pos not = %d (%d)\n",
2460 pItem
[0].iCharPos
, cInChars
, pItem
[1].iCharPos
);
2462 /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue
2463 * ie. ScriptItemize has succeeded and that pItem has been set */
2466 psc
= NULL
; /* must be null on first call */
2469 hr
= ScriptShape(hdc2
, &psc
, TestItem1
, cChars
,
2470 cMaxGlyphs
, &pItem
[0].a
,
2471 pwOutGlyphs1
, pwLogClust
, psva
, &pcGlyphs
);
2472 ok (hr
== S_OK
, "ScriptShape should return S_OK not (%08x)\n", hr
);
2473 ok (psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2474 ok (pcGlyphs
== cChars
, "Chars in (%d) should equal Glyphs out (%d)\n", cChars
, pcGlyphs
);
2478 /* Note hdc is needed as glyph info is not yet in psc */
2479 hr
= ScriptPlace(hdc2
, &psc
, pwOutGlyphs1
, pcGlyphs
, psva
, &pItem
[0].a
, piAdvance
,
2481 ok (hr
== S_OK
, "Should return S_OK not (%08x)\n", hr
);
2483 /* key part!!! cached dc is being deleted */
2484 ret
= DeleteDC(hdc2
);
2485 ok(ret
, "DeleteDC should return 1 not %d\n", ret
);
2487 /* At this point the cached hdc (hdc2) has been destroyed,
2488 * however, we are passing in a *real* hdc (the original hdc).
2489 * The text should be written to that DC
2491 hr
= ScriptTextOut(hdc1
, &psc
, 0, 0, 0, NULL
, &pItem
[0].a
, NULL
, 0, pwOutGlyphs1
, pcGlyphs
,
2492 piAdvance
, NULL
, pGoffset
);
2493 ok (hr
== S_OK
, "ScriptTextOut should return S_OK not (%08x)\n", hr
);
2494 ok (psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2498 /* Clean up and go */
2499 ScriptFreeCache(&psc
);
2500 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2505 static void test_ScriptTextOut3(HDC hdc
)
2511 SCRIPT_ITEM pItem
[255];
2513 WCHAR TestItem1
[] = {' ','\r', 0};
2518 unsigned short pwOutGlyphs1
[256];
2519 WORD pwLogClust
[256];
2520 SCRIPT_VISATTR psva
[256];
2523 GOFFSET pGoffset
[256];
2527 /* This is to ensure that nonexistent glyphs are translated into a valid glyph number */
2530 hr
= ScriptItemize(TestItem1
, cInChars
, cMaxItems
, NULL
, NULL
, pItem
, &pcItems
);
2531 ok (hr
== S_OK
, "ScriptItemize should return S_OK, returned %08x\n", hr
);
2532 /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is *
2534 ok (pcItems
> 0, "The number of SCRIPT_ITEMS should be greater than 0\n");
2536 ok (pItem
[0].iCharPos
== 0 && pItem
[2].iCharPos
== cInChars
,
2537 "Start pos not = 0 (%d) or end pos not = %d (%d)\n",
2538 pItem
[0].iCharPos
, cInChars
, pItem
[2].iCharPos
);
2540 /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue
2541 * ie. ScriptItemize has succeeded and that pItem has been set */
2544 psc
= NULL
; /* must be null on first call */
2547 hr
= ScriptShape(hdc
, &psc
, TestItem1
, cChars
,
2548 cMaxGlyphs
, &pItem
[0].a
,
2549 pwOutGlyphs1
, pwLogClust
, psva
, &pcGlyphs
);
2550 ok (hr
== S_OK
, "ScriptShape should return S_OK not (%08x)\n", hr
);
2551 ok (psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2552 ok (pcGlyphs
== cChars
, "Chars in (%d) should equal Glyphs out (%d)\n", cChars
, pcGlyphs
);
2554 /* Note hdc is needed as glyph info is not yet in psc */
2555 hr
= ScriptPlace(hdc
, &psc
, pwOutGlyphs1
, pcGlyphs
, psva
, &pItem
[0].a
, piAdvance
,
2557 ok (hr
== S_OK
, "Should return S_OK not (%08x)\n", hr
);
2559 /* Test Rect Rgn is acceptable */
2564 hr
= ScriptTextOut(hdc
, &psc
, 0, 0, 0, &rect
, &pItem
[0].a
, NULL
, 0, pwOutGlyphs1
, pcGlyphs
,
2565 piAdvance
, NULL
, pGoffset
);
2566 ok (hr
== S_OK
, "ScriptTextOut should return S_OK not (%08x)\n", hr
);
2568 /* Clean up and go */
2569 ScriptFreeCache(&psc
);
2570 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2574 #define test_item_ScriptXtoX(a,b,c,d,e,f) (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _test_item_ScriptXtoX(a,b,c,d,e,f)
2576 static void _test_item_ScriptXtoX(SCRIPT_ANALYSIS
*psa
, int cChars
, int cGlyphs
, const int* offsets
, const WORD
*pwLogClust
, const int* piAdvance
)
2579 int icChars
, icGlyphs
;
2582 SCRIPT_VISATTR psva
[10];
2587 memset(psva
,0,sizeof(psva
));
2588 direction
= (psa
->fRTL
)?-1:+1;
2590 for(iCP
= 0; iCP
< cChars
; iCP
++)
2595 hr
= ScriptXtoCP(iX
, icChars
, icGlyphs
, pwLogClust
, psva
, piAdvance
, psa
, &piCP
, &piTrailing
);
2596 winetest_ok(hr
== S_OK
, "ScriptXtoCP: should return S_OK not %08x\n", hr
);
2597 winetest_ok(piCP
== iCP
, "ScriptXtoCP: iX=%d should return piCP=%d not %d\n", iX
, iCP
, piCP
);
2598 winetest_ok(piTrailing
== 0, "ScriptXtoCP: iX=%d should return piTrailing=0 not %d\n", iX
, piTrailing
);
2601 for(iCP
= 0; iCP
< cChars
; iCP
++)
2603 iX
= offsets
[iCP
]+direction
;
2606 hr
= ScriptXtoCP(iX
, icChars
, icGlyphs
, pwLogClust
, psva
, piAdvance
, psa
, &piCP
, &piTrailing
);
2607 winetest_ok(hr
== S_OK
, "ScriptXtoCP leading: should return S_OK not %08x\n", hr
);
2608 winetest_ok(piCP
== iCP
, "ScriptXtoCP leading: iX=%d should return piCP=%d not %d\n", iX
, iCP
, piCP
);
2609 winetest_ok(piTrailing
== 0, "ScriptXtoCP leading: iX=%d should return piTrailing=0 not %d\n", iX
, piTrailing
);
2612 for(iCP
= 0; iCP
< cChars
; iCP
++)
2614 iX
= offsets
[iCP
+1]-direction
;
2617 hr
= ScriptXtoCP(iX
, icChars
, icGlyphs
, pwLogClust
, psva
, piAdvance
, psa
, &piCP
, &piTrailing
);
2618 winetest_ok(hr
== S_OK
, "ScriptXtoCP trailing: should return S_OK not %08x\n", hr
);
2619 winetest_ok(piCP
== iCP
, "ScriptXtoCP trailing: iX=%d should return piCP=%d not %d\n", iX
, iCP
, piCP
);
2620 winetest_ok(piTrailing
== 1, "ScriptXtoCP trailing: iX=%d should return piTrailing=1 not %d\n", iX
, piTrailing
);
2623 for(iCP
= 0; iCP
<= cChars
+1; iCP
++)
2628 hr
= ScriptCPtoX(iCP
, fTrailing
, icChars
, icGlyphs
, pwLogClust
, psva
, piAdvance
, psa
, &piX
);
2629 winetest_ok(hr
== S_OK
, "ScriptCPtoX: should return S_OK not %08x\n", hr
);
2630 winetest_ok(piX
== offsets
[iCP
],
2631 "ScriptCPtoX: iCP=%d should return piX=%d not %d\n", iCP
, offsets
[iCP
], piX
);
2634 for(iCP
= 0; iCP
<= cChars
+1; iCP
++)
2639 hr
= ScriptCPtoX(iCP
, fTrailing
, icChars
, icGlyphs
, pwLogClust
, psva
, piAdvance
, psa
, &piX
);
2640 winetest_ok(hr
== S_OK
, "ScriptCPtoX trailing: should return S_OK not %08x\n", hr
);
2641 winetest_ok(piX
== offsets
[iCP
+1],
2642 "ScriptCPtoX trailing: iCP=%d should return piX=%d not %d\n", iCP
, offsets
[iCP
+1], piX
);
2646 #define test_caret_item_ScriptXtoCP(a,b,c,d,e,f) _test_caret_item_ScriptXtoCP(__LINE__,a,b,c,d,e,f)
2648 static void _test_caret_item_ScriptXtoCP(int line
, SCRIPT_ANALYSIS
*psa
, int cChars
, int cGlyphs
, const int* offsets
, const WORD
*pwLogClust
, const int* piAdvance
)
2651 int icChars
, icGlyphs
;
2655 SCRIPT_VISATTR psva
[10];
2659 memset(psva
,0,sizeof(psva
));
2660 direction
= (psa
->fRTL
)?-1:+1;
2662 for(iX
= -1, i
= iCP
= 0; i
< cChars
; i
++)
2664 if (offsets
[i
] != iX
)
2671 hr
= ScriptXtoCP(iX
, icChars
, icGlyphs
, pwLogClust
, psva
, piAdvance
, psa
, &piCP
, &piTrailing
);
2672 ok_(__FILE__
,line
)(hr
== S_OK
, "ScriptXtoCP: should return S_OK not %08x\n", hr
);
2673 ok_(__FILE__
,line
)(piCP
== iCP
, "ScriptXtoCP: iX=%d should return piCP=%d not %d\n", iX
, iCP
, piCP
);
2674 ok_(__FILE__
,line
)(piTrailing
== 0, "ScriptXtoCP: iX=%d should return piTrailing=0 not %d\n", iX
, piTrailing
);
2677 for(iX
= -2, i
= 0; i
< cChars
; i
++)
2679 if (offsets
[i
]+direction
!= iX
)
2681 iX
= offsets
[i
] + direction
;
2686 hr
= ScriptXtoCP(iX
, icChars
, icGlyphs
, pwLogClust
, psva
, piAdvance
, psa
, &piCP
, &piTrailing
);
2687 ok_(__FILE__
,line
)(hr
== S_OK
, "ScriptXtoCP leading: should return S_OK not %08x\n", hr
);
2688 ok_(__FILE__
,line
)(piCP
== iCP
, "ScriptXtoCP leading: iX=%d should return piCP=%d not %d\n", iX
, iCP
, piCP
);
2689 ok_(__FILE__
,line
)(piTrailing
== 0, "ScriptXtoCP leading: iX=%d should return piTrailing=0 not %d\n", iX
, piTrailing
);
2692 for(clusterSize
= 0, iCP
= 0, iX
= -2, i
= 0; i
< cChars
; i
++)
2695 if (offsets
[i
] != offsets
[i
+1])
2697 iX
= offsets
[i
+1]-direction
;
2700 hr
= ScriptXtoCP(iX
, icChars
, icGlyphs
, pwLogClust
, psva
, piAdvance
, psa
, &piCP
, &piTrailing
);
2701 ok_(__FILE__
,line
)(hr
== S_OK
, "ScriptXtoCP trailing: should return S_OK not %08x\n", hr
);
2702 ok_(__FILE__
,line
)(piCP
== iCP
, "ScriptXtoCP trailing: iX=%d should return piCP=%d not %d\n", iX
, iCP
, piCP
);
2703 ok_(__FILE__
,line
)(piTrailing
== clusterSize
, "ScriptXtoCP trailing: iX=%d should return piTrailing=%d not %d\n", iX
, clusterSize
, piTrailing
);
2710 static void test_ScriptXtoX(void)
2711 /****************************************************************************************
2712 * This routine tests the ScriptXtoCP and ScriptCPtoX functions using static variables *
2713 ****************************************************************************************/
2715 WORD pwLogClust
[10] = {0, 0, 0, 1, 1, 2, 2, 3, 3, 3};
2716 WORD pwLogClust_RTL
[10] = {3, 3, 3, 2, 2, 1, 1, 0, 0, 0};
2717 WORD pwLogClust_2
[7] = {4, 3, 3, 2, 1, 0 ,0};
2718 WORD pwLogClust_3
[17] = {0, 1, 1, 1, 1, 4, 5, 6, 6, 8, 8, 8, 8, 11, 11, 13, 13};
2719 WORD pwLogClust_3_RTL
[17] = {13, 13, 11, 11, 8, 8, 8, 8, 6, 6, 5, 4, 1, 1, 1, 1, 0};
2720 int piAdvance
[10] = {201, 190, 210, 180, 170, 204, 189, 195, 212, 203};
2721 int piAdvance_2
[5] = {39, 26, 19, 17, 11};
2722 int piAdvance_3
[15] = {6, 6, 0, 0, 10, 5, 10, 0, 12, 0, 0, 9, 0, 10, 0};
2723 static const int offsets
[13] = {0, 67, 134, 201, 296, 391, 496, 601, 1052, 1503, 1954, 1954, 1954};
2724 static const int offsets_RTL
[13] = {781, 721, 661, 601, 496, 391, 296, 201, 134, 67, 0, 0, 0};
2725 static const int offsets_2
[10] = {112, 101, 92, 84, 65, 39, 19, 0, 0, 0};
2727 static const int offsets_3
[19] = {0, 6, 6, 6, 6, 12, 22, 27, 27, 37, 37, 37, 37, 49, 49, 58, 58, 68, 68};
2728 static const int offsets_3_RTL
[19] = {68, 68, 58, 58, 49, 49, 49, 49, 37, 37, 27, 22, 12, 12, 12, 12, 6, 6};
2730 SCRIPT_VISATTR psva
[15];
2732 SCRIPT_ITEM items
[2];
2737 static const WCHAR hebrW
[] = { 0x5be, 0};
2738 static const WCHAR thaiW
[] = { 0xe2a, 0};
2739 const SCRIPT_PROPERTIES
**ppScriptProperties
;
2741 memset(&sa
, 0 , sizeof(SCRIPT_ANALYSIS
));
2742 memset(psva
, 0, sizeof(psva
));
2745 hr
= ScriptXtoCP(-1, 10, 10, pwLogClust
, psva
, piAdvance
, &sa
, &piCP
, &piTrailing
);
2746 ok(hr
== S_OK
, "ScriptXtoCP should return S_OK not %08x\n", hr
);
2748 ok(piCP
== -1, "Negative iX should return piCP=-1 not %d\n", piCP
);
2750 ok(piCP
== 10, "Negative iX should return piCP=10 not %d\n", piCP
);
2752 for (iX
= 0; iX
<= 7; iX
++)
2756 hr
= ScriptXtoCP(iX
, 1, 1, &clust
, psva
, &advance
, &sa
, &piCP
, &piTrailing
);
2757 ok(piCP
==0 && piTrailing
==0,"%i should return 0(%i) and 0(%i)\n",iX
, piCP
,piTrailing
);
2759 for (iX
= 8; iX
< 16; iX
++)
2763 hr
= ScriptXtoCP(iX
, 1, 1, &clust
, psva
, &advance
, &sa
, &piCP
, &piTrailing
);
2764 ok(piCP
==0 && piTrailing
==1,"%i should return 0(%i) and 1(%i)\n",iX
, piCP
,piTrailing
);
2768 hr
= ScriptXtoCP(-1, 10, 10, pwLogClust_RTL
, psva
, piAdvance
, &sa
, &piCP
, &piTrailing
);
2769 ok(hr
== S_OK
, "ScriptXtoCP should return S_OK not %08x\n", hr
);
2771 ok(piCP
== -1, "Negative iX should return piCP=-1 not %d\n", piCP
);
2773 ok(piCP
== 10, "Negative iX should return piCP=10 not %d\n", piCP
);
2776 hr
= ScriptXtoCP(1954, 10, 10, pwLogClust_RTL
, psva
, piAdvance
, &sa
, &piCP
, &piTrailing
);
2777 ok(hr
== S_OK
, "ScriptXtoCP should return S_OK not %08x\n", hr
);
2778 ok(piCP
== -1, "iX=%d should return piCP=-1 not %d\n", iX
, piCP
);
2779 ok(piTrailing
== 1, "iX=%d should return piTrailing=1 not %d\n", iX
, piTrailing
);
2781 for (iX
= 1; iX
<= 8; iX
++)
2785 hr
= ScriptXtoCP(iX
, 1, 1, &clust
, psva
, &advance
, &sa
, &piCP
, &piTrailing
);
2786 ok(piCP
==0 && piTrailing
==1,"%i should return 0(%i) and 1(%i)\n",iX
,piCP
,piTrailing
);
2788 for (iX
= 9; iX
< 16; iX
++)
2792 hr
= ScriptXtoCP(iX
, 1, 1, &clust
, psva
, &advance
, &sa
, &piCP
, &piTrailing
);
2793 ok(piCP
==0 && piTrailing
==0,"%i should return 0(%i) and 0(%i)\n",iX
,piCP
,piTrailing
);
2797 test_item_ScriptXtoX(&sa
, 10, 10, offsets
, pwLogClust
, piAdvance
);
2799 test_item_ScriptXtoX(&sa
, 10, 10, offsets_RTL
, pwLogClust_RTL
, piAdvance
);
2800 test_item_ScriptXtoX(&sa
, 7, 5, offsets_2
, pwLogClust_2
, piAdvance_2
);
2802 /* Get thai eScript, This will do LTR and fNeedsCaretInfo */
2803 hr
= ScriptItemize(thaiW
, 1, 2, NULL
, NULL
, items
, &i
);
2804 ok(hr
== S_OK
, "got %08x\n", hr
);
2805 ok(i
== 1, "got %d\n", i
);
2808 test_caret_item_ScriptXtoCP(&sa
, 17, 15, offsets_3
, pwLogClust_3
, piAdvance_3
);
2810 /* Get hebrew eScript, This will do RTL and fNeedsCaretInfo */
2811 hr
= ScriptItemize(hebrW
, 1, 2, NULL
, NULL
, items
, &i
);
2812 ok(hr
== S_OK
, "got %08x\n", hr
);
2813 ok(i
== 1, "got %d\n", i
);
2816 /* Note: This behavior CHANGED in uniscribe versions...
2817 * so we only want to test if fNeedsCaretInfo is set */
2818 hr
= ScriptGetProperties(&ppScriptProperties
, &i
);
2819 if (ppScriptProperties
[sa
.eScript
]->fNeedsCaretInfo
)
2821 test_caret_item_ScriptXtoCP(&sa
, 17, 15, offsets_3_RTL
, pwLogClust_3_RTL
, piAdvance_3
);
2822 hr
= ScriptXtoCP(0, 17, 15, pwLogClust_3_RTL
, psva
, piAdvance_3
, &sa
, &piCP
, &piTrailing
);
2823 ok(hr
== S_OK
, "ScriptXtoCP: should return S_OK not %08x\n", hr
);
2824 ok(piCP
== 16, "ScriptXtoCP: iX=0 should return piCP=16 not %d\n", piCP
);
2825 ok(piTrailing
== 1, "ScriptXtoCP: iX=0 should return piTrailing=1 not %d\n", piTrailing
);
2828 win_skip("Uniscribe version too old to test Hebrew clusters\n");
2831 static void test_ScriptString(HDC hdc
)
2833 /*******************************************************************************************
2835 * This set of tests are for the string functions of uniscribe. The ScriptStringAnalyse
2836 * function allocates memory pointed to by the SCRIPT_STRING_ANALYSIS ssa pointer. This
2837 * memory is freed by ScriptStringFree. There needs to be a valid hdc for this as
2838 * ScriptStringAnalyse calls ScriptSItemize, ScriptShape and ScriptPlace which require it.
2843 WCHAR teststr
[] = {'T','e','s','t','1',' ','a','2','b','3', '\0'};
2844 int len
= (sizeof(teststr
) / sizeof(WCHAR
)) - 1;
2845 int Glyphs
= len
* 2 + 16;
2847 DWORD Flags
= SSA_GLYPHS
;
2849 const int Dx
[5] = {10, 10, 10, 10, 10};
2850 const BYTE InClass
= 0;
2851 SCRIPT_STRING_ANALYSIS ssa
= NULL
;
2856 const RECT rc
= {0, 50, 100, 100};
2859 BOOL Disabled
= FALSE
;
2860 const int *clip_len
;
2865 Charset
= -1; /* this flag indicates unicode input */
2866 /* Test without hdc to get E_PENDING */
2867 hr
= ScriptStringAnalyse( NULL
, teststr
, len
, Glyphs
, Charset
, Flags
,
2868 ReqWidth
, NULL
, NULL
, Dx
, NULL
,
2870 ok(hr
== E_PENDING
, "ScriptStringAnalyse Stub should return E_PENDING not %08x\n", hr
);
2872 /* Test that 0 length string returns E_INVALIDARG */
2873 hr
= ScriptStringAnalyse( hdc
, teststr
, 0, Glyphs
, Charset
, Flags
,
2874 ReqWidth
, NULL
, NULL
, Dx
, NULL
,
2876 ok(hr
== E_INVALIDARG
, "ScriptStringAnalyse should return E_INVALIDARG not %08x\n", hr
);
2878 /* test with hdc, this should be a valid test */
2879 hr
= ScriptStringAnalyse( hdc
, teststr
, len
, Glyphs
, Charset
, Flags
,
2880 ReqWidth
, NULL
, NULL
, Dx
, NULL
,
2882 ok(hr
== S_OK
, "ScriptStringAnalyse should return S_OK not %08x\n", hr
);
2883 ScriptStringFree(&ssa
);
2885 /* test makes sure that a call with a valid pssa still works */
2886 hr
= ScriptStringAnalyse( hdc
, teststr
, len
, Glyphs
, Charset
, Flags
,
2887 ReqWidth
, NULL
, NULL
, Dx
, NULL
,
2889 ok(hr
== S_OK
, "ScriptStringAnalyse should return S_OK not %08x\n", hr
);
2890 ok(ssa
!= NULL
, "ScriptStringAnalyse pssa should not be NULL\n");
2894 hr
= ScriptStringOut(ssa
, X
, Y
, Options
, &rc
, MinSel
, MaxSel
, Disabled
);
2895 ok(hr
== S_OK
, "ScriptStringOut should return S_OK not %08x\n", hr
);
2898 clip_len
= ScriptString_pcOutChars(ssa
);
2899 ok(*clip_len
== len
, "ScriptString_pcOutChars failed, got %d, expected %d\n", *clip_len
, len
);
2901 order
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, *clip_len
* sizeof(UINT
));
2902 hr
= ScriptStringGetOrder(ssa
, order
);
2903 ok(hr
== S_OK
, "ScriptStringGetOrder failed, got %08x, expected S_OK\n", hr
);
2905 for (i
= 0; i
< *clip_len
; i
++) ok(order
[i
] == i
, "%d: got %d expected %d\n", i
, order
[i
], i
);
2906 HeapFree(GetProcessHeap(), 0, order
);
2908 hr
= ScriptStringFree(&ssa
);
2909 ok(hr
== S_OK
, "ScriptStringFree should return S_OK not %08x\n", hr
);
2912 static void test_ScriptStringXtoCP_CPtoX(HDC hdc
)
2914 /*****************************************************************************************
2916 * This test is for the ScriptStringXtoCP and ScriptStringXtoCP functions. Due to the
2917 * nature of the fonts between Windows and Wine, the test is implemented by generating
2918 * values using one one function then checking the output of the second. In this way
2919 * the validity of the functions is established using Windows as a base and confirming
2920 * similar behaviour in wine.
2924 static const WCHAR teststr1
[] = {0x05e9, 'i', 0x05dc, 'n', 0x05d5, 'e', 0x05dd, '.',0};
2925 static const BOOL rtl
[] = {1, 0, 1, 0, 1, 0, 1, 0};
2926 void *String
= (WCHAR
*) &teststr1
; /* ScriptStringAnalysis needs void */
2927 int String_len
= (sizeof(teststr1
)/sizeof(WCHAR
))-1;
2928 int Glyphs
= String_len
* 2 + 16; /* size of buffer as recommended */
2929 int Charset
= -1; /* unicode */
2930 DWORD Flags
= SSA_GLYPHS
;
2932 const BYTE InClass
= 0;
2933 SCRIPT_STRING_ANALYSIS ssa
= NULL
;
2935 int Ch
; /* Character position in string */
2937 int Cp
; /* Character position in string */
2942 /* Test with hdc, this should be a valid test
2943 * Here we generate an SCRIPT_STRING_ANALYSIS that will be used as input to the
2944 * following character positions to X and X to character position functions.
2947 hr
= ScriptStringAnalyse( hdc
, String
, String_len
, Glyphs
, Charset
, Flags
,
2948 ReqWidth
, NULL
, NULL
, NULL
, NULL
,
2951 hr
== E_INVALIDARG
, /* NT */
2952 "ScriptStringAnalyse should return S_OK or E_INVALIDARG not %08x\n", hr
);
2956 ok(ssa
!= NULL
, "ScriptStringAnalyse ssa should not be NULL\n");
2959 * Loop to generate character positions to provide starting positions for the
2960 * ScriptStringCPtoX and ScriptStringXtoCP functions
2962 for (Cp
= 0; Cp
< String_len
; Cp
++)
2964 /* The fTrailing flag is used to indicate whether the X being returned is at
2965 * the beginning or the end of the character. What happens here is that if
2966 * fTrailing indicates the end of the character, ie. FALSE, then ScriptStringXtoCP
2967 * returns the beginning of the next character and iTrailing is FALSE. So for this
2968 * loop iTrailing will be FALSE in both cases.
2970 hr
= ScriptStringCPtoX(ssa
, Cp
, TRUE
, &trail
);
2971 ok(hr
== S_OK
, "ScriptStringCPtoX should return S_OK not %08x\n", hr
);
2972 hr
= ScriptStringCPtoX(ssa
, Cp
, FALSE
, &lead
);
2973 ok(hr
== S_OK
, "ScriptStringCPtoX should return S_OK not %08x\n", hr
);
2975 ok(lead
> trail
, "Leading values should be after trailing for rtl characters(%i)\n",Cp
);
2977 ok(lead
< trail
, "Trailing values should be after leading for ltr characters(%i)\n",Cp
);
2979 /* move by 1 pixel so that we are not between 2 characters. That could result in being the lead of a rtl and
2980 at the same time the trail of an ltr */
2982 /* inside the leading edge */
2984 if (rtl
[Cp
]) X
--; else X
++;
2985 hr
= ScriptStringXtoCP(ssa
, X
, &Ch
, &iTrailing
);
2986 ok(hr
== S_OK
, "ScriptStringXtoCP should return S_OK not %08x\n", hr
);
2987 ok(Cp
== Ch
, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp
, Ch
, trail
);
2988 ok(iTrailing
== FALSE
, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n",
2991 /* inside the trailing edge */
2993 if (rtl
[Cp
]) X
++; else X
--;
2994 hr
= ScriptStringXtoCP(ssa
, X
, &Ch
, &iTrailing
);
2995 ok(hr
== S_OK
, "ScriptStringXtoCP should return S_OK not %08x\n", hr
);
2996 ok(Cp
== Ch
, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp
, Ch
, trail
);
2997 ok(iTrailing
== TRUE
, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = %d\n",
3000 /* outside the "trailing" edge */
3001 if (Cp
< String_len
-1)
3003 if (rtl
[Cp
]) X
= lead
; else X
= trail
;
3005 hr
= ScriptStringXtoCP(ssa
, X
, &Ch
, &iTrailing
);
3006 ok(hr
== S_OK
, "ScriptStringXtoCP should return S_OK not %08x\n", hr
);
3007 ok(Cp
+ 1 == Ch
, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp
+ 1, Ch
, trail
);
3009 ok(iTrailing
== TRUE
, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = %d\n",
3012 ok(iTrailing
== FALSE
, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n",
3016 /* outside the "leading" edge */
3019 if (rtl
[Cp
]) X
= trail
; else X
= lead
;
3021 hr
= ScriptStringXtoCP(ssa
, X
, &Ch
, &iTrailing
);
3022 ok(hr
== S_OK
, "ScriptStringXtoCP should return S_OK not %08x\n", hr
);
3023 ok(Cp
- 1 == Ch
, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp
- 1, Ch
, trail
);
3024 if (Cp
!= 0 && rtl
[Cp
-1])
3025 ok(iTrailing
== FALSE
, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n",
3028 ok(iTrailing
== TRUE
, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = %d\n",
3033 /* Check beyond the leading boundary of the whole string */
3036 /* having a leading rtl character seems to confuse usp */
3037 /* this looks to be a windows bug we should emulate */
3038 hr
= ScriptStringCPtoX(ssa
, 0, TRUE
, &X
);
3039 ok(hr
== S_OK
, "ScriptStringCPtoX should return S_OK not %08x\n", hr
);
3041 hr
= ScriptStringXtoCP(ssa
, X
, &Ch
, &iTrailing
);
3042 ok(hr
== S_OK
, "ScriptStringXtoCP should return S_OK not %08x\n", hr
);
3043 ok(Ch
== 1, "ScriptStringXtoCP should return Ch = 1 not %d for X outside leading edge when rtl\n", Ch
);
3044 ok(iTrailing
== FALSE
, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = outside leading edge when rtl\n",
3049 hr
= ScriptStringCPtoX(ssa
, 0, FALSE
, &X
);
3050 ok(hr
== S_OK
, "ScriptStringCPtoX should return S_OK not %08x\n", hr
);
3052 hr
= ScriptStringXtoCP(ssa
, X
, &Ch
, &iTrailing
);
3053 ok(hr
== S_OK
, "ScriptStringXtoCP should return S_OK not %08x\n", hr
);
3054 ok(Ch
== -1, "ScriptStringXtoCP should return Ch = -1 not %d for X outside leading edge\n", Ch
);
3055 ok(iTrailing
== TRUE
, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = outside leading edge\n",
3059 /* Check beyond the end boundary of the whole string */
3060 if (rtl
[String_len
-1])
3062 hr
= ScriptStringCPtoX(ssa
, String_len
-1, FALSE
, &X
);
3063 ok(hr
== S_OK
, "ScriptStringCPtoX should return S_OK not %08x\n", hr
);
3067 hr
= ScriptStringCPtoX(ssa
, String_len
-1, TRUE
, &X
);
3068 ok(hr
== S_OK
, "ScriptStringCPtoX should return S_OK not %08x\n", hr
);
3071 hr
= ScriptStringXtoCP(ssa
, X
, &Ch
, &iTrailing
);
3072 ok(hr
== S_OK
, "ScriptStringXtoCP should return S_OK not %08x\n", hr
);
3073 ok(Ch
== String_len
, "ScriptStringXtoCP should return Ch = %i not %d for X outside trailing edge\n", String_len
, Ch
);
3074 ok(iTrailing
== FALSE
, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = outside trailing edge\n",
3078 * Cleanup the SSA for the next round of tests
3080 hr
= ScriptStringFree(&ssa
);
3081 ok(hr
== S_OK
, "ScriptStringFree should return S_OK not %08x\n", hr
);
3084 * Test to see that exceeding the number of chars returns E_INVALIDARG. First
3085 * generate an SSA for the subsequent tests.
3087 hr
= ScriptStringAnalyse( hdc
, String
, String_len
, Glyphs
, Charset
, Flags
,
3088 ReqWidth
, NULL
, NULL
, NULL
, NULL
,
3090 ok(hr
== S_OK
, "ScriptStringAnalyse should return S_OK not %08x\n", hr
);
3093 * When ScriptStringCPtoX is called with a character position Cp that exceeds the
3094 * string length, return E_INVALIDARG. This also invalidates the ssa so a
3095 * ScriptStringFree should also fail.
3098 Cp
= String_len
+ 1;
3099 hr
= ScriptStringCPtoX(ssa
, Cp
, fTrailing
, &X
);
3100 ok(hr
== E_INVALIDARG
, "ScriptStringCPtoX should return E_INVALIDARG not %08x\n", hr
);
3102 ScriptStringFree(&ssa
);
3106 static void test_ScriptCacheGetHeight(HDC hdc
)
3109 SCRIPT_CACHE sc
= NULL
;
3112 hr
= ScriptCacheGetHeight(NULL
, NULL
, NULL
);
3113 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got 0x%08x\n", hr
);
3115 hr
= ScriptCacheGetHeight(NULL
, &sc
, NULL
);
3116 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got 0x%08x\n", hr
);
3118 hr
= ScriptCacheGetHeight(NULL
, &sc
, &height
);
3119 ok(hr
== E_PENDING
, "expected E_PENDING, got 0x%08x\n", hr
);
3123 hr
= ScriptCacheGetHeight(hdc
, &sc
, &height
);
3124 ok(hr
== S_OK
, "expected S_OK, got 0x%08x\n", hr
);
3125 ok(height
> 0, "expected height > 0\n");
3127 ScriptFreeCache(&sc
);
3130 static void test_ScriptGetGlyphABCWidth(HDC hdc
)
3133 SCRIPT_CACHE sc
= NULL
;
3136 hr
= ScriptGetGlyphABCWidth(NULL
, NULL
, 'a', NULL
);
3137 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got 0x%08x\n", hr
);
3139 hr
= ScriptGetGlyphABCWidth(NULL
, &sc
, 'a', NULL
);
3140 ok(broken(hr
== E_PENDING
) ||
3141 hr
== E_INVALIDARG
, /* WIN7 */
3142 "expected E_INVALIDARG, got 0x%08x\n", hr
);
3144 hr
= ScriptGetGlyphABCWidth(NULL
, &sc
, 'a', &abc
);
3145 ok(hr
== E_PENDING
, "expected E_PENDING, got 0x%08x\n", hr
);
3147 if (0) { /* crashes on WinXP */
3148 hr
= ScriptGetGlyphABCWidth(hdc
, &sc
, 'a', NULL
);
3149 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got 0x%08x\n", hr
);
3152 hr
= ScriptGetGlyphABCWidth(hdc
, &sc
, 'a', &abc
);
3153 ok(hr
== S_OK
, "expected S_OK, got 0x%08x\n", hr
);
3155 ScriptFreeCache(&sc
);
3158 static void test_ScriptLayout(void)
3161 static const BYTE levels
[][10] =
3163 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
3164 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
3165 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 },
3166 { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
3168 { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1},
3169 { 1, 1, 1, 2, 2, 2, 1, 1, 1, 1 },
3170 { 2, 2, 2, 1, 1, 1, 2, 2, 2, 2 },
3171 { 0, 0, 1, 1, 2, 2, 1, 1, 0, 0 },
3172 { 1, 1, 2, 2, 3, 3, 2, 2, 1, 1 },
3174 { 0, 0, 1, 1, 2, 2, 1, 1, 0, 1 },
3175 { 1, 0, 1, 2, 2, 1, 2, 1, 0, 1 },
3177 { 1, 2, 0, 0, 0, 0, 0, 0, 0, 0 },
3178 { 2, 2, 2, 0, 0, 0, 0, 0, 0, 0 },
3179 { 2, 2, 2, 4, 4, 4, 1, 1, 0, 0 },
3180 { 1, 2, 3, 0, 3, 2, 1, 0, 0, 0 }
3182 static const int expect_l2v
[][10] =
3184 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
3185 { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 },
3186 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
3187 { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 },
3189 { 0, 1, 2, 3, 4, 9, 8 ,7 ,6, 5},
3190 /**/ { 9, 8, 7, 4, 5, 6, 3 ,2 ,1, 0},
3191 /**/ { 7, 8, 9, 6, 5, 4, 0 ,1 ,2, 3},
3192 { 0, 1, 7, 6, 4, 5, 3 ,2 ,8, 9},
3193 { 9, 8, 2, 3, 5, 4, 6 ,7 ,1, 0},
3195 { 0, 1, 7, 6, 4, 5, 3 ,2 ,8, 9},
3196 /**/ { 0, 1, 7, 5, 6, 4, 3 ,2 ,8, 9},
3198 { 1, 0, 2, 3, 4, 5, 6, 7, 8, 9},
3199 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
3200 { 2, 3, 4, 5, 6, 7, 1, 0, 8, 9},
3201 { 2, 0, 1, 3, 5, 6, 4, 7, 8, 9}
3203 static const int expect_v2l
[][10] =
3205 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
3206 { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 },
3207 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
3208 { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 },
3210 { 0, 1, 2, 3, 4, 9, 8 ,7 ,6, 5},
3211 { 9, 8, 7, 6, 3, 4, 5 ,2 ,1, 0},
3212 { 6, 7, 8, 9, 5, 4, 3 ,0 ,1, 2},
3213 { 0, 1, 7, 6, 4, 5, 3 ,2 ,8, 9},
3214 { 9, 8, 2, 3, 5, 4, 6 ,7 ,1, 0},
3216 { 0, 1, 7, 6, 4, 5, 3 ,2 ,8, 9},
3217 { 0, 1, 7, 6, 5, 3, 4 ,2 ,8, 9},
3219 { 1, 0, 2, 3, 4, 5, 6, 7, 8, 9},
3220 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
3221 { 7, 6, 0, 1, 2, 3, 4, 5, 8, 9},
3222 { 1, 2, 0, 3, 6, 4, 5, 7, 8, 9}
3225 int i
, j
, vistolog
[sizeof(levels
[0])], logtovis
[sizeof(levels
[0])];
3227 hr
= ScriptLayout(sizeof(levels
[0]), NULL
, vistolog
, logtovis
);
3228 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got 0x%08x\n", hr
);
3230 hr
= ScriptLayout(sizeof(levels
[0]), levels
[0], NULL
, NULL
);
3231 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got 0x%08x\n", hr
);
3233 for (i
= 0; i
< sizeof(levels
)/sizeof(levels
[0]); i
++)
3235 hr
= ScriptLayout(sizeof(levels
[0]), levels
[i
], vistolog
, logtovis
);
3236 ok(hr
== S_OK
, "expected S_OK, got 0x%08x\n", hr
);
3238 for (j
= 0; j
< sizeof(levels
[i
]); j
++)
3240 ok(expect_v2l
[i
][j
] == vistolog
[j
],
3241 "failure: levels[%d][%d] = %d, vistolog[%d] = %d\n",
3242 i
, j
, levels
[i
][j
], j
, vistolog
[j
] );
3245 for (j
= 0; j
< sizeof(levels
[i
]); j
++)
3247 ok(expect_l2v
[i
][j
] == logtovis
[j
],
3248 "failure: levels[%d][%d] = %d, logtovis[%d] = %d\n",
3249 i
, j
, levels
[i
][j
], j
, logtovis
[j
] );
3254 static BOOL CALLBACK
enum_proc(LGRPID group
, LCID lcid
, LPSTR locale
, LONG_PTR lparam
)
3257 SCRIPT_DIGITSUBSTITUTE sds
;
3262 if (!IsValidLocale(lcid
, LCID_INSTALLED
)) return TRUE
;
3264 memset(&sds
, 0, sizeof(sds
));
3265 memset(&sc
, 0, sizeof(sc
));
3266 memset(&ss
, 0, sizeof(ss
));
3268 lcid_old
= GetThreadLocale();
3269 if (!SetThreadLocale(lcid
)) return TRUE
;
3271 hr
= ScriptRecordDigitSubstitution(lcid
, &sds
);
3272 ok(hr
== S_OK
, "ScriptRecordDigitSubstitution failed: 0x%08x\n", hr
);
3274 hr
= ScriptApplyDigitSubstitution(&sds
, &sc
, &ss
);
3275 ok(hr
== S_OK
, "ScriptApplyDigitSubstitution failed: 0x%08x\n", hr
);
3277 SetThreadLocale(lcid_old
);
3281 static void test_digit_substitution(void)
3285 static const LGRPID groups
[] =
3287 LGRPID_WESTERN_EUROPE
,
3288 LGRPID_CENTRAL_EUROPE
,
3295 LGRPID_TRADITIONAL_CHINESE
,
3296 LGRPID_SIMPLIFIED_CHINESE
,
3306 static BOOL (WINAPI
* pEnumLanguageGroupLocalesA
)(LANGGROUPLOCALE_ENUMPROCA
,LGRPID
,DWORD
,LONG_PTR
);
3308 hKernel32
= GetModuleHandleA("kernel32.dll");
3309 pEnumLanguageGroupLocalesA
= (void*)GetProcAddress(hKernel32
, "EnumLanguageGroupLocalesA");
3311 if (!pEnumLanguageGroupLocalesA
)
3313 win_skip("EnumLanguageGroupLocalesA not available on this platform\n");
3317 for (i
= 0; i
< sizeof(groups
)/sizeof(groups
[0]); i
++)
3319 ret
= pEnumLanguageGroupLocalesA(enum_proc
, groups
[i
], 0, 0);
3320 if (!ret
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED
)
3322 win_skip("EnumLanguageGroupLocalesA not implemented on this platform\n");
3326 ok(ret
, "EnumLanguageGroupLocalesA failed unexpectedly: %u\n", GetLastError());
3330 static void test_ScriptGetProperties(void)
3332 const SCRIPT_PROPERTIES
**props
;
3336 hr
= ScriptGetProperties(NULL
, NULL
);
3337 ok(hr
== E_INVALIDARG
, "ScriptGetProperties succeeded\n");
3339 hr
= ScriptGetProperties(NULL
, &num
);
3340 ok(hr
== S_OK
, "ScriptGetProperties failed: 0x%08x\n", hr
);
3342 hr
= ScriptGetProperties(&props
, NULL
);
3343 ok(hr
== S_OK
, "ScriptGetProperties failed: 0x%08x\n", hr
);
3345 hr
= ScriptGetProperties(&props
, &num
);
3346 ok(hr
== S_OK
, "ScriptGetProperties failed: 0x%08x\n", hr
);
3349 static void test_ScriptBreak(void)
3351 static const WCHAR test
[] = {' ','\r','\n',0};
3352 SCRIPT_ITEM items
[4];
3356 hr
= ScriptItemize(test
, 3, 4, NULL
, NULL
, items
, NULL
);
3357 ok(hr
== S_OK
, "ScriptItemize should return S_OK not %08x\n", hr
);
3360 * This Test crashes pre Vista.
3362 hr = ScriptBreak(test, 1, &items[0].a, NULL);
3363 ok(hr == E_INVALIDARG, "ScriptBreak should return E_INVALIDARG not %08x\n", hr);
3366 hr
= ScriptBreak(test
, 0, &items
[0].a
, &la
);
3367 ok(hr
== E_FAIL
|| broken(hr
== S_OK
), "ScriptBreak should return E_FAIL not %08x\n", hr
);
3369 hr
= ScriptBreak(test
, -1, &items
[0].a
, &la
);
3370 ok(hr
== E_INVALIDARG
|| broken(hr
== S_OK
), "ScriptBreak should return E_INVALIDARG not %08x\n", hr
);
3372 memset(&la
, 0, sizeof(la
));
3373 hr
= ScriptBreak(test
, 1, &items
[0].a
, &la
);
3374 ok(hr
== S_OK
, "ScriptBreak should return S_OK not %08x\n", hr
);
3376 ok(!la
.fSoftBreak
, "fSoftBreak set\n");
3377 ok(la
.fWhiteSpace
, "fWhiteSpace not set\n");
3378 ok(la
.fCharStop
, "fCharStop not set\n");
3379 ok(!la
.fWordStop
, "fWordStop set\n");
3380 ok(!la
.fInvalid
, "fInvalid set\n");
3381 ok(!la
.fReserved
, "fReserved set\n");
3383 memset(&la
, 0, sizeof(la
));
3384 hr
= ScriptBreak(test
+ 1, 1, &items
[1].a
, &la
);
3385 ok(hr
== S_OK
, "ScriptBreak should return S_OK not %08x\n", hr
);
3387 ok(!la
.fSoftBreak
, "fSoftBreak set\n");
3388 ok(!la
.fWhiteSpace
, "fWhiteSpace set\n");
3389 ok(la
.fCharStop
, "fCharStop not set\n");
3390 ok(!la
.fWordStop
, "fWordStop set\n");
3391 ok(!la
.fInvalid
, "fInvalid set\n");
3392 ok(!la
.fReserved
, "fReserved set\n");
3394 memset(&la
, 0, sizeof(la
));
3395 hr
= ScriptBreak(test
+ 2, 1, &items
[2].a
, &la
);
3396 ok(hr
== S_OK
, "ScriptBreak should return S_OK not %08x\n", hr
);
3398 ok(!la
.fSoftBreak
, "fSoftBreak set\n");
3399 ok(!la
.fWhiteSpace
, "fWhiteSpace set\n");
3400 ok(la
.fCharStop
, "fCharStop not set\n");
3401 ok(!la
.fWordStop
, "fWordStop set\n");
3402 ok(!la
.fInvalid
, "fInvalid set\n");
3403 ok(!la
.fReserved
, "fReserved set\n");
3406 static void test_newlines(void)
3408 static const WCHAR test1
[] = {'t','e','x','t','\r','t','e','x','t',0};
3409 static const WCHAR test2
[] = {'t','e','x','t','\n','t','e','x','t',0};
3410 static const WCHAR test3
[] = {'t','e','x','t','\r','\n','t','e','x','t',0};
3411 static const WCHAR test4
[] = {'t','e','x','t','\n','\r','t','e','x','t',0};
3412 static const WCHAR test5
[] = {'1','2','3','4','\n','\r','1','2','3','4',0};
3413 SCRIPT_ITEM items
[5];
3418 hr
= ScriptItemize(test1
, lstrlenW(test1
), 5, NULL
, NULL
, items
, &count
);
3419 ok(hr
== S_OK
, "ScriptItemize failed: 0x%08x\n", hr
);
3420 ok(count
== 3, "got %d expected 3\n", count
);
3423 hr
= ScriptItemize(test2
, lstrlenW(test2
), 5, NULL
, NULL
, items
, &count
);
3424 ok(hr
== S_OK
, "ScriptItemize failed: 0x%08x\n", hr
);
3425 ok(count
== 3, "got %d expected 3\n", count
);
3428 hr
= ScriptItemize(test3
, lstrlenW(test3
), 5, NULL
, NULL
, items
, &count
);
3429 ok(hr
== S_OK
, "ScriptItemize failed: 0x%08x\n", hr
);
3430 ok(count
== 4, "got %d expected 4\n", count
);
3433 hr
= ScriptItemize(test4
, lstrlenW(test4
), 5, NULL
, NULL
, items
, &count
);
3434 ok(hr
== S_OK
, "ScriptItemize failed: 0x%08x\n", hr
);
3435 ok(count
== 4, "got %d expected 4\n", count
);
3438 hr
= ScriptItemize(test5
, lstrlenW(test5
), 5, NULL
, NULL
, items
, &count
);
3439 ok(hr
== S_OK
, "ScriptItemize failed: 0x%08x\n", hr
);
3440 ok(count
== 4, "got %d expected 4\n", count
);
3443 static void test_ScriptGetFontFunctions(HDC hdc
)
3446 pScriptGetFontScriptTags
= (void*)GetProcAddress(GetModuleHandleA("usp10.dll"), "ScriptGetFontScriptTags");
3447 pScriptGetFontLanguageTags
= (void*)GetProcAddress(GetModuleHandleA("usp10.dll"), "ScriptGetFontLanguageTags");
3448 pScriptGetFontFeatureTags
= (void*)GetProcAddress(GetModuleHandleA("usp10.dll"), "ScriptGetFontFeatureTags");
3449 if (!pScriptGetFontScriptTags
|| !pScriptGetFontLanguageTags
|| !pScriptGetFontFeatureTags
)
3451 win_skip("ScriptGetFontScriptTags,ScriptGetFontLanguageTags or ScriptGetFontFeatureTags not available on this platform\n");
3455 SCRIPT_CACHE sc
= NULL
;
3456 OPENTYPE_TAG tags
[5];
3459 SCRIPT_ITEM outpItems
[15];
3460 SCRIPT_CONTROL Control
;
3462 static const WCHAR test_phagspa
[] = {0xa84f, 0xa861, 0xa843, 0x0020, 0xa863, 0xa861, 0xa859, 0x0020, 0xa850, 0xa85c, 0xa85e};
3464 hr
= pScriptGetFontScriptTags(hdc
, &sc
, NULL
, 0, NULL
, NULL
);
3465 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3466 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3467 hr
= pScriptGetFontScriptTags(hdc
, &sc
, NULL
, 0, NULL
, &count
);
3468 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3469 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3470 hr
= pScriptGetFontScriptTags(hdc
, &sc
, NULL
, 5, tags
, NULL
);
3471 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3472 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3473 hr
= pScriptGetFontScriptTags(hdc
, &sc
, NULL
, 0, tags
, &count
);
3474 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3475 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3476 hr
= pScriptGetFontScriptTags(NULL
, &sc
, NULL
, 5, tags
, &count
);
3477 ok(hr
== E_PENDING
,"Incorrect return code\n");
3478 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3479 hr
= pScriptGetFontScriptTags(hdc
, &sc
, NULL
, 5, tags
, &count
);
3480 ok((hr
== S_OK
|| hr
== E_OUTOFMEMORY
),"Incorrect return code\n");
3482 ok(count
<= 5, "Count should be less or equal to 5 with S_OK return\n");
3483 else if (hr
== E_OUTOFMEMORY
)
3484 ok(count
== 0, "Count should be 0 with E_OUTOFMEMORY return\n");
3485 ok(sc
!= NULL
, "ScriptCache should be initialized\n");
3487 ScriptFreeCache(&sc
);
3490 hr
= pScriptGetFontLanguageTags(hdc
, &sc
, NULL
, latn_tag
, 0, NULL
, NULL
);
3491 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3492 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3493 hr
= pScriptGetFontLanguageTags(hdc
, &sc
, NULL
, latn_tag
, 0, NULL
, &count
);
3494 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3495 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3496 hr
= pScriptGetFontLanguageTags(hdc
, &sc
, NULL
, latn_tag
, 5, tags
, NULL
);
3497 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3498 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3499 hr
= pScriptGetFontLanguageTags(hdc
, &sc
, NULL
, latn_tag
, 0, tags
, &count
);
3500 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3501 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3502 hr
= pScriptGetFontLanguageTags(NULL
, &sc
, NULL
, latn_tag
, 5, tags
, &count
);
3503 ok(hr
== E_PENDING
,"Incorrect return code\n");
3504 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3505 hr
= pScriptGetFontLanguageTags(hdc
, &sc
, NULL
, latn_tag
, 5, tags
, &count
);
3506 ok((hr
== S_OK
|| hr
== E_OUTOFMEMORY
),"Incorrect return code\n");
3508 ok(count
<= 5, "Count should be less or equal to 5 with S_OK return\n");
3509 else if (hr
== E_OUTOFMEMORY
)
3510 ok(count
== 0, "Count should be 0 with E_OUTOFMEMORY return\n");
3512 ScriptFreeCache(&sc
);
3515 hr
= pScriptGetFontFeatureTags(hdc
, &sc
, NULL
, latn_tag
, 0x0, 0, NULL
, NULL
);
3516 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3517 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3518 hr
= pScriptGetFontFeatureTags(hdc
, &sc
, NULL
, latn_tag
, 0x0, 0, NULL
, &count
);
3519 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3520 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3521 hr
= pScriptGetFontFeatureTags(hdc
, &sc
, NULL
, latn_tag
, 0x0, 5, tags
, NULL
);
3522 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3523 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3524 hr
= pScriptGetFontFeatureTags(hdc
, &sc
, NULL
, latn_tag
, 0x0, 0, tags
, &count
);
3525 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3526 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3527 hr
= pScriptGetFontFeatureTags(NULL
, &sc
, NULL
, latn_tag
, 0x0, 5, tags
, &count
);
3528 ok(hr
== E_PENDING
,"Incorrect return code\n");
3529 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3530 hr
= pScriptGetFontFeatureTags(hdc
, &sc
, NULL
, latn_tag
, 0x0, 5, tags
, &count
);
3531 ok((hr
== S_OK
|| hr
== E_OUTOFMEMORY
),"Incorrect return code\n");
3533 ok(count
<= 5, "Count should be less or equal to 5 with S_OK return\n");
3534 else if (hr
== E_OUTOFMEMORY
)
3535 ok(count
== 0, "Count should be 0 with E_OUTOFMEMORY return\n");
3537 memset(&Control
, 0, sizeof(Control
));
3538 memset(&State
, 0, sizeof(State
));
3540 hr
= ScriptItemize(test_phagspa
, 10, 15, &Control
, &State
, outpItems
, &outnItems
);
3541 ok(hr
== S_OK
, "ScriptItemize failed: 0x%08x\n", hr
);
3542 memset(tags
,0,sizeof(tags
));
3543 hr
= pScriptGetFontScriptTags(hdc
, &sc
, &outpItems
[0].a
, 5, tags
, &count
);
3544 ok( hr
== USP_E_SCRIPT_NOT_IN_FONT
|| broken(hr
== S_OK
), "wrong return code\n");
3546 hr
= pScriptGetFontLanguageTags(hdc
, &sc
, NULL
, dsrt_tag
, 5, tags
, &count
);
3547 ok( hr
== S_OK
, "wrong return code\n");
3548 hr
= pScriptGetFontLanguageTags(hdc
, &sc
, &outpItems
[0].a
, dsrt_tag
, 5, tags
, &count
);
3549 ok( hr
== E_INVALIDARG
|| broken(hr
== S_OK
), "wrong return code\n");
3551 hr
= pScriptGetFontFeatureTags(hdc
, &sc
, NULL
, dsrt_tag
, 0x0, 5, tags
, &count
);
3552 ok( hr
== S_OK
, "wrong return code\n");
3553 hr
= pScriptGetFontFeatureTags(hdc
, &sc
, &outpItems
[0].a
, dsrt_tag
, 0x0, 5, tags
, &count
);
3554 ok( hr
== E_INVALIDARG
|| broken(hr
== S_OK
), "wrong return code\n");
3556 ScriptFreeCache(&sc
);
3567 unsigned short pwOutGlyphs
[256];
3569 /* We need a valid HDC to drive a lot of Script functions which requires the following *
3570 * to set up for the tests. */
3571 hwnd
= CreateWindowExA(0, "static", "", WS_POPUP
, 0,0,100,100,
3574 ShowWindow(hwnd
, SW_SHOW
);
3577 hdc
= GetDC(hwnd
); /* We now have a hdc */
3578 ok( hdc
!= NULL
, "HDC failed to be created %p\n", hdc
);
3580 memset(&lf
, 0, sizeof(LOGFONTA
));
3581 lstrcpyA(lf
.lfFaceName
, "Tahoma");
3586 hfont
= SelectObject(hdc
, CreateFontIndirectA(&lf
));
3587 ok(hfont
!= NULL
, "SelectObject failed: %p\n", hfont
);
3589 test_ScriptItemize();
3590 test_ScriptItemIzeShapePlace(hdc
,pwOutGlyphs
);
3591 test_ScriptGetCMap(hdc
, pwOutGlyphs
);
3592 test_ScriptCacheGetHeight(hdc
);
3593 test_ScriptGetGlyphABCWidth(hdc
);
3594 test_ScriptShape(hdc
);
3595 test_ScriptShapeOpenType(hdc
);
3596 test_ScriptPlace(hdc
);
3598 test_ScriptGetFontProperties(hdc
);
3599 test_ScriptTextOut(hdc
);
3600 test_ScriptTextOut2(hdc
);
3601 test_ScriptTextOut3(hdc
);
3603 test_ScriptString(hdc
);
3604 test_ScriptStringXtoCP_CPtoX(hdc
);
3606 test_ScriptLayout();
3607 test_digit_substitution();
3608 test_ScriptGetProperties();
3612 test_ScriptGetFontFunctions(hdc
);
3614 ReleaseDC(hwnd
, hdc
);
3615 DestroyWindow(hwnd
);