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 typedef struct _itemTest
{
40 int fOverrideDirection
;
46 typedef struct _shapeTest_char
{
48 SCRIPT_CHARPROP CharProp
;
51 typedef struct _shapeTest_glyph
{
53 SCRIPT_GLYPHPROP GlyphProp
;
56 /* Uniscribe 1.6 calls */
57 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
);
59 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
);
61 static DWORD (WINAPI
*pGetGlyphIndicesW
)(HDC hdc
, LPCWSTR lpstr
, INT count
, LPWORD pgi
, DWORD flags
);
63 static HRESULT (WINAPI
*pScriptGetFontScriptTags
)( HDC hdc
, SCRIPT_CACHE
*psc
, SCRIPT_ANALYSIS
*psa
, int cMaxTags
, OPENTYPE_TAG
*pScriptTags
, int *pcTags
);
64 static HRESULT (WINAPI
*pScriptGetFontLanguageTags
)( HDC hdc
, SCRIPT_CACHE
*psc
, SCRIPT_ANALYSIS
*psa
, OPENTYPE_TAG tagScript
, int cMaxTags
, OPENTYPE_TAG
*pLangSysTags
, int *pcTags
);
65 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
);
67 static inline void _test_items_ok(LPCWSTR string
, DWORD cchString
,
68 SCRIPT_CONTROL
*Control
, SCRIPT_STATE
*State
,
69 DWORD nItems
, const itemTest
* items
, BOOL nItemsToDo
,
70 const INT nItemsBroken
[2])
74 SCRIPT_ITEM outpItems
[15];
75 ULONG tags
[15] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
77 if (pScriptItemizeOpenType
)
78 hr
= pScriptItemizeOpenType(string
, cchString
, 15, Control
, State
, outpItems
, tags
, &outnItems
);
80 hr
= ScriptItemize(string
, cchString
, 15, Control
, State
, outpItems
, &outnItems
);
82 winetest_ok(hr
== S_OK
, "ScriptItemize should return S_OK not %08x\n", hr
);
83 if (nItemsBroken
&& (broken(nItemsBroken
[0] == outnItems
) || broken(nItemsBroken
[1] == outnItems
)))
85 winetest_win_skip("This test broken on this platform\n");
88 todo_wine_if (nItemsToDo
)
89 winetest_ok(outnItems
== nItems
, "Wrong number of items (%u)\n", outnItems
);
90 outnItems
= min(outnItems
, nItems
);
91 for (x
= 0; x
<= outnItems
; x
++)
93 if (items
[x
].isBroken
&& broken(outpItems
[x
].iCharPos
== items
[x
].broken_value
[0]))
94 winetest_win_skip("This test broken on this platform\n");
95 else todo_wine_if (items
[x
].todo_flag
[0])
96 winetest_ok(outpItems
[x
].iCharPos
== items
[x
].iCharPos
, "%i:Wrong CharPos (%i)\n",x
,outpItems
[x
].iCharPos
);
98 if (items
[x
].isBroken
&& broken(outpItems
[x
].a
.fRTL
== items
[x
].broken_value
[1]))
99 winetest_win_skip("This test broken on this platform\n");
100 else todo_wine_if (items
[x
].todo_flag
[1])
101 winetest_ok(outpItems
[x
].a
.fRTL
== items
[x
].fRTL
, "%i:Wrong fRTL(%i)\n",x
,outpItems
[x
].a
.fRTL
);
103 if (items
[x
].isBroken
&& broken(outpItems
[x
].a
.fLayoutRTL
== items
[x
].broken_value
[2]))
104 winetest_win_skip("This test broken on this platform\n");
105 else todo_wine_if (items
[x
].todo_flag
[2])
106 winetest_ok(outpItems
[x
].a
.fLayoutRTL
== items
[x
].fLayoutRTL
, "%i:Wrong fLayoutRTL(%i)\n",x
,outpItems
[x
].a
.fLayoutRTL
);
108 if (items
[x
].isBroken
&& broken(outpItems
[x
].a
.s
.uBidiLevel
== items
[x
].broken_value
[3]))
109 winetest_win_skip("This test broken on this platform\n");
110 else todo_wine_if (items
[x
].todo_flag
[3])
111 winetest_ok(outpItems
[x
].a
.s
.uBidiLevel
== items
[x
].uBidiLevel
, "%i:Wrong BidiLevel(%i)\n",x
,outpItems
[x
].a
.s
.uBidiLevel
);
113 winetest_ok(outpItems
[x
].a
.eScript
!= SCRIPT_UNDEFINED
, "%i: Undefined script\n",x
);
114 if (pScriptItemizeOpenType
)
116 if (items
[x
].isBroken
&& broken(tags
[x
] == items
[x
].broken_value
[4]))
117 winetest_win_skip("This test broken on this platform\n");
118 else todo_wine_if (items
[x
].todo_flag
[4])
119 winetest_ok(tags
[x
] == items
[x
].scriptTag
,"%i:Incorrect Script Tag %x != %x\n",x
,tags
[x
],items
[x
].scriptTag
);
122 if (items
[x
].isBroken
&& broken(outpItems
[x
].a
.s
.fOverrideDirection
== items
[x
].broken_value
[5]))
123 winetest_win_skip("This test broken on this platform\n");
124 else todo_wine_if (items
[x
].todo_flag
[5])
125 winetest_ok(outpItems
[x
].a
.s
.fOverrideDirection
== items
[x
].fOverrideDirection
, "%i:Wrong fOverrideDirection(%i)\n",x
,outpItems
[x
].a
.s
.fOverrideDirection
);
129 #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)
131 #define MS_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
132 ( ( (ULONG)_x4 << 24 ) | \
133 ( (ULONG)_x3 << 16 ) | \
134 ( (ULONG)_x2 << 8 ) | \
137 #define latn_tag MS_MAKE_TAG('l','a','t','n')
138 #define arab_tag MS_MAKE_TAG('a','r','a','b')
139 #define thai_tag MS_MAKE_TAG('t','h','a','i')
140 #define hebr_tag MS_MAKE_TAG('h','e','b','r')
141 #define syrc_tag MS_MAKE_TAG('s','y','r','c')
142 #define deva_tag MS_MAKE_TAG('d','e','v','a')
143 #define beng_tag MS_MAKE_TAG('b','e','n','g')
144 #define guru_tag MS_MAKE_TAG('g','u','r','u')
145 #define gujr_tag MS_MAKE_TAG('g','u','j','r')
146 #define orya_tag MS_MAKE_TAG('o','r','y','a')
147 #define taml_tag MS_MAKE_TAG('t','a','m','l')
148 #define telu_tag MS_MAKE_TAG('t','e','l','u')
149 #define knda_tag MS_MAKE_TAG('k','n','d','a')
150 #define mlym_tag MS_MAKE_TAG('m','l','y','m')
151 #define mymr_tag MS_MAKE_TAG('m','y','m','r')
152 #define tale_tag MS_MAKE_TAG('t','a','l','e')
153 #define talu_tag MS_MAKE_TAG('t','a','l','u')
154 #define khmr_tag MS_MAKE_TAG('k','h','m','r')
155 #define hani_tag MS_MAKE_TAG('h','a','n','i')
156 #define bopo_tag MS_MAKE_TAG('b','o','p','o')
157 #define kana_tag MS_MAKE_TAG('k','a','n','a')
158 #define hang_tag MS_MAKE_TAG('h','a','n','g')
159 #define yi_tag MS_MAKE_TAG('y','i',' ',' ')
160 #define ethi_tag MS_MAKE_TAG('e','t','h','i')
161 #define mong_tag MS_MAKE_TAG('m','o','n','g')
162 #define tfng_tag MS_MAKE_TAG('t','f','n','g')
163 #define nko_tag MS_MAKE_TAG('n','k','o',' ')
164 #define vai_tag MS_MAKE_TAG('v','a','i',' ')
165 #define cher_tag MS_MAKE_TAG('c','h','e','r')
166 #define cans_tag MS_MAKE_TAG('c','a','n','s')
167 #define ogam_tag MS_MAKE_TAG('o','g','a','m')
168 #define runr_tag MS_MAKE_TAG('r','u','n','r')
169 #define brai_tag MS_MAKE_TAG('b','r','a','i')
170 #define dsrt_tag MS_MAKE_TAG('d','s','r','t')
171 #define osma_tag MS_MAKE_TAG('o','s','m','a')
172 #define math_tag MS_MAKE_TAG('m','a','t','h')
174 static void test_ScriptItemize( void )
176 static const WCHAR test1
[] = {'t', 'e', 's', 't',0};
177 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}};
178 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
}};
180 static const WCHAR test1b
[] = {' ', ' ', ' ', ' ',0};
181 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
}};
182 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
}};
184 static const WCHAR test1c
[] = {' ', ' ', ' ', '1', '2', ' ',0};
185 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
}};
186 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
}};
189 static const WCHAR test2
[] = {'1','2','3','-','5','2',0x064a,0x064f,0x0633,0x0627,0x0648,0x0650,0x064a,'7','1','.',0};
190 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
}};
191 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
}};
192 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
}};
193 static const itemTest t24
[5] = {{{0,0,0,0,0,0},0,0,0,0,1,0,FALSE
},
194 {{0,0,0,0,0,0},6,0,0,0,1,arab_tag
,FALSE
},
195 {{0,0,0,0,0,0},13,0,1,0,1,0,FALSE
},
196 {{0,0,0,0,0,0},15,0,0,0,1,0,FALSE
},
197 {{0,0,0,0,0,0},16,0,0,0,0,-1,FALSE
}};
199 static const WCHAR test2b
[] = {'A','B','C','-','D','E','F',' ',0x0621,0x0623,0x0624,0};
200 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
}};
201 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
}};
202 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
}};
203 static const itemTest t2b4
[5] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag
,FALSE
},
204 {{0,0,0,0,0,0},3,0,0,0,1,0,FALSE
},
205 {{0,0,0,0,0,0},4,0,0,0,1,latn_tag
,FALSE
},
206 {{0,0,0,0,0,0},8,0,0,0,1,arab_tag
,FALSE
},
207 {{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE
}};
208 static const int b2
[2] = {4,4};
211 static const WCHAR test2c
[] = {' ',0x0621,0x0623,0x0624,'A','B','C','-','D','E','F',0};
212 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
}};
213 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
}};
214 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
}};
215 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
}};
216 static const itemTest t2c5
[5] = {{{0,0,0,0,0,0},0,0,0,0,1,arab_tag
,FALSE
},
217 {{0,0,0,0,0,0},4,0,0,0,1,latn_tag
,FALSE
},
218 {{0,0,0,0,0,0},7,0,0,0,1,0,FALSE
},
219 {{0,0,0,0,0,0},8,0,0,0,1,latn_tag
,FALSE
},
220 {{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE
}};
223 static const WCHAR test2d
[] = {'A','B','C','-','D','E','F',0x0621,0x0623,0x0624,' ',0};
224 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
}};
225 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
}};
226 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
}};
227 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
}};
228 static const itemTest t2d5
[5] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag
,FALSE
},
229 {{0,0,0,0,0,0},3,0,0,0,1,0,FALSE
},
230 {{0,0,0,0,0,0},4,0,0,0,1,latn_tag
,FALSE
},
231 {{0,0,0,0,0,0},7,0,0,0,1,arab_tag
,FALSE
},
232 {{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE
}};
235 static const WCHAR test3
[] =
236 {0x0e04,0x0e27,0x0e32,0x0e21,0x0e1e,0x0e22,0x0e32,0x0e22,0x0e32, 0x0e21
237 ,0x0e2d,0x0e22,0x0e39,0x0e48,0x0e17,0x0e35,0x0e48,0x0e44,0x0e2b,0x0e19
238 ,0x0e04,0x0e27,0x0e32,0x0e21,0x0e2a, 0x0e33,0x0e40,0x0e23,0x0e47,0x0e08,
239 0x0e2d,0x0e22,0x0e39,0x0e48,0x0e17,0x0e35,0x0e48,0x0e19,0x0e31,0x0e48,0x0e19,0};
241 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
}};
242 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
}};
244 static const WCHAR test4
[] = {'1','2','3','-','5','2',' ','i','s',' ','7','1','.',0};
246 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
}};
247 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
}};
248 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
}};
249 static const int b43
[2] = {4,4};
252 static const WCHAR test5
[] =
253 {0x0627,0x0644,0x0635,0x0651,0x0650,0x062d,0x0629,0x064f,' ',0x062a,0x064e,
254 0x0627,0x062c,0x064c,' ',0x0639,0x064e,0x0644,0x0649,' ',
255 0x0631,0x064f,0x0624,0x0648,0x0633,0x0650,' ',0x0627,0x0644
256 ,0x0623,0x0635,0x0650,0x062d,0x0651,0x064e,0x0627,0x0621,0x0650,0};
257 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
}};
258 static const itemTest t52
[2] = {{{0,0,0,0,0,0},0,0,0,0,1,arab_tag
,FALSE
},
259 {{0,0,0,0,0,0},38,0,0,0,0,-1,FALSE
}};
263 static const WCHAR test6
[] = {0x05e9, 0x05dc, 0x05d5, 0x05dd, '.',0};
264 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
}};
265 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
}};
266 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
}};
267 static const itemTest t64
[3] = {{{0,0,0,0,0,0},0,0,0,0,1,hebr_tag
,FALSE
},
268 {{0,0,0,0,0,0},4,0,0,0,1,0,FALSE
},
269 {{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
271 static const int b63
[2] = {2,2};
272 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};
273 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
}};
274 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
}};
275 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
}};
276 static const itemTest t74
[4] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag
,FALSE
},
277 {{0,0,0,0,0,0},9,0,0,0,1,hebr_tag
,FALSE
},
278 {{0,0,0,0,0,0},19,0,0,0,1,latn_tag
,FALSE
},
279 {{0,0,0,0,0,0},29,0,0,0,0,-1,FALSE
}};
281 static const WCHAR test8
[] = {0x0633, 0x0644, 0x0627, 0x0645,0};
282 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
}};
283 static const itemTest t82
[2] = {{{0,0,0,0,0,0},0,0,0,0,1,arab_tag
,FALSE
},
284 {{0,0,0,0,0,0},4,0,0,0,0,-1,FALSE
}};
286 /* Syriac (Like Arabic )*/
287 static const WCHAR test9
[] = {0x0710, 0x0712, 0x0712, 0x0714, '.',0};
288 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
}};
289 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
}};
290 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
}};
291 static const itemTest t94
[3] = {{{0,0,0,0,0,0},0,0,0,0,1,syrc_tag
,FALSE
},
292 {{0,0,0,0,0,0},4,0,0,0,1,0,FALSE
},
293 {{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
294 static const int b93
[2] = {2,2};
296 static const WCHAR test10
[] = {0x0717, 0x0718, 0x071a, 0x071b,0};
297 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
}};
298 static const itemTest t102
[2] = {{{0,0,0,0,0,0},0,0,0,0,1,syrc_tag
,FALSE
},
299 {{0,0,0,0,0,0},4,0,0,0,0,-1,FALSE
}};
302 static const WCHAR test11
[] = {0x0926, 0x0947, 0x0935, 0x0928, 0x093e, 0x0917, 0x0930, 0x0940};
303 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
}};
304 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
}};
307 static const WCHAR test12
[] = {0x09ac, 0x09be, 0x0982, 0x09b2, 0x09be};
308 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
}};
309 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
}};
312 static const WCHAR test13
[] = {0x0a17, 0x0a41, 0x0a30, 0x0a2e, 0x0a41, 0x0a16, 0x0a40};
313 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
}};
314 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
}};
317 static const WCHAR test14
[] = {0x0a97, 0x0ac1, 0x0a9c, 0x0ab0, 0x0abe, 0x0aa4, 0x0ac0};
318 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
}};
319 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
}};
322 static const WCHAR test15
[] = {0x0b13, 0x0b21, 0x0b3c, 0x0b3f, 0x0b06};
323 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
}};
324 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
}};
327 static const WCHAR test16
[] = {0x0ba4, 0x0bae, 0x0bbf, 0x0bb4, 0x0bcd};
328 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
}};
329 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
}};
332 static const WCHAR test17
[] = {0x0c24, 0x0c46, 0x0c32, 0x0c41, 0x0c17, 0x0c41};
333 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
}};
334 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
}};
337 static const WCHAR test18
[] = {0x0c95, 0x0ca8, 0x0ccd, 0x0ca8, 0x0ca1};
338 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
}};
339 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
}};
342 static const WCHAR test19
[] = {0x0d2e, 0x0d32, 0x0d2f, 0x0d3e, 0x0d33, 0x0d02};
343 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
}};
344 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
}};
347 static const WCHAR test20
[] = {0x0309,'a','b','c','d',0};
348 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
}};
349 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
}};
351 static const WCHAR test21
[] = {0x0710, 0x0712, 0x0308, 0x0712, 0x0714,0};
352 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
}};
353 static const itemTest t212
[2] = {{{0,0,0,0,0,0},0,0,0,0,1,syrc_tag
,FALSE
},
354 {{0,0,0,0,0,0},5,0,0,0,0,-1,FALSE
}};
356 /* Latin Punctuation */
357 static const WCHAR test22
[] = {'#','$',',','!','\"','*',0};
358 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
}};
359 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
}};
360 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
}};
361 static const int b222
[2] = {1,1};
362 static const int b223
[2] = {2,2};
365 static const WCHAR test23
[] = {'1','2','3',0x00b2,0x00b3,0x2070,0};
366 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
}};
367 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
}};
370 static const WCHAR test24
[] = {0x1019,0x103c,0x1014,0x103a,0x1019,0x102c,0x1021,0x1000,0x1039,0x1001,0x101b,0x102c};
371 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
}};
372 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
}};
375 static const WCHAR test25
[] = {0x1956,0x196d,0x1970,0x1956,0x196c,0x1973,0x1951,0x1968,0x1952,0x1970};
376 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
}};
377 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
}};
380 static const WCHAR test26
[] = {0x1992,0x19c4};
381 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
}};
382 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
}};
385 static const WCHAR test27
[] = {0x1781,0x17c1,0x1798,0x179a,0x1797,0x17b6,0x179f,0x17b6};
386 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
}};
387 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
}};
390 static const WCHAR test28
[] = {0x8bed,0x7d20,0x6587,0x5b57};
391 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
}};
392 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
}};
395 static const WCHAR test29
[] = {0x2ff0,0x2ff3,0x2ffb,0x2ff0,0x65e5,0x65e5,0x5de5,0x7f51,0x4e02,0x4e5e};
396 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
}};
397 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
}};
400 static const WCHAR test30
[] = {0x3113,0x3128,0x3127,0x3123,0x3108,0x3128,0x310f,0x3120};
401 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
}};
402 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
}};
405 static const WCHAR test31
[] = {0x3072,0x3089,0x304b,0x306a,0x30ab,0x30bf,0x30ab,0x30ca};
406 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
}};
407 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
}};
408 static const int b311
[2] = {2,2};
409 static const int b312
[2] = {2,2};
412 static const WCHAR test32
[] = {0xd55c,0xad6d,0xc5b4};
413 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
}};
414 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
}};
417 static const WCHAR test33
[] = {0xa188,0xa320,0xa071,0xa0b7};
418 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
}};
419 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
}};
422 static const WCHAR test34
[] = {0x130d,0x12d5,0x12dd};
423 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
}};
424 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
}};
425 static const int b342
[2] = {2,2};
428 static const WCHAR test35
[] = {0x182e,0x1823,0x1829,0x182d,0x1823,0x182f,0x0020,0x182a,0x1822,0x1834,0x1822,0x182d,0x180c};
429 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
}};
430 static const int b351
[2] = {2,2};
431 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
}};
432 static const int b352
[2] = {2,3};
433 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
}};
436 static const WCHAR test36
[] = {0x2d5c,0x2d49,0x2d3c,0x2d49,0x2d4f,0x2d30,0x2d56};
437 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
}};
438 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
}};
441 static const WCHAR test37
[] = {0x07d2,0x07de,0x07cf};
442 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
}};
443 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
}};
444 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
}};
447 static const WCHAR test38
[] = {0xa559,0xa524};
448 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
}};
449 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
}};
452 static const WCHAR test39
[] = {0x13e3,0x13b3,0x13a9,0x0020,0x13a6,0x13ec,0x13c2,0x13af,0x13cd,0x13d7};
453 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
}};
454 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
}};
456 /* Canadian Aboriginal Syllabics */
457 static const WCHAR test40
[] = {0x1403,0x14c4,0x1483,0x144e,0x1450,0x1466};
458 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
}};
459 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
}};
462 static const WCHAR test41
[] = {0x169b,0x1691,0x168c,0x1690,0x168b,0x169c};
463 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
}};
464 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
}};
465 static const int b412
[2] = {1,1};
468 static const WCHAR test42
[] = {0x16a0,0x16a1,0x16a2,0x16a3,0x16a4,0x16a5};
469 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
}};
470 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
}};
473 static const WCHAR test43
[] = {0x280f,0x2817,0x2811,0x280d,0x280a,0x2811,0x2817};
474 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
}};
475 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
}};
477 /* Private and Surrogates Area */
478 static const WCHAR test44
[] = {0xe000, 0xe001, 0xd800, 0xd801};
479 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
}};
480 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
}};
483 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};
484 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
}};
485 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
}};
488 static const WCHAR test46
[] = {0xd801,0xdc8b,0xd801,0xdc98,0xd801,0xdc88,0xd801,0xdc91,0xd801,0xdc9b,0xd801,0xdc92,0xd801,0xdc95,0xd801,0xdc80};
489 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
}};
490 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
}};
492 /* Mathematical Alphanumeric Symbols */
493 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};
494 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
}};
495 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
}};
497 /* Mathematical and Numeric combinations */
498 /* These have a leading hebrew character to force complicated itemization */
499 static const WCHAR test48
[] = {0x05e9,' ','1','2','3','.'};
500 static const itemTest t481
[4] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,FALSE
},
501 {{0,0,0,0,0},2,0,1,2,0,0,FALSE
},{{0,0,0,0,0},5,0,0,0,0,0,FALSE
},
502 {{0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
503 static const itemTest t482
[4] = {{{0,0,0,0,0,0},0,0,0,0,1,hebr_tag
,FALSE
},
504 {{0,0,0,0,0,0},2,0,1,0,1,0,FALSE
},
505 {{0,0,0,0,0,0},5,0,0,0,1,0,FALSE
},
506 {{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
508 static const WCHAR test49
[] = {0x05e9,' ','1','2','.','1','2'};
509 static const itemTest t491
[3] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,FALSE
},
510 {{0,0,0,0,0},2,0,1,2,0,0,FALSE
},{{0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
511 static const itemTest t492
[3] = {{{0,0,0,0,0,0},0,0,0,0,1,hebr_tag
,FALSE
},
512 {{0,0,0,0,0,0},2,0,1,0,1,0,FALSE
},
513 {{0,0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
515 static const WCHAR test50
[] = {0x05e9,' ','.','1','2','3'};
516 static const itemTest t501
[4] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,FALSE
},
517 {{0,0,0,0,0},2,1,1,1,0,0,FALSE
},{{0,0,0,0,0},3,0,1,2,0,0,FALSE
},
518 {{0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
519 static const itemTest t502
[4] = {{{0,0,0,0,0,0},0,0,0,0,1,hebr_tag
,FALSE
},
520 {{0,0,0,0,0,0},2,0,0,0,1,0,FALSE
},
521 {{0,0,0,0,0,0},3,0,1,0,1,0,FALSE
},
522 {{0,0,0,0,0,0},6,0,0,0,0,-1,FALSE
}};
524 static const WCHAR test51
[] = {0x05e9,' ','a','b','.','1','2'};
525 static const itemTest t511
[5] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,FALSE
},
526 {{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
},
527 {{0,0,0,0,0},5,0,0,2,0,0,FALSE
},{{0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
528 static const itemTest t512
[5] = {{{0,0,0,0,0,0},0,0,0,0,1,hebr_tag
,FALSE
},
529 {{0,0,0,0,0,0},2,0,0,0,1,latn_tag
,FALSE
},
530 {{0,0,0,0,0,0},4,0,0,0,1,0,FALSE
},
531 {{0,0,0,0,0,0},5,0,0,0,1,0,FALSE
},
532 {{0,0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
534 static const WCHAR test52
[] = {0x05e9,' ','1','2','.','a','b'};
535 static const itemTest t521
[5] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,FALSE
},
536 {{0,0,0,0,0},2,0,1,2,0,0,FALSE
},{{0,0,0,0,0},4,0,0,0,0,0,FALSE
},
537 {{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
}};
538 static const itemTest t522
[5] = {{{0,0,0,0,0,0},0,0,0,0,1,hebr_tag
,FALSE
},
539 {{0,0,0,0,0,0},2,0,1,0,1,0,FALSE
},
540 {{0,0,0,0,0,0},4,0,0,0,1,0,FALSE
},
541 {{0,0,0,0,0,0},5,0,0,0,1,latn_tag
,FALSE
},
542 {{0,0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
544 static const WCHAR test53
[] = {0x05e9,' ','1','2','.','.','1','2'};
545 static const itemTest t531
[5] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,FALSE
},
546 {{0,0,0,0,0},2,0,1,2,0,0,FALSE
},{{0,0,0,0,0},4,1,1,1,0,0,FALSE
},
547 {{0,0,0,0,0},6,0,1,2,0,0,FALSE
},{{0,0,0,0,0},8,0,0,0,0,-1,FALSE
}};
548 static const itemTest t532
[5] = {{{0,0,0,0,0,0},0,0,0,0,1,hebr_tag
,FALSE
},
549 {{0,0,0,0,0,0},2,0,1,0,1,0,FALSE
},
550 {{0,0,0,0,0,0},4,0,0,0,1,0,FALSE
},
551 {{0,0,0,0,0,0},6,0,1,0,1,0,FALSE
},
552 {{0,0,0,0,0,0},8,0,0,0,0,-1,FALSE
}};
554 static const WCHAR test54
[] = {0x05e9,' ','1','2','+','1','2'};
555 static const itemTest t541
[3] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,FALSE
},
556 {{0,0,0,0,0},2,0,1,2,0,0,FALSE
},{{0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
557 static const itemTest t542
[3] = {{{0,0,0,0,0,0},0,0,0,0,1,hebr_tag
,FALSE
},
558 {{0,0,0,0,0,0},2,0,1,0,1,0,FALSE
},
559 {{0,0,0,0,0,0},7,0,0,0,0,-1,FALSE
}};
560 static const WCHAR test55
[] = {0x05e9,' ','1','2','+','+','1','2'};
561 static const itemTest t551
[3] = {{{0,0,0,0,0,0},0,1,1,1,0,hebr_tag
,FALSE
},
562 {{0,0,0,0,0},2,0,1,2,0,0,FALSE
},{{0,0,0,0,0},8,0,0,0,0,-1,FALSE
}};
563 static const itemTest t552
[3] = {{{0,0,0,0,0,0},0,0,0,0,1,hebr_tag
,FALSE
},
564 {{0,0,0,0,0,0},2,0,1,0,1,0,FALSE
},
565 {{0,0,0,0,0,0},8,0,0,0,0,-1,FALSE
}};
568 static const WCHAR test56
[] = {0x0645, 0x06cc, 0x200c, 0x06a9, 0x0646, 0x0645}; /* می‌کنم */
569 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
}};
570 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
}};
572 /* Persian numerals and punctuation. */
573 static const WCHAR test57
[] = {0x06f1, 0x06f2, 0x066c, 0x06f3, 0x06f4, 0x06f5, 0x066c, /* Û±Û²Ù¬Û³Û´ÛµÙ¬ */
574 0x06f6, 0x06f7, 0x06f8, 0x066b, 0x06f9, 0x06f0}; /* Û¶Û·Û¸Ù«Û¹Û° */
575 static const itemTest t571
[] = {{{0,0,0,0,0,0}, 0,0,1,2,0,arab_tag
,FALSE
},{{0,0,0,0,0,0}, 2,0,1,2,0,arab_tag
,FALSE
},
576 {{0,0,0,0,0,0}, 3,0,1,2,0,arab_tag
,FALSE
},{{0,0,0,0,0,0}, 6,0,1,2,0,arab_tag
,FALSE
},
577 {{0,0,0,0,0,0}, 7,0,1,2,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},10,0,1,2,0,arab_tag
,FALSE
},
578 {{0,0,0,0,0,0},11,0,1,2,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},13,0,0,0,0,-1,FALSE
}};
579 static const itemTest t572
[] = {{{0,0,0,0,0,0}, 0,0,0,2,0,arab_tag
,FALSE
},{{0,0,1,0,0,0}, 2,0,1,2,0,arab_tag
,FALSE
},
580 {{0,0,0,0,0,0}, 3,0,0,2,0,arab_tag
,FALSE
},{{0,0,1,0,0,0}, 6,0,1,2,0,arab_tag
,FALSE
},
581 {{0,0,0,0,0,0}, 7,0,0,2,0,arab_tag
,FALSE
},{{0,0,1,0,0,0},10,0,1,2,0,arab_tag
,FALSE
},
582 {{0,0,0,0,0,0},11,0,0,2,0,arab_tag
,FALSE
},{{0,0,0,0,0,0},13,0,0,0,0,-1,FALSE
}};
583 static const itemTest t573
[] = {{{0,0,0,0,0,0}, 0,0,0,0,1,arab_tag
,FALSE
},{{0,0,0,0,0,0}, 2,0,0,0,1,arab_tag
,FALSE
},
584 {{0,0,0,0,0,0}, 3,0,0,0,1,arab_tag
,FALSE
},{{0,0,0,0,0,0}, 6,0,0,0,1,arab_tag
,FALSE
},
585 {{0,0,0,0,0,0}, 7,0,0,0,1,arab_tag
,FALSE
},{{0,0,0,0,0,0},10,0,0,0,1,arab_tag
,FALSE
},
586 {{0,0,0,0,0,0},11,0,0,0,1,arab_tag
,FALSE
},{{0,0,0,0,0,0},13,0,0,0,0,-1,FALSE
}};
587 /* Arabic numerals and punctuation. */
588 static const WCHAR test58
[] = {0x0661, 0x0662, 0x066c, 0x0663, 0x0664, 0x0665, 0x066c, /* ١٢٬٣٤٥٬ */
589 0x0666, 0x0667, 0x0668, 0x066b, 0x0669, 0x0660}; /* ٦٧٨٫٩٠*/
590 static const itemTest t581
[] = {{{0,0,0,0,0,0}, 0,0,1,2,0,arab_tag
,FALSE
},
591 {{0,0,0,0,0,0},13,0,0,0,0,-1,FALSE
}};
592 static const itemTest t582
[] = {{{0,0,1,1,0,1}, 0,0,0,0,1,arab_tag
,FALSE
},
593 {{0,0,0,0,0,0},13,0,0,0,0,-1,FALSE
}};
595 SCRIPT_ITEM items
[15];
596 SCRIPT_CONTROL Control
;
602 usp10
= LoadLibraryA("usp10.dll");
603 ok (usp10
!= 0,"Unable to LoadLibrary on usp10.dll\n");
604 pScriptItemizeOpenType
= (void*)GetProcAddress(usp10
, "ScriptItemizeOpenType");
605 pScriptShapeOpenType
= (void*)GetProcAddress(usp10
, "ScriptShapeOpenType");
606 pGetGlyphIndicesW
= (void*)GetProcAddress(GetModuleHandleA("gdi32.dll"), "GetGlyphIndicesW");
608 memset(&Control
, 0, sizeof(Control
));
609 memset(&State
, 0, sizeof(State
));
611 hr
= ScriptItemize(NULL
, 4, 10, &Control
, &State
, items
, NULL
);
612 ok (hr
== E_INVALIDARG
, "ScriptItemize should return E_INVALIDARG if pwcInChars is NULL\n");
614 hr
= ScriptItemize(test1
, 4, 10, &Control
, &State
, NULL
, NULL
);
615 ok (hr
== E_INVALIDARG
, "ScriptItemize should return E_INVALIDARG if pItems is NULL\n");
617 hr
= ScriptItemize(test1
, 4, 1, &Control
, &State
, items
, NULL
);
618 ok (hr
== E_INVALIDARG
, "ScriptItemize should return E_INVALIDARG if cMaxItems < 2.\n");
620 hr
= ScriptItemize(test1
, 0, 10, NULL
, NULL
, items
, &nItems
);
621 ok (hr
== E_INVALIDARG
, "ScriptItemize should return E_INVALIDARG if cInChars is 0\n");
623 test_items_ok(test1
,4,NULL
,NULL
,1,t11
,FALSE
,0);
624 test_items_ok(test1b
,4,NULL
,NULL
,1,t1b1
,FALSE
,0);
625 test_items_ok(test1c
,6,NULL
,NULL
,1,t1c1
,FALSE
,0);
626 test_items_ok(test2
,16,NULL
,NULL
,6,t21
,FALSE
,0);
627 test_items_ok(test2b
,11,NULL
,NULL
,4,t2b1
,FALSE
,0);
628 test_items_ok(test2c
,11,NULL
,NULL
,4,t2c1
,FALSE
,0);
629 test_items_ok(test2d
,11,NULL
,NULL
,4,t2d1
,FALSE
,0);
630 test_items_ok(test3
,41,NULL
,NULL
,1,t31
,FALSE
,0);
631 test_items_ok(test4
,12,NULL
,NULL
,5,t41
,FALSE
,0);
632 test_items_ok(test5
,38,NULL
,NULL
,1,t51
,FALSE
,0);
633 test_items_ok(test6
,5,NULL
,NULL
,2,t61
,FALSE
,0);
634 test_items_ok(test7
,29,NULL
,NULL
,3,t71
,FALSE
,0);
635 test_items_ok(test8
,4,NULL
,NULL
,1,t81
,FALSE
,0);
636 test_items_ok(test9
,5,NULL
,NULL
,2,t91
,FALSE
,0);
637 test_items_ok(test10
,4,NULL
,NULL
,1,t101
,FALSE
,0);
638 test_items_ok(test11
,8,NULL
,NULL
,1,t111
,FALSE
,0);
639 test_items_ok(test12
,5,NULL
,NULL
,1,t121
,FALSE
,0);
640 test_items_ok(test13
,7,NULL
,NULL
,1,t131
,FALSE
,0);
641 test_items_ok(test14
,7,NULL
,NULL
,1,t141
,FALSE
,0);
642 test_items_ok(test15
,5,NULL
,NULL
,1,t151
,FALSE
,0);
643 test_items_ok(test16
,5,NULL
,NULL
,1,t161
,FALSE
,0);
644 test_items_ok(test17
,6,NULL
,NULL
,1,t171
,FALSE
,0);
645 test_items_ok(test18
,5,NULL
,NULL
,1,t181
,FALSE
,0);
646 test_items_ok(test19
,6,NULL
,NULL
,1,t191
,FALSE
,0);
647 test_items_ok(test20
,5,NULL
,NULL
,2,t201
,FALSE
,0);
648 test_items_ok(test21
,5,NULL
,NULL
,1,t211
,FALSE
,0);
649 test_items_ok(test22
,6,NULL
,NULL
,2,t221
,FALSE
,0);
650 test_items_ok(test23
,6,NULL
,NULL
,2,t231
,FALSE
,0);
651 test_items_ok(test24
,12,NULL
,NULL
,1,t241
,FALSE
,0);
652 test_items_ok(test25
,10,NULL
,NULL
,1,t251
,FALSE
,0);
653 test_items_ok(test26
,2,NULL
,NULL
,1,t261
,FALSE
,0);
654 test_items_ok(test27
,8,NULL
,NULL
,1,t271
,FALSE
,0);
655 test_items_ok(test28
,4,NULL
,NULL
,1,t281
,FALSE
,0);
656 test_items_ok(test29
,10,NULL
,NULL
,2,t291
,FALSE
,0);
657 test_items_ok(test30
,8,NULL
,NULL
,1,t301
,FALSE
,0);
658 test_items_ok(test31
,8,NULL
,NULL
,1,t311
,FALSE
,b311
);
659 test_items_ok(test32
,3,NULL
,NULL
,1,t321
,FALSE
,0);
660 test_items_ok(test33
,4,NULL
,NULL
,1,t331
,FALSE
,0);
661 test_items_ok(test34
,3,NULL
,NULL
,1,t341
,FALSE
,0);
662 test_items_ok(test35
,13,NULL
,NULL
,1,t351
,FALSE
,b351
);
663 test_items_ok(test36
,7,NULL
,NULL
,1,t361
,FALSE
,0);
664 test_items_ok(test37
,3,NULL
,NULL
,1,t371
,FALSE
,0);
665 test_items_ok(test38
,2,NULL
,NULL
,1,t381
,FALSE
,0);
666 test_items_ok(test39
,10,NULL
,NULL
,1,t391
,FALSE
,0);
667 test_items_ok(test40
,6,NULL
,NULL
,1,t401
,FALSE
,0);
668 test_items_ok(test41
,6,NULL
,NULL
,1,t411
,FALSE
,0);
669 test_items_ok(test42
,6,NULL
,NULL
,1,t421
,FALSE
,0);
670 test_items_ok(test43
,7,NULL
,NULL
,1,t431
,FALSE
,0);
671 test_items_ok(test44
,4,NULL
,NULL
,2,t441
,FALSE
,0);
672 test_items_ok(test45
,24,NULL
,NULL
,1,t451
,FALSE
,0);
673 test_items_ok(test46
,16,NULL
,NULL
,1,t461
,FALSE
,0);
674 test_items_ok(test47
,26,NULL
,NULL
,1,t471
,FALSE
,0);
675 test_items_ok(test56
,6,NULL
,NULL
,1,t561
,FALSE
,0);
676 test_items_ok(test57
,13,NULL
,NULL
,7,t571
,FALSE
,0);
677 test_items_ok(test58
,13,NULL
,NULL
,1,t581
,FALSE
,0);
679 State
.uBidiLevel
= 0;
680 test_items_ok(test1
,4,&Control
,&State
,1,t11
,FALSE
,0);
681 test_items_ok(test1b
,4,&Control
,&State
,1,t1b1
,FALSE
,0);
682 test_items_ok(test1c
,6,&Control
,&State
,1,t1c1
,FALSE
,0);
683 test_items_ok(test2
,16,&Control
,&State
,4,t22
,FALSE
,0);
684 test_items_ok(test2b
,11,&Control
,&State
,4,t2b1
,FALSE
,0);
685 test_items_ok(test2c
,11,&Control
,&State
,5,t2c2
,FALSE
,0);
686 test_items_ok(test2d
,11,&Control
,&State
,5,t2d2
,FALSE
,0);
687 test_items_ok(test3
,41,&Control
,&State
,1,t31
,FALSE
,0);
688 test_items_ok(test4
,12,&Control
,&State
,5,t41
,FALSE
,0);
689 test_items_ok(test5
,38,&Control
,&State
,1,t51
,FALSE
,0);
690 test_items_ok(test6
,5,&Control
,&State
,2,t61
,FALSE
,0);
691 test_items_ok(test7
,29,&Control
,&State
,3,t72
,FALSE
,0);
692 test_items_ok(test8
,4,&Control
,&State
,1,t81
,FALSE
,0);
693 test_items_ok(test9
,5,&Control
,&State
,2,t91
,FALSE
,0);
694 test_items_ok(test10
,4,&Control
,&State
,1,t101
,FALSE
,0);
695 test_items_ok(test11
,8,&Control
,&State
,1,t111
,FALSE
,0);
696 test_items_ok(test12
,5,&Control
,&State
,1,t121
,FALSE
,0);
697 test_items_ok(test13
,7,&Control
,&State
,1,t131
,FALSE
,0);
698 test_items_ok(test14
,7,&Control
,&State
,1,t141
,FALSE
,0);
699 test_items_ok(test15
,5,&Control
,&State
,1,t151
,FALSE
,0);
700 test_items_ok(test16
,5,&Control
,&State
,1,t161
,FALSE
,0);
701 test_items_ok(test17
,6,&Control
,&State
,1,t171
,FALSE
,0);
702 test_items_ok(test18
,5,&Control
,&State
,1,t181
,FALSE
,0);
703 test_items_ok(test19
,6,&Control
,&State
,1,t191
,FALSE
,0);
704 test_items_ok(test20
,5,&Control
,&State
,2,t201
,FALSE
,0);
705 test_items_ok(test21
,5,&Control
,&State
,1,t211
,FALSE
,0);
706 test_items_ok(test22
,6,&Control
,&State
,2,t221
,FALSE
,0);
707 test_items_ok(test23
,6,&Control
,&State
,2,t231
,FALSE
,0);
708 test_items_ok(test24
,12,&Control
,&State
,1,t241
,FALSE
,0);
709 test_items_ok(test25
,10,&Control
,&State
,1,t251
,FALSE
,0);
710 test_items_ok(test26
,2,&Control
,&State
,1,t261
,FALSE
,0);
711 test_items_ok(test27
,8,&Control
,&State
,1,t271
,FALSE
,0);
712 test_items_ok(test28
,4,&Control
,&State
,1,t281
,FALSE
,0);
713 test_items_ok(test29
,10,&Control
,&State
,2,t291
,FALSE
,0);
714 test_items_ok(test30
,8,&Control
,&State
,1,t301
,FALSE
,0);
715 test_items_ok(test31
,8,&Control
,&State
,1,t311
,FALSE
,b311
);
716 test_items_ok(test32
,3,&Control
,&State
,1,t321
,FALSE
,0);
717 test_items_ok(test33
,4,&Control
,&State
,1,t331
,FALSE
,0);
718 test_items_ok(test34
,3,&Control
,&State
,1,t341
,FALSE
,0);
719 test_items_ok(test35
,13,&Control
,&State
,1,t351
,FALSE
,b351
);
720 test_items_ok(test36
,7,&Control
,&State
,1,t361
,FALSE
,0);
721 test_items_ok(test37
,3,&Control
,&State
,1,t371
,FALSE
,0);
722 test_items_ok(test38
,2,&Control
,&State
,1,t381
,FALSE
,0);
723 test_items_ok(test39
,10,&Control
,&State
,1,t391
,FALSE
,0);
724 test_items_ok(test40
,6,&Control
,&State
,1,t401
,FALSE
,0);
725 test_items_ok(test41
,6,&Control
,&State
,1,t411
,FALSE
,0);
726 test_items_ok(test42
,6,&Control
,&State
,1,t421
,FALSE
,0);
727 test_items_ok(test43
,7,&Control
,&State
,1,t431
,FALSE
,0);
728 test_items_ok(test44
,4,&Control
,&State
,2,t441
,FALSE
,0);
729 test_items_ok(test45
,24,&Control
,&State
,1,t451
,FALSE
,0);
730 test_items_ok(test46
,16,&Control
,&State
,1,t461
,FALSE
,0);
731 test_items_ok(test47
,26,&Control
,&State
,1,t471
,FALSE
,0);
732 test_items_ok(test48
,6,&Control
,&State
,3,t481
,FALSE
,0);
733 test_items_ok(test49
,7,&Control
,&State
,2,t491
,FALSE
,0);
734 test_items_ok(test50
,6,&Control
,&State
,3,t501
,FALSE
,0);
735 test_items_ok(test51
,7,&Control
,&State
,4,t511
,FALSE
,0);
736 test_items_ok(test52
,7,&Control
,&State
,4,t521
,FALSE
,0);
737 test_items_ok(test53
,8,&Control
,&State
,4,t531
,FALSE
,0);
738 test_items_ok(test54
,7,&Control
,&State
,2,t541
,FALSE
,0);
739 test_items_ok(test55
,8,&Control
,&State
,2,t551
,FALSE
,0);
740 test_items_ok(test56
,6,&Control
,&State
,1,t561
,FALSE
,0);
741 test_items_ok(test57
,13,&Control
,&State
,7,t572
,FALSE
,0);
742 test_items_ok(test58
,13,&Control
,&State
,1,t581
,FALSE
,0);
744 State
.uBidiLevel
= 1;
745 test_items_ok(test1
,4,&Control
,&State
,1,t12
,FALSE
,0);
746 test_items_ok(test1b
,4,&Control
,&State
,1,t1b2
,FALSE
,0);
747 test_items_ok(test1c
,6,&Control
,&State
,3,t1c2
,FALSE
,0);
748 test_items_ok(test2
,16,&Control
,&State
,4,t23
,FALSE
,0);
749 test_items_ok(test2b
,11,&Control
,&State
,4,t2b2
,FALSE
,0);
750 test_items_ok(test2c
,11,&Control
,&State
,4,t2c3
,FALSE
,0);
751 test_items_ok(test2d
,11,&Control
,&State
,4,t2d3
,FALSE
,0);
752 test_items_ok(test3
,41,&Control
,&State
,1,t32
,FALSE
,0);
753 test_items_ok(test4
,12,&Control
,&State
,4,t42
,FALSE
,0);
754 test_items_ok(test5
,38,&Control
,&State
,1,t51
,FALSE
,0);
755 test_items_ok(test6
,5,&Control
,&State
,2,t62
,FALSE
,0);
756 test_items_ok(test7
,29,&Control
,&State
,3,t73
,FALSE
,0);
757 test_items_ok(test8
,4,&Control
,&State
,1,t81
,FALSE
,0);
758 test_items_ok(test9
,5,&Control
,&State
,2,t92
,FALSE
,0);
759 test_items_ok(test10
,4,&Control
,&State
,1,t101
,FALSE
,0);
760 test_items_ok(test11
,8,&Control
,&State
,1,t112
,FALSE
,0);
761 test_items_ok(test12
,5,&Control
,&State
,1,t122
,FALSE
,0);
762 test_items_ok(test13
,7,&Control
,&State
,1,t132
,FALSE
,0);
763 test_items_ok(test14
,7,&Control
,&State
,1,t142
,FALSE
,0);
764 test_items_ok(test15
,5,&Control
,&State
,1,t152
,FALSE
,0);
765 test_items_ok(test16
,5,&Control
,&State
,1,t162
,FALSE
,0);
766 test_items_ok(test17
,6,&Control
,&State
,1,t172
,FALSE
,0);
767 test_items_ok(test18
,5,&Control
,&State
,1,t182
,FALSE
,0);
768 test_items_ok(test19
,6,&Control
,&State
,1,t192
,FALSE
,0);
769 test_items_ok(test20
,5,&Control
,&State
,2,t202
,FALSE
,0);
770 test_items_ok(test21
,5,&Control
,&State
,1,t211
,FALSE
,0);
771 test_items_ok(test22
,6,&Control
,&State
,2,t222
,FALSE
,b222
);
772 test_items_ok(test23
,6,&Control
,&State
,2,t232
,FALSE
,0);
773 test_items_ok(test24
,12,&Control
,&State
,1,t242
,FALSE
,0);
774 test_items_ok(test25
,10,&Control
,&State
,1,t252
,FALSE
,0);
775 test_items_ok(test26
,2,&Control
,&State
,1,t262
,FALSE
,0);
776 test_items_ok(test27
,8,&Control
,&State
,1,t272
,FALSE
,0);
777 test_items_ok(test28
,4,&Control
,&State
,1,t282
,FALSE
,0);
778 test_items_ok(test29
,10,&Control
,&State
,2,t292
,FALSE
,0);
779 test_items_ok(test30
,8,&Control
,&State
,1,t302
,FALSE
,0);
780 test_items_ok(test31
,8,&Control
,&State
,1,t312
,FALSE
,b312
);
781 test_items_ok(test32
,3,&Control
,&State
,1,t322
,FALSE
,0);
782 test_items_ok(test33
,4,&Control
,&State
,1,t332
,FALSE
,0);
783 test_items_ok(test34
,3,&Control
,&State
,1,t342
,FALSE
,b342
);
784 test_items_ok(test35
,13,&Control
,&State
,1,t352
,FALSE
,b352
);
785 test_items_ok(test36
,7,&Control
,&State
,1,t362
,FALSE
,0);
786 test_items_ok(test37
,3,&Control
,&State
,1,t372
,FALSE
,0);
787 test_items_ok(test38
,2,&Control
,&State
,1,t382
,FALSE
,0);
788 test_items_ok(test39
,10,&Control
,&State
,1,t392
,FALSE
,0);
789 test_items_ok(test40
,6,&Control
,&State
,1,t402
,FALSE
,0);
790 test_items_ok(test41
,6,&Control
,&State
,3,t412
,FALSE
,b412
);
791 test_items_ok(test42
,6,&Control
,&State
,1,t422
,FALSE
,0);
792 test_items_ok(test43
,7,&Control
,&State
,1,t432
,FALSE
,0);
793 test_items_ok(test44
,4,&Control
,&State
,2,t442
,FALSE
,0);
794 test_items_ok(test45
,24,&Control
,&State
,1,t452
,FALSE
,0);
795 test_items_ok(test46
,16,&Control
,&State
,1,t462
,FALSE
,0);
796 test_items_ok(test47
,26,&Control
,&State
,1,t472
,FALSE
,0);
797 test_items_ok(test56
,6,&Control
,&State
,1,t561
,FALSE
,0);
798 test_items_ok(test57
,13,&Control
,&State
,7,t571
,FALSE
,0);
799 test_items_ok(test58
,13,&Control
,&State
,1,t581
,FALSE
,0);
801 State
.uBidiLevel
= 1;
802 Control
.fMergeNeutralItems
= TRUE
;
803 test_items_ok(test1
,4,&Control
,&State
,1,t12
,FALSE
,0);
804 test_items_ok(test1b
,4,&Control
,&State
,1,t1b2
,FALSE
,0);
805 test_items_ok(test1c
,6,&Control
,&State
,3,t1c2
,FALSE
,0);
806 test_items_ok(test2
,16,&Control
,&State
,4,t23
,FALSE
,0);
807 test_items_ok(test2b
,11,&Control
,&State
,2,t2b3
,FALSE
,b2
);
808 test_items_ok(test2c
,11,&Control
,&State
,2,t2c4
,FALSE
,b2
);
809 test_items_ok(test2d
,11,&Control
,&State
,2,t2d4
,FALSE
,b2
);
810 test_items_ok(test3
,41,&Control
,&State
,1,t32
,FALSE
,0);
811 test_items_ok(test4
,12,&Control
,&State
,3,t43
,FALSE
,b43
);
812 test_items_ok(test5
,38,&Control
,&State
,1,t51
,FALSE
,0);
813 test_items_ok(test6
,5,&Control
,&State
,1,t63
,FALSE
,b63
);
814 test_items_ok(test7
,29,&Control
,&State
,3,t73
,FALSE
,0);
815 test_items_ok(test8
,4,&Control
,&State
,1,t81
,FALSE
,0);
816 test_items_ok(test9
,5,&Control
,&State
,1,t93
,FALSE
,b93
);
817 test_items_ok(test10
,4,&Control
,&State
,1,t101
,FALSE
,0);
818 test_items_ok(test11
,8,&Control
,&State
,1,t112
,FALSE
,0);
819 test_items_ok(test12
,5,&Control
,&State
,1,t122
,FALSE
,0);
820 test_items_ok(test13
,7,&Control
,&State
,1,t132
,FALSE
,0);
821 test_items_ok(test14
,7,&Control
,&State
,1,t142
,FALSE
,0);
822 test_items_ok(test15
,5,&Control
,&State
,1,t152
,FALSE
,0);
823 test_items_ok(test16
,5,&Control
,&State
,1,t162
,FALSE
,0);
824 test_items_ok(test17
,6,&Control
,&State
,1,t172
,FALSE
,0);
825 test_items_ok(test18
,5,&Control
,&State
,1,t182
,FALSE
,0);
826 test_items_ok(test19
,6,&Control
,&State
,1,t192
,FALSE
,0);
827 test_items_ok(test20
,5,&Control
,&State
,2,t202
,FALSE
,0);
828 test_items_ok(test21
,5,&Control
,&State
,1,t211
,FALSE
,0);
829 test_items_ok(test22
,6,&Control
,&State
,1,t223
,FALSE
,b223
);
830 test_items_ok(test23
,6,&Control
,&State
,2,t232
,FALSE
,0);
831 test_items_ok(test24
,12,&Control
,&State
,1,t242
,FALSE
,0);
832 test_items_ok(test25
,10,&Control
,&State
,1,t252
,FALSE
,0);
833 test_items_ok(test26
,2,&Control
,&State
,1,t262
,FALSE
,0);
834 test_items_ok(test27
,8,&Control
,&State
,1,t272
,FALSE
,0);
835 test_items_ok(test28
,4,&Control
,&State
,1,t282
,FALSE
,0);
836 test_items_ok(test29
,10,&Control
,&State
,2,t292
,FALSE
,0);
837 test_items_ok(test30
,8,&Control
,&State
,1,t302
,FALSE
,0);
838 test_items_ok(test31
,8,&Control
,&State
,1,t312
,FALSE
,b312
);
839 test_items_ok(test32
,3,&Control
,&State
,1,t322
,FALSE
,0);
840 test_items_ok(test33
,4,&Control
,&State
,1,t332
,FALSE
,0);
841 test_items_ok(test34
,3,&Control
,&State
,1,t342
,FALSE
,b342
);
842 test_items_ok(test35
,13,&Control
,&State
,1,t352
,FALSE
,b352
);
843 test_items_ok(test36
,7,&Control
,&State
,1,t362
,FALSE
,0);
844 test_items_ok(test37
,3,&Control
,&State
,1,t372
,FALSE
,0);
845 test_items_ok(test38
,2,&Control
,&State
,1,t382
,FALSE
,0);
846 test_items_ok(test39
,10,&Control
,&State
,1,t392
,FALSE
,0);
847 test_items_ok(test40
,6,&Control
,&State
,1,t402
,FALSE
,0);
848 test_items_ok(test41
,6,&Control
,&State
,3,t412
,FALSE
,b412
);
849 test_items_ok(test42
,6,&Control
,&State
,1,t422
,FALSE
,0);
850 test_items_ok(test43
,7,&Control
,&State
,1,t432
,FALSE
,0);
851 test_items_ok(test44
,4,&Control
,&State
,2,t442
,FALSE
,0);
852 test_items_ok(test45
,24,&Control
,&State
,1,t452
,FALSE
,0);
853 test_items_ok(test46
,16,&Control
,&State
,1,t462
,FALSE
,0);
854 test_items_ok(test47
,26,&Control
,&State
,1,t472
,FALSE
,0);
855 test_items_ok(test56
,6,&Control
,&State
,1,t561
,FALSE
,0);
856 test_items_ok(test57
,13,&Control
,&State
,7,t571
,FALSE
,0);
857 test_items_ok(test58
,13,&Control
,&State
,1,t581
,FALSE
,0);
859 State
.uBidiLevel
= 0;
860 Control
.fMergeNeutralItems
= FALSE
;
861 State
.fOverrideDirection
= 1;
862 test_items_ok(test1
,4,&Control
,&State
,1,t11
,FALSE
,0);
863 test_items_ok(test1b
,4,&Control
,&State
,1,t1b1
,FALSE
,0);
864 test_items_ok(test1c
,6,&Control
,&State
,1,t1c1
,FALSE
,0);
865 test_items_ok(test2
,16,&Control
,&State
,4,t24
,FALSE
,0);
866 test_items_ok(test2b
,11,&Control
,&State
,4,t2b4
,FALSE
,0);
867 test_items_ok(test2c
,11,&Control
,&State
,4,t2c5
,FALSE
,0);
868 test_items_ok(test2d
,11,&Control
,&State
,4,t2d5
,FALSE
,0);
869 test_items_ok(test3
,41,&Control
,&State
,1,t31
,FALSE
,0);
870 test_items_ok(test4
,12,&Control
,&State
,5,t41
,FALSE
,0);
871 test_items_ok(test5
,38,&Control
,&State
,1,t52
,FALSE
,0);
872 test_items_ok(test6
,5,&Control
,&State
,2,t64
,FALSE
,0);
873 test_items_ok(test7
,29,&Control
,&State
,3,t74
,FALSE
,0);
874 test_items_ok(test8
,4,&Control
,&State
,1,t82
,FALSE
,0);
875 test_items_ok(test9
,5,&Control
,&State
,2,t94
,FALSE
,0);
876 test_items_ok(test10
,4,&Control
,&State
,1,t102
,FALSE
,0);
877 test_items_ok(test11
,8,&Control
,&State
,1,t111
,FALSE
,0);
878 test_items_ok(test12
,5,&Control
,&State
,1,t121
,FALSE
,0);
879 test_items_ok(test13
,7,&Control
,&State
,1,t131
,FALSE
,0);
880 test_items_ok(test14
,7,&Control
,&State
,1,t141
,FALSE
,0);
881 test_items_ok(test15
,5,&Control
,&State
,1,t151
,FALSE
,0);
882 test_items_ok(test16
,5,&Control
,&State
,1,t161
,FALSE
,0);
883 test_items_ok(test17
,6,&Control
,&State
,1,t171
,FALSE
,0);
884 test_items_ok(test18
,5,&Control
,&State
,1,t181
,FALSE
,0);
885 test_items_ok(test19
,6,&Control
,&State
,1,t191
,FALSE
,0);
886 test_items_ok(test20
,5,&Control
,&State
,2,t201
,FALSE
,0);
887 test_items_ok(test21
,5,&Control
,&State
,1,t212
,FALSE
,0);
888 test_items_ok(test22
,6,&Control
,&State
,2,t221
,FALSE
,0);
889 test_items_ok(test23
,6,&Control
,&State
,2,t231
,FALSE
,0);
890 test_items_ok(test24
,12,&Control
,&State
,1,t241
,FALSE
,0);
891 test_items_ok(test25
,10,&Control
,&State
,1,t251
,FALSE
,0);
892 test_items_ok(test26
,2,&Control
,&State
,1,t261
,FALSE
,0);
893 test_items_ok(test27
,8,&Control
,&State
,1,t271
,FALSE
,0);
894 test_items_ok(test28
,4,&Control
,&State
,1,t281
,FALSE
,0);
895 test_items_ok(test29
,10,&Control
,&State
,2,t291
,FALSE
,0);
896 test_items_ok(test30
,8,&Control
,&State
,1,t301
,FALSE
,0);
897 test_items_ok(test31
,8,&Control
,&State
,1,t311
,FALSE
,b311
);
898 test_items_ok(test32
,3,&Control
,&State
,1,t321
,FALSE
,0);
899 test_items_ok(test33
,4,&Control
,&State
,1,t331
,FALSE
,0);
900 test_items_ok(test34
,3,&Control
,&State
,1,t341
,FALSE
,0);
901 test_items_ok(test35
,13,&Control
,&State
,1,t353
,FALSE
,b351
);
902 test_items_ok(test36
,7,&Control
,&State
,1,t361
,FALSE
,0);
903 test_items_ok(test37
,3,&Control
,&State
,1,t373
,FALSE
,0);
904 test_items_ok(test38
,2,&Control
,&State
,1,t381
,FALSE
,0);
905 test_items_ok(test39
,10,&Control
,&State
,1,t391
,FALSE
,0);
906 test_items_ok(test40
,6,&Control
,&State
,1,t401
,FALSE
,0);
907 test_items_ok(test41
,6,&Control
,&State
,1,t411
,FALSE
,0);
908 test_items_ok(test42
,6,&Control
,&State
,1,t421
,FALSE
,0);
909 test_items_ok(test43
,7,&Control
,&State
,1,t431
,FALSE
,0);
910 test_items_ok(test44
,4,&Control
,&State
,2,t441
,FALSE
,0);
911 test_items_ok(test45
,24,&Control
,&State
,1,t451
,FALSE
,0);
912 test_items_ok(test46
,16,&Control
,&State
,1,t461
,FALSE
,0);
913 test_items_ok(test47
,26,&Control
,&State
,1,t471
,FALSE
,0);
914 test_items_ok(test48
,6,&Control
,&State
,3,t482
,FALSE
,0);
915 test_items_ok(test49
,7,&Control
,&State
,2,t492
,FALSE
,0);
916 test_items_ok(test50
,6,&Control
,&State
,3,t502
,FALSE
,0);
917 test_items_ok(test51
,7,&Control
,&State
,4,t512
,FALSE
,0);
918 test_items_ok(test52
,7,&Control
,&State
,4,t522
,FALSE
,0);
919 test_items_ok(test53
,8,&Control
,&State
,4,t532
,FALSE
,0);
920 test_items_ok(test54
,7,&Control
,&State
,2,t542
,FALSE
,0);
921 test_items_ok(test55
,8,&Control
,&State
,2,t552
,FALSE
,0);
922 test_items_ok(test56
,6,&Control
,&State
,1,t562
,FALSE
,0);
923 test_items_ok(test57
,13,&Control
,&State
,7,t573
,FALSE
,0);
924 test_items_ok(test58
,13,&Control
,&State
,1,t582
,FALSE
,0);
927 static inline void _test_shape_ok(int valid
, HDC hdc
, LPCWSTR string
,
928 DWORD cchString
, SCRIPT_CONTROL
*Control
,
929 SCRIPT_STATE
*State
, DWORD item
, DWORD nGlyphs
,
930 const shapeTest_char
*charItems
,
931 const shapeTest_glyph
*glyphItems
,
932 const SCRIPT_GLYPHPROP
*props2
)
935 int x
, outnItems
=0, outnGlyphs
=0;
936 SCRIPT_ITEM outpItems
[15];
937 SCRIPT_CACHE sc
= NULL
;
940 int maxGlyphs
= cchString
* 1.5;
941 SCRIPT_GLYPHPROP
*glyphProp
;
942 SCRIPT_CHARPROP
*charProp
;
945 hr
= pScriptItemizeOpenType(string
, cchString
, 15, Control
, State
, outpItems
, tags
, &outnItems
);
946 if (hr
== USP_E_SCRIPT_NOT_IN_FONT
)
949 winetest_win_skip("Select font does not support script\n");
951 winetest_trace("Select font does not support script\n");
955 winetest_ok(hr
== S_OK
, "ScriptItemizeOpenType should return S_OK not %08x\n", hr
);
957 winetest_trace("ScriptItemizeOpenType should return S_OK not %08x\n", hr
);
959 if (outnItems
<= item
)
962 winetest_win_skip("Did not get enough items\n");
964 winetest_trace("Did not get enough items\n");
968 logclust
= HeapAlloc(GetProcessHeap(), 0, sizeof(WORD
) * cchString
);
969 memset(logclust
,'a',sizeof(WORD
) * cchString
);
970 charProp
= HeapAlloc(GetProcessHeap(), 0, sizeof(SCRIPT_CHARPROP
) * cchString
);
971 memset(charProp
,'a',sizeof(SCRIPT_CHARPROP
) * cchString
);
972 glyphs
= HeapAlloc(GetProcessHeap(), 0, sizeof(WORD
) * maxGlyphs
);
973 memset(glyphs
,'a',sizeof(WORD
) * cchString
);
974 glyphProp
= HeapAlloc(GetProcessHeap(), 0, sizeof(SCRIPT_GLYPHPROP
) * maxGlyphs
);
975 memset(glyphProp
,'a',sizeof(SCRIPT_GLYPHPROP
) * cchString
);
977 hr
= pScriptShapeOpenType(hdc
, &sc
, &outpItems
[item
].a
, tags
[item
], 0x00000000, NULL
, NULL
, 0, string
, cchString
, maxGlyphs
, logclust
, charProp
, glyphs
, glyphProp
, &outnGlyphs
);
979 winetest_ok(hr
== S_OK
, "ScriptShapeOpenType failed (%x)\n",hr
);
981 winetest_trace("ScriptShapeOpenType failed (%x)\n",hr
);
985 for (x
= 0; x
< cchString
; x
++)
988 winetest_ok(logclust
[x
] == charItems
[x
].wLogClust
, "%i: invalid LogClust(%i)\n",x
,logclust
[x
]);
989 else if (logclust
[x
] != charItems
[x
].wLogClust
)
990 winetest_trace("%i: invalid LogClust(%i)\n",x
,logclust
[x
]);
992 winetest_ok(charProp
[x
].fCanGlyphAlone
== charItems
[x
].CharProp
.fCanGlyphAlone
, "%i: invalid fCanGlyphAlone\n",x
);
993 else if (charProp
[x
].fCanGlyphAlone
!= charItems
[x
].CharProp
.fCanGlyphAlone
)
994 winetest_trace("%i: invalid fCanGlyphAlone\n",x
);
998 winetest_ok(nGlyphs
== outnGlyphs
, "got incorrect number of glyphs (%i)\n",outnGlyphs
);
999 else if (nGlyphs
!= outnGlyphs
)
1000 winetest_trace("got incorrect number of glyphs (%i)\n",outnGlyphs
);
1001 for (x
= 0; x
< outnGlyphs
; x
++)
1003 if (glyphItems
[x
].Glyph
)
1006 winetest_ok(glyphs
[x
]!=0, "%i: Glyph not present when it should be\n",x
);
1007 else if (glyphs
[x
]==0)
1008 winetest_trace("%i: Glyph not present when it should be\n",x
);
1013 winetest_ok(glyphs
[x
]==0, "%i: Glyph present when it should not be\n",x
);
1014 else if (glyphs
[x
]!=0)
1015 winetest_trace("%i: Glyph present when it should not be\n",x
);
1018 winetest_ok(glyphProp
[x
].sva
.uJustification
== glyphItems
[x
].GlyphProp
.sva
.uJustification
||
1019 (props2
&& glyphProp
[x
].sva
.uJustification
== props2
[x
].sva
.uJustification
),
1020 "%i: uJustification incorrect (%i)\n",x
,glyphProp
[x
].sva
.uJustification
);
1021 else if (glyphProp
[x
].sva
.uJustification
!= glyphItems
[x
].GlyphProp
.sva
.uJustification
)
1022 winetest_trace("%i: uJustification incorrect (%i)\n",x
,glyphProp
[x
].sva
.uJustification
);
1024 winetest_ok(glyphProp
[x
].sva
.fClusterStart
== glyphItems
[x
].GlyphProp
.sva
.fClusterStart
||
1025 (props2
&& glyphProp
[x
].sva
.fClusterStart
== props2
[x
].sva
.fClusterStart
),
1026 "%i: fClusterStart incorrect (%i)\n",x
,glyphProp
[x
].sva
.fClusterStart
);
1027 else if (glyphProp
[x
].sva
.fClusterStart
!= glyphItems
[x
].GlyphProp
.sva
.fClusterStart
)
1028 winetest_trace("%i: fClusterStart incorrect (%i)\n",x
,glyphProp
[x
].sva
.fClusterStart
);
1030 winetest_ok(glyphProp
[x
].sva
.fDiacritic
== glyphItems
[x
].GlyphProp
.sva
.fDiacritic
||
1031 (props2
&& glyphProp
[x
].sva
.fDiacritic
== props2
[x
].sva
.fDiacritic
),
1032 "%i: fDiacritic incorrect (%i)\n",x
,glyphProp
[x
].sva
.fDiacritic
);
1033 else if (glyphProp
[x
].sva
.fDiacritic
!= glyphItems
[x
].GlyphProp
.sva
.fDiacritic
)
1034 winetest_trace("%i: fDiacritic incorrect (%i)\n",x
,glyphProp
[x
].sva
.fDiacritic
);
1036 winetest_ok(glyphProp
[x
].sva
.fZeroWidth
== glyphItems
[x
].GlyphProp
.sva
.fZeroWidth
||
1037 (props2
&& glyphProp
[x
].sva
.fZeroWidth
== props2
[x
].sva
.fZeroWidth
),
1038 "%i: fZeroWidth incorrect (%i)\n",x
,glyphProp
[x
].sva
.fZeroWidth
);
1039 else if (glyphProp
[x
].sva
.fZeroWidth
!= glyphItems
[x
].GlyphProp
.sva
.fZeroWidth
)
1040 winetest_trace("%i: fZeroWidth incorrect (%i)\n",x
,glyphProp
[x
].sva
.fZeroWidth
);
1044 HeapFree(GetProcessHeap(),0,logclust
);
1045 HeapFree(GetProcessHeap(),0,charProp
);
1046 HeapFree(GetProcessHeap(),0,glyphs
);
1047 HeapFree(GetProcessHeap(),0,glyphProp
);
1048 ScriptFreeCache(&sc
);
1051 #define test_shape_ok(a,b,c,d,e,f,g,h,i) \
1052 (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _test_shape_ok(1,a,b,c,d,e,f,g,h,i,NULL)
1054 #define test_shape_ok_valid(v,a,b,c,d,e,f,g,h,i) \
1055 (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _test_shape_ok(v,a,b,c,d,e,f,g,h,i,NULL)
1057 #define test_shape_ok_valid_props2(v,a,b,c,d,e,f,g,h,i,j) \
1058 (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _test_shape_ok(v,a,b,c,d,e,f,g,h,i,j)
1060 typedef struct tagRangeP
{
1065 static int CALLBACK
enumFontProc( const LOGFONTA
*lpelfe
, const TEXTMETRICA
*lpntme
, DWORD FontType
, LPARAM lParam
)
1067 NEWTEXTMETRICEXA
*ntme
= (NEWTEXTMETRICEXA
*)lpntme
;
1068 fontEnumParam
*rp
= (fontEnumParam
*) lParam
;
1073 if (FontType
!= TRUETYPE_FONTTYPE
)
1077 while (i
>= sizeof(DWORD
)*8)
1080 i
-= (sizeof(DWORD
)*8);
1087 if (ntme
->ntmFontSig
.fsUsb
[idx
] & mask
)
1089 memcpy(&(rp
->lf
),lpelfe
,sizeof(LOGFONTA
));
1095 static int _find_font_for_range(HDC hdc
, const CHAR
*recommended
, BYTE range
, const WCHAR check
, HFONT
*hfont
, HFONT
*origFont
)
1098 fontEnumParam lParam
;
1100 lParam
.range
= range
;
1101 memset(&lParam
.lf
,0,sizeof(LOGFONTA
));
1106 lstrcpyA(lParam
.lf
.lfFaceName
, recommended
);
1107 if (!EnumFontFamiliesExA(hdc
, &lParam
.lf
, enumFontProc
, (LPARAM
)&lParam
, 0))
1109 *hfont
= CreateFontIndirectA(&lParam
.lf
);
1112 winetest_trace("using font %s\n",lParam
.lf
.lfFaceName
);
1120 memset(&lParam
.lf
,0,sizeof(LOGFONTA
));
1121 lParam
.lf
.lfCharSet
= DEFAULT_CHARSET
;
1123 if (!EnumFontFamiliesExA(hdc
, &lParam
.lf
, enumFontProc
, (LPARAM
)&lParam
, 0) && lParam
.lf
.lfFaceName
[0])
1125 *hfont
= CreateFontIndirectA(&lParam
.lf
);
1127 winetest_trace("trying font %s: failures will only be warnings\n",lParam
.lf
.lfFaceName
);
1135 *origFont
= SelectObject(hdc
,*hfont
);
1136 if (pGetGlyphIndicesW
&& (pGetGlyphIndicesW(hdc
, &check
, 1, &glyph
, 0) == GDI_ERROR
|| glyph
==0))
1138 winetest_trace(" Font fails to contain required glyphs\n");
1139 SelectObject(hdc
,*origFont
);
1140 DeleteObject(*hfont
);
1148 winetest_trace("Failed to find usable font\n");
1153 #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)
1155 static void test_ScriptShapeOpenType(HDC hdc
)
1158 SCRIPT_CACHE sc
= NULL
;
1159 WORD glyphs
[4], logclust
[4];
1160 SCRIPT_GLYPHPROP glyphProp
[4];
1161 SCRIPT_ITEM items
[2];
1163 SCRIPT_CONTROL Control
;
1166 HFONT hfont
, hfont_orig
;
1168 shapeTest_glyph glyph_test
[4];
1170 static const WCHAR test1
[] = {'w', 'i', 'n', 'e',0};
1171 static const shapeTest_char t1_c
[] = {{0,{0,0}},{1,{0,0}},{2,{0,0}},{3,{0,0}}};
1172 static const shapeTest_glyph t1_g
[] = {
1173 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1174 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1175 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1176 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}} };
1178 static const WCHAR test2
[] = {0x202B, 'i', 'n', 0x202C,0};
1179 static const shapeTest_char t2_c
[] = {{0,{0,0}},{1,{0,0}},{2,{0,0}},{3,{0,0}}};
1180 static const shapeTest_glyph t2_g
[] = {
1181 {0,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1182 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1183 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1184 {0,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}} };
1187 static const WCHAR test_hebrew
[] = {0x05e9, 0x05dc, 0x05d5, 0x05dd,0};
1188 static const shapeTest_char hebrew_c
[] = {{3,{0,0}},{2,{0,0}},{1,{0,0}},{0,{0,0}}};
1189 static const shapeTest_glyph hebrew_g
[] = {
1190 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1191 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1192 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1193 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}} };
1196 static const WCHAR test_arabic
[] = {0x0633,0x0644,0x0627,0x0645,0};
1197 static const shapeTest_char arabic_c
[] = {{2,{0,0}},{1,{0,0}},{1,{0,0}},{0,{0,0}}};
1198 static const shapeTest_glyph arabic_g
[] = {
1199 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1200 {1,{{SCRIPT_JUSTIFY_ARABIC_NORMAL
,1,0,0,0,0},0}},
1201 {1,{{SCRIPT_JUSTIFY_ARABIC_SEEN
,1,0,0,0,0},0}} };
1204 static const WCHAR test_thai
[] = {0x0e2a, 0x0e04, 0x0e23, 0x0e34, 0x0e1b, 0x0e15, 0x0e4c, 0x0e44, 0x0e17, 0x0e22,};
1205 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}}};
1206 static const shapeTest_glyph thai_g
[] = {
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_NONE
,1,0,0,0,0},0}},
1210 {1,{{SCRIPT_JUSTIFY_CHARACTER
,0,1,1,0,0},0}},
1211 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1212 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1213 {1,{{SCRIPT_JUSTIFY_CHARACTER
,0,1,1,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_syriac
[] = {0x0710, 0x0710, 0x0710, 0x0728, 0x0718, 0x0723,0};
1220 static const shapeTest_char syriac_c
[] = {{5,{0,0}},{4,{0,0}},{3,{0,0}},{2,{0,0}},{1,{0,0}},{0,{0,0}}};
1221 static const shapeTest_glyph syriac_g
[] = {
1222 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1223 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1224 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1225 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1226 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1227 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}} };
1230 static const WCHAR test_thaana
[] = {0x078a, 0x07ae, 0x0792, 0x07b0, 0x0020, 0x0796, 0x07aa, 0x0789, 0x07b0, 0x0795, 0x07ac, 0x0791, 0x07b0};
1231 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}}};
1232 static const shapeTest_glyph thaana_g
[] = {
1233 {1,{{SCRIPT_JUSTIFY_NONE
,0,1,1,0,0},0}},
1234 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1235 {1,{{SCRIPT_JUSTIFY_NONE
,0,1,1,0,0},0}},
1236 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1237 {1,{{SCRIPT_JUSTIFY_NONE
,0,1,1,0,0},0}},
1238 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1239 {1,{{SCRIPT_JUSTIFY_NONE
,0,1,1,0,0},0}},
1240 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1241 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1242 {1,{{SCRIPT_JUSTIFY_NONE
,0,1,1,0,0},0}},
1243 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1244 {1,{{SCRIPT_JUSTIFY_NONE
,0,1,1,0,0},0}},
1245 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}} };
1248 static const WCHAR test_phagspa
[] = {0xa84f, 0xa861, 0xa843, 0x0020, 0xa863, 0xa861, 0xa859, 0x0020, 0xa850, 0xa85c, 0xa85e};
1249 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}}};
1250 static const shapeTest_glyph phagspa_g
[] = {
1251 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1252 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1253 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1254 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1255 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1256 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1257 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1258 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1259 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1260 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1261 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}} };
1262 static const SCRIPT_GLYPHPROP phagspa_win10_props
[] = {
1263 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1264 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1265 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1266 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1267 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1268 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1269 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1270 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1271 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1272 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1273 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0} };
1276 static const WCHAR test_lao
[] = {0x0ead, 0x0eb1, 0x0e81, 0x0eaa, 0x0ead, 0x0e99, 0x0ea5, 0x0eb2, 0x0ea7, 0};
1277 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}}};
1278 static const shapeTest_glyph lao_g
[] = {
1279 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1280 {1,{{SCRIPT_JUSTIFY_CHARACTER
,0,1,1,0,0},0}},
1281 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1282 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1283 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1284 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1285 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1286 {1,{{SCRIPT_JUSTIFY_CHARACTER
,1,0,0,0,0},0}},
1287 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}} };
1290 static const WCHAR test_tibetan
[] = {0x0f04, 0x0f05, 0x0f0e, 0x0020, 0x0f51, 0x0f7c, 0x0f53, 0x0f0b, 0x0f5a, 0x0f53, 0x0f0b, 0x0f51, 0x0f44, 0x0f0b, 0x0f54, 0x0f7c, 0x0f0d};
1291 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}}};
1292 static const shapeTest_glyph tibetan_g
[] = {
1293 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1294 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1295 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1296 {1,{{SCRIPT_JUSTIFY_BLANK
,1,0,0,0,0},0}},
1297 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1298 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1299 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1300 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1301 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1302 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1303 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1304 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
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
,1,0,0,0,0},0}},
1308 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1309 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}} };
1310 static const SCRIPT_GLYPHPROP tibetan_win10_props
[] = {
1311 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1312 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1313 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1314 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1315 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1316 {{SCRIPT_JUSTIFY_NONE
,0,1,1,0,0},0},
1317 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1318 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1319 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1320 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1321 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1322 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1323 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1324 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1325 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0},
1326 {{SCRIPT_JUSTIFY_NONE
,0,1,1,0,0},0},
1327 {{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0} };
1330 static const WCHAR test_devanagari
[] = {0x0926, 0x0947, 0x0935, 0x0928, 0x093e, 0x0917, 0x0930, 0x0940};
1331 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}}};
1332 static const shapeTest_glyph devanagari_g
[] = {
1333 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1334 {1,{{SCRIPT_JUSTIFY_NONE
,0,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
,1,0,0,0,0},0}},
1340 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}} };
1343 static const WCHAR test_bengali
[] = {0x09ac, 0x09be, 0x0982, 0x09b2, 0x09be};
1344 static const shapeTest_char bengali_c
[] = {{0,{0,0}},{0,{0,0}},{0,{0,0}},{3,{0,0}},{3,{0,0}}};
1345 static const shapeTest_glyph bengali_g
[] = {
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
,0,0,0,0,0},0}},
1349 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1350 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}} };
1353 static const WCHAR test_gurmukhi
[] = {0x0a17, 0x0a41, 0x0a30, 0x0a2e, 0x0a41, 0x0a16, 0x0a40};
1354 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}}};
1355 static const shapeTest_glyph gurmukhi_g
[] = {
1356 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1357 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1358 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1359 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1360 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1361 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1362 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}} };
1365 static const WCHAR test_gujarati
[] = {0x0a97, 0x0ac1, 0x0a9c, 0x0ab0, 0x0abe, 0x0aa4, 0x0ac0};
1366 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}}};
1367 static const shapeTest_glyph gujarati_g
[] = {
1368 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1369 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1370 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1371 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1372 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1373 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1374 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}} };
1377 static const WCHAR test_oriya
[] = {0x0b13, 0x0b21, 0x0b3c, 0x0b3f, 0x0b06};
1378 static const shapeTest_char oriya_c
[] = {{0,{0,0}},{1,{0,0}},{1,{0,0}},{1,{0,0}},{3,{0,0}}};
1379 static const shapeTest_glyph oriya_g
[] = {
1380 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1381 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1382 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1383 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}} };
1386 static const WCHAR test_tamil
[] = {0x0ba4, 0x0bae, 0x0bbf, 0x0bb4, 0x0bcd};
1387 static const shapeTest_char tamil_c
[] = {{0,{0,0}},{1,{0,0}},{1,{0,0}},{3,{0,0}},{3,{0,0}}};
1388 static const shapeTest_glyph tamil_g
[] = {
1389 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1390 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1391 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1392 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}} };
1395 static const WCHAR test_telugu
[] = {0x0c24, 0x0c46, 0x0c32, 0x0c41, 0x0c17, 0x0c41};
1396 static const shapeTest_char telugu_c
[] = {{0,{0,0}},{0,{0,0}},{2,{0,0}},{2,{0,0}},{4,{0,0}},{4,{0,0}}};
1397 static const shapeTest_glyph telugu_g
[] = {
1398 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1399 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1400 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1401 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1402 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1403 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}} };
1406 static const WCHAR test_malayalam
[] = {0x0d2e, 0x0d32, 0x0d2f, 0x0d3e, 0x0d33, 0x0d02};
1407 static const shapeTest_char malayalam_c
[] = {{0,{0,0}},{1,{0,0}},{2,{0,0}},{2,{0,0}},{4,{0,0}},{4,{0,0}}};
1408 static const shapeTest_glyph malayalam_g
[] = {
1409 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1410 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1411 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1412 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1413 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1414 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}} };
1417 static const WCHAR test_kannada
[] = {0x0c95, 0x0ca8, 0x0ccd, 0x0ca8, 0x0ca1};
1418 static const shapeTest_char kannada_c
[] = {{0,{0,0}},{1,{0,0}},{1,{0,0}},{1,{0,0}},{3,{0,0}}};
1419 static const shapeTest_glyph kannada_g
[] = {
1420 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1421 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1422 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}},
1423 {1,{{SCRIPT_JUSTIFY_NONE
,1,0,0,0,0},0}},
1424 {1,{{SCRIPT_JUSTIFY_NONE
,0,0,0,0,0},0}} };
1426 if (!pScriptItemizeOpenType
|| !pScriptShapeOpenType
)
1428 win_skip("ScriptShapeOpenType not available on this platform\n");
1432 memset(&Control
, 0 , sizeof(Control
));
1433 memset(&State
, 0 , sizeof(State
));
1435 hr
= pScriptItemizeOpenType(test1
, 4, 2, &Control
, &State
, items
, tags
, &outnItems
);
1436 ok(hr
== S_OK
, "ScriptItemizeOpenType should return S_OK not %08x\n", hr
);
1437 ok(items
[0].a
.fNoGlyphIndex
== FALSE
, "fNoGlyphIndex TRUE\n");
1439 hr
= pScriptShapeOpenType(hdc
, &sc
, &items
[0].a
, tags
[0], 0x00000000, NULL
, NULL
, 0, test1
, 4, 4, NULL
, NULL
, glyphs
, NULL
, &nb
);
1440 ok(hr
== E_INVALIDARG
, "ScriptShapeOpenType should return E_INVALIDARG not %08x\n", hr
);
1442 hr
= pScriptShapeOpenType(hdc
, &sc
, &items
[0].a
, tags
[0], 0x00000000, NULL
, NULL
, 0, test1
, 4, 4, NULL
, NULL
, glyphs
, glyphProp
, NULL
);
1443 ok(hr
== E_INVALIDARG
, "ScriptShapeOpenType should return E_INVALIDARG not %08x\n", hr
);
1445 hr
= pScriptShapeOpenType(NULL
, &sc
, &items
[0].a
, tags
[0], 0x00000000, NULL
, NULL
, 0, test1
, 4, 4, NULL
, NULL
, glyphs
, glyphProp
, &nb
);
1446 ok(hr
== E_INVALIDARG
, "ScriptShapeOpenType should return E_PENDING not %08x\n", hr
);
1448 hr
= pScriptShapeOpenType(hdc
, &sc
, &items
[0].a
, tags
[0], 0x00000000, NULL
, NULL
, 0, test1
, 4, 4, NULL
, NULL
, glyphs
, glyphProp
, &nb
);
1449 ok( hr
== E_INVALIDARG
,
1450 "ScriptShapeOpenType should return E_FAIL or E_INVALIDARG, not %08x\n", hr
);
1451 hr
= pScriptShapeOpenType(hdc
, &sc
, &items
[0].a
, tags
[0], 0x00000000, NULL
, NULL
, 0, test1
, 4, 4, logclust
, NULL
, glyphs
, glyphProp
, &nb
);
1452 ok(hr
== E_INVALIDARG
, "ScriptShapeOpenType should return E_INVALIDARG not %08x\n", hr
);
1454 ScriptFreeCache(&sc
);
1456 test_shape_ok(hdc
, test1
, 4, &Control
, &State
, 0, 4, t1_c
, t1_g
);
1458 /* newer Tahoma has zerowidth space glyphs for 0x202b and 0x202c */
1459 memcpy(glyph_test
, t2_g
, sizeof(glyph_test
));
1460 GetGlyphIndicesW(hdc
, test2
, 4, glyphs
, 0);
1462 glyph_test
[0].Glyph
= 1;
1464 glyph_test
[3].Glyph
= 1;
1466 test_shape_ok(hdc
, test2
, 4, &Control
, &State
, 1, 4, t2_c
, glyph_test
);
1468 test_valid
= find_font_for_range(hdc
, "Microsoft Sans Serif", 11, test_hebrew
[0], &hfont
, &hfont_orig
);
1471 test_shape_ok_valid(test_valid
, hdc
, test_hebrew
, 4, &Control
, &State
, 0, 4, hebrew_c
, hebrew_g
);
1472 SelectObject(hdc
, hfont_orig
);
1473 DeleteObject(hfont
);
1476 test_valid
= find_font_for_range(hdc
, "Microsoft Sans Serif", 13, test_arabic
[0], &hfont
, &hfont_orig
);
1479 test_shape_ok_valid(test_valid
, hdc
, test_arabic
, 4, &Control
, &State
, 0, 3, arabic_c
, arabic_g
);
1480 SelectObject(hdc
, hfont_orig
);
1481 DeleteObject(hfont
);
1484 test_valid
= find_font_for_range(hdc
, "Microsoft Sans Serif", 24, test_thai
[0], &hfont
, &hfont_orig
);
1487 test_shape_ok_valid(test_valid
, hdc
, test_thai
, 10, &Control
, &State
, 0, 10, thai_c
, thai_g
);
1488 SelectObject(hdc
, hfont_orig
);
1489 DeleteObject(hfont
);
1492 test_valid
= find_font_for_range(hdc
, "Estrangelo Edessa", 71, test_syriac
[0], &hfont
, &hfont_orig
);
1495 test_shape_ok_valid(test_valid
, hdc
, test_syriac
, 6, &Control
, &State
, 0, 6, syriac_c
, syriac_g
);
1496 SelectObject(hdc
, hfont_orig
);
1497 DeleteObject(hfont
);
1500 test_valid
= find_font_for_range(hdc
, "MV Boli", 72, test_thaana
[0], &hfont
, &hfont_orig
);
1503 test_shape_ok_valid(test_valid
, hdc
, test_thaana
, 13, &Control
, &State
, 0, 13, thaana_c
, thaana_g
);
1504 SelectObject(hdc
, hfont_orig
);
1505 DeleteObject(hfont
);
1508 test_valid
= find_font_for_range(hdc
, "Microsoft PhagsPa", 53, test_phagspa
[0], &hfont
, &hfont_orig
);
1511 test_shape_ok_valid_props2(test_valid
, hdc
, test_phagspa
, 11, &Control
, &State
, 0, 11,
1512 phagspa_c
, phagspa_g
, phagspa_win10_props
);
1513 SelectObject(hdc
, hfont_orig
);
1514 DeleteObject(hfont
);
1517 test_valid
= find_font_for_range(hdc
, "DokChampa", 25, test_lao
[0], &hfont
, &hfont_orig
);
1520 test_shape_ok_valid(test_valid
, hdc
, test_lao
, 9, &Control
, &State
, 0, 9, lao_c
, lao_g
);
1521 SelectObject(hdc
, hfont_orig
);
1522 DeleteObject(hfont
);
1525 test_valid
= find_font_for_range(hdc
, "Microsoft Himalaya", 70, test_tibetan
[0], &hfont
, &hfont_orig
);
1528 test_shape_ok_valid_props2(test_valid
, hdc
, test_tibetan
, 17, &Control
, &State
, 0, 17,
1529 tibetan_c
, tibetan_g
, tibetan_win10_props
);
1530 SelectObject(hdc
, hfont_orig
);
1531 DeleteObject(hfont
);
1534 test_valid
= find_font_for_range(hdc
, "Mangal", 15, test_devanagari
[0], &hfont
, &hfont_orig
);
1537 test_shape_ok_valid(test_valid
, hdc
, test_devanagari
, 8, &Control
, &State
, 0, 8, devanagari_c
, devanagari_g
);
1538 SelectObject(hdc
, hfont_orig
);
1539 DeleteObject(hfont
);
1542 test_valid
= find_font_for_range(hdc
, "Vrinda", 16, test_bengali
[0], &hfont
, &hfont_orig
);
1545 test_shape_ok_valid(test_valid
, hdc
, test_bengali
, 5, &Control
, &State
, 0, 5, bengali_c
, bengali_g
);
1546 SelectObject(hdc
, hfont_orig
);
1547 DeleteObject(hfont
);
1550 test_valid
= find_font_for_range(hdc
, "Raavi", 17, test_gurmukhi
[0], &hfont
, &hfont_orig
);
1553 test_shape_ok_valid(test_valid
, hdc
, test_gurmukhi
, 7, &Control
, &State
, 0, 7, gurmukhi_c
, gurmukhi_g
);
1554 SelectObject(hdc
, hfont_orig
);
1555 DeleteObject(hfont
);
1558 test_valid
= find_font_for_range(hdc
, "Shruti", 18, test_gujarati
[0], &hfont
, &hfont_orig
);
1561 test_shape_ok_valid(test_valid
, hdc
, test_gujarati
, 7, &Control
, &State
, 0, 7, gujarati_c
, gujarati_g
);
1562 SelectObject(hdc
, hfont_orig
);
1563 DeleteObject(hfont
);
1566 test_valid
= find_font_for_range(hdc
, "Kalinga", 19, test_oriya
[0], &hfont
, &hfont_orig
);
1569 test_shape_ok_valid(test_valid
, hdc
, test_oriya
, 5, &Control
, &State
, 0, 4, oriya_c
, oriya_g
);
1570 SelectObject(hdc
, hfont_orig
);
1571 DeleteObject(hfont
);
1574 test_valid
= find_font_for_range(hdc
, "Latha", 20, test_tamil
[0], &hfont
, &hfont_orig
);
1577 test_shape_ok_valid(test_valid
, hdc
, test_tamil
, 5, &Control
, &State
, 0, 4, tamil_c
, tamil_g
);
1578 SelectObject(hdc
, hfont_orig
);
1579 DeleteObject(hfont
);
1582 test_valid
= find_font_for_range(hdc
, "Gautami", 21, test_telugu
[0], &hfont
, &hfont_orig
);
1585 test_shape_ok_valid(test_valid
, hdc
, test_telugu
, 6, &Control
, &State
, 0, 6, telugu_c
, telugu_g
);
1586 SelectObject(hdc
, hfont_orig
);
1587 DeleteObject(hfont
);
1590 test_valid
= find_font_for_range(hdc
, "Kartika", 23, test_malayalam
[0], &hfont
, &hfont_orig
);
1593 test_shape_ok_valid(test_valid
, hdc
, test_malayalam
, 6, &Control
, &State
, 0, 6, malayalam_c
, malayalam_g
);
1594 SelectObject(hdc
, hfont_orig
);
1595 DeleteObject(hfont
);
1598 test_valid
= find_font_for_range(hdc
, "Tunga", 22, test_kannada
[0], &hfont
, &hfont_orig
);
1601 test_shape_ok_valid(test_valid
, hdc
, test_kannada
, 5, &Control
, &State
, 0, 4, kannada_c
, kannada_g
);
1602 SelectObject(hdc
, hfont_orig
);
1603 DeleteObject(hfont
);
1607 static void test_ScriptShape(HDC hdc
)
1609 static const WCHAR test1
[] = {'w', 'i', 'n', 'e',0};
1610 static const WCHAR test2
[] = {0x202B, 'i', 'n', 0x202C,0};
1612 SCRIPT_CACHE sc
= NULL
;
1613 WORD glyphs
[4], glyphs2
[4], logclust
[4], glyphs3
[4];
1614 SCRIPT_VISATTR attrs
[4];
1615 SCRIPT_ITEM items
[2];
1618 hr
= ScriptItemize(test1
, 4, 2, NULL
, NULL
, items
, NULL
);
1619 ok(hr
== S_OK
, "ScriptItemize should return S_OK not %08x\n", hr
);
1620 ok(items
[0].a
.fNoGlyphIndex
== FALSE
, "fNoGlyphIndex TRUE\n");
1622 hr
= ScriptShape(hdc
, &sc
, test1
, 4, 4, &items
[0].a
, glyphs
, NULL
, NULL
, &nb
);
1623 ok(hr
== E_INVALIDARG
, "ScriptShape should return E_INVALIDARG not %08x\n", hr
);
1625 hr
= ScriptShape(hdc
, &sc
, test1
, 4, 4, &items
[0].a
, glyphs
, NULL
, attrs
, NULL
);
1626 ok(hr
== E_INVALIDARG
, "ScriptShape should return E_INVALIDARG not %08x\n", hr
);
1628 hr
= ScriptShape(NULL
, &sc
, test1
, 4, 4, &items
[0].a
, glyphs
, NULL
, attrs
, &nb
);
1629 ok(hr
== E_PENDING
, "ScriptShape should return E_PENDING not %08x\n", hr
);
1631 hr
= ScriptShape(hdc
, &sc
, test1
, 4, 4, &items
[0].a
, glyphs
, NULL
, attrs
, &nb
);
1632 ok(broken(hr
== S_OK
) ||
1633 hr
== E_INVALIDARG
|| /* Vista, W2K8 */
1634 hr
== E_FAIL
, /* WIN7 */
1635 "ScriptShape should return E_FAIL or E_INVALIDARG, not %08x\n", hr
);
1636 ok(items
[0].a
.fNoGlyphIndex
== FALSE
, "fNoGlyphIndex TRUE\n");
1638 hr
= ScriptShape(hdc
, &sc
, test1
, 4, 4, &items
[0].a
, glyphs
, logclust
, attrs
, &nb
);
1639 ok(hr
== S_OK
, "ScriptShape should return S_OK not %08x\n", hr
);
1640 ok(items
[0].a
.fNoGlyphIndex
== FALSE
, "fNoGlyphIndex TRUE\n");
1643 memset(glyphs
,-1,sizeof(glyphs
));
1644 memset(logclust
,-1,sizeof(logclust
));
1645 memset(attrs
,-1,sizeof(attrs
));
1646 hr
= ScriptShape(NULL
, &sc
, test1
, 4, 4, &items
[0].a
, glyphs
, logclust
, attrs
, &nb
);
1647 ok(hr
== S_OK
, "ScriptShape should return S_OK not %08x\n", hr
);
1648 ok(nb
== 4, "Wrong number of items\n");
1649 ok(logclust
[0] == 0, "clusters out of order\n");
1650 ok(logclust
[1] == 1, "clusters out of order\n");
1651 ok(logclust
[2] == 2, "clusters out of order\n");
1652 ok(logclust
[3] == 3, "clusters out of order\n");
1653 ok(attrs
[0].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1654 ok(attrs
[1].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1655 ok(attrs
[2].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1656 ok(attrs
[3].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1657 ok(attrs
[0].fClusterStart
== 1, "fClusterStart incorrect\n");
1658 ok(attrs
[1].fClusterStart
== 1, "fClusterStart incorrect\n");
1659 ok(attrs
[2].fClusterStart
== 1, "fClusterStart incorrect\n");
1660 ok(attrs
[3].fClusterStart
== 1, "fClusterStart incorrect\n");
1661 ok(attrs
[0].fDiacritic
== 0, "fDiacritic incorrect\n");
1662 ok(attrs
[1].fDiacritic
== 0, "fDiacritic incorrect\n");
1663 ok(attrs
[2].fDiacritic
== 0, "fDiacritic incorrect\n");
1664 ok(attrs
[3].fDiacritic
== 0, "fDiacritic incorrect\n");
1665 ok(attrs
[0].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1666 ok(attrs
[1].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1667 ok(attrs
[2].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1668 ok(attrs
[3].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1670 ScriptFreeCache(&sc
);
1673 memset(glyphs2
,-1,sizeof(glyphs2
));
1674 memset(glyphs3
,-1,sizeof(glyphs3
));
1675 memset(logclust
,-1,sizeof(logclust
));
1676 memset(attrs
,-1,sizeof(attrs
));
1678 GetGlyphIndicesW(hdc
, test2
, 4, glyphs3
, 0);
1680 hr
= ScriptShape(hdc
, &sc
, test2
, 4, 4, &items
[0].a
, glyphs2
, logclust
, attrs
, &nb
);
1681 ok(hr
== S_OK
, "ScriptShape should return S_OK not %08x\n", hr
);
1682 ok(nb
== 4, "Wrong number of items\n");
1683 ok(glyphs2
[0] == glyphs3
[0], "Incorrect glyph for 0x202B\n");
1684 ok(glyphs2
[3] == glyphs3
[3], "Incorrect glyph for 0x202C\n");
1685 ok(logclust
[0] == 0, "clusters out of order\n");
1686 ok(logclust
[1] == 1, "clusters out of order\n");
1687 ok(logclust
[2] == 2, "clusters out of order\n");
1688 ok(logclust
[3] == 3, "clusters out of order\n");
1689 ok(attrs
[0].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1690 ok(attrs
[1].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1691 ok(attrs
[2].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1692 ok(attrs
[3].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1693 ok(attrs
[0].fClusterStart
== 1, "fClusterStart incorrect\n");
1694 ok(attrs
[1].fClusterStart
== 1, "fClusterStart incorrect\n");
1695 ok(attrs
[2].fClusterStart
== 1, "fClusterStart incorrect\n");
1696 ok(attrs
[3].fClusterStart
== 1, "fClusterStart incorrect\n");
1697 ok(attrs
[0].fDiacritic
== 0, "fDiacritic incorrect\n");
1698 ok(attrs
[1].fDiacritic
== 0, "fDiacritic incorrect\n");
1699 ok(attrs
[2].fDiacritic
== 0, "fDiacritic incorrect\n");
1700 ok(attrs
[3].fDiacritic
== 0, "fDiacritic incorrect\n");
1701 ok(attrs
[0].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1702 ok(attrs
[1].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1703 ok(attrs
[2].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1704 ok(attrs
[3].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1706 /* modify LTR to RTL */
1707 items
[0].a
.fRTL
= 1;
1708 memset(glyphs2
,-1,sizeof(glyphs2
));
1709 memset(logclust
,-1,sizeof(logclust
));
1710 memset(attrs
,-1,sizeof(attrs
));
1711 hr
= ScriptShape(hdc
, &sc
, test1
, 4, 4, &items
[0].a
, glyphs2
, logclust
, attrs
, &nb
);
1712 ok(hr
== S_OK
, "ScriptShape should return S_OK not %08x\n", hr
);
1713 ok(nb
== 4, "Wrong number of items\n");
1714 ok(glyphs2
[0] == glyphs
[3], "Glyphs not reordered properly\n");
1715 ok(glyphs2
[1] == glyphs
[2], "Glyphs not reordered properly\n");
1716 ok(glyphs2
[2] == glyphs
[1], "Glyphs not reordered properly\n");
1717 ok(glyphs2
[3] == glyphs
[0], "Glyphs not reordered properly\n");
1718 ok(logclust
[0] == 3, "clusters out of order\n");
1719 ok(logclust
[1] == 2, "clusters out of order\n");
1720 ok(logclust
[2] == 1, "clusters out of order\n");
1721 ok(logclust
[3] == 0, "clusters out of order\n");
1722 ok(attrs
[0].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1723 ok(attrs
[1].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1724 ok(attrs
[2].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1725 ok(attrs
[3].uJustification
== SCRIPT_JUSTIFY_CHARACTER
, "uJustification incorrect\n");
1726 ok(attrs
[0].fClusterStart
== 1, "fClusterStart incorrect\n");
1727 ok(attrs
[1].fClusterStart
== 1, "fClusterStart incorrect\n");
1728 ok(attrs
[2].fClusterStart
== 1, "fClusterStart incorrect\n");
1729 ok(attrs
[3].fClusterStart
== 1, "fClusterStart incorrect\n");
1730 ok(attrs
[0].fDiacritic
== 0, "fDiacritic incorrect\n");
1731 ok(attrs
[1].fDiacritic
== 0, "fDiacritic incorrect\n");
1732 ok(attrs
[2].fDiacritic
== 0, "fDiacritic incorrect\n");
1733 ok(attrs
[3].fDiacritic
== 0, "fDiacritic incorrect\n");
1734 ok(attrs
[0].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1735 ok(attrs
[1].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1736 ok(attrs
[2].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1737 ok(attrs
[3].fZeroWidth
== 0, "fZeroWidth incorrect\n");
1739 ScriptFreeCache(&sc
);
1741 /* some control characters are shown as blank */
1742 for (i
= 0; i
< 2; i
++)
1744 static const WCHAR space
[] = {' ', 0};
1745 static const WCHAR blanks
[] = {'\t', '\r', '\n', 0x001c, 0x001d, 0x001e, 0x001f,
1746 0x200b, 0x200c, 0x200d, 0x200e, 0x200f, /* ZWSP, ZWNJ, ZWJ, LRM, RLM */
1747 0x202a, 0x202b, 0x202c, 0x202d, 0x202e, 0}; /* LRE, RLE, PDF, LRO, RLO */
1748 HFONT font
, oldfont
= NULL
;
1751 font
= GetCurrentObject(hdc
, OBJ_FONT
);
1752 GetObjectA(font
, sizeof(lf
), &lf
);
1754 lstrcpyA(lf
.lfFaceName
, "MS Sans Serif");
1755 font
= CreateFontIndirectA(&lf
);
1756 oldfont
= SelectObject(hdc
, font
);
1759 hr
= ScriptItemize(space
, 1, 2, NULL
, NULL
, items
, NULL
);
1760 ok(hr
== S_OK
, "%s: expected S_OK, got %08x\n", lf
.lfFaceName
, hr
);
1762 hr
= ScriptShape(hdc
, &sc
, space
, 1, 1, &items
[0].a
, glyphs
, logclust
, attrs
, &nb
);
1763 ok(hr
== S_OK
, "%s: expected S_OK, got %08x\n", lf
.lfFaceName
, hr
);
1764 ok(nb
== 1, "%s: expected 1, got %d\n", lf
.lfFaceName
, nb
);
1766 for (j
= 0; blanks
[j
]; j
++)
1768 hr
= ScriptItemize(&blanks
[j
], 1, 2, NULL
, NULL
, items
, NULL
);
1769 ok(hr
== S_OK
, "%s: [%02x] expected S_OK, got %08x\n", lf
.lfFaceName
, blanks
[j
], hr
);
1771 ok(!items
[0].a
.fNoGlyphIndex
, "%s: [%02x] got unexpected fNoGlyphIndex %#x.\n",
1772 lf
.lfFaceName
, blanks
[j
], items
[0].a
.fNoGlyphIndex
);
1773 hr
= ScriptShape(hdc
, &sc
, &blanks
[j
], 1, 1, &items
[0].a
, glyphs2
, logclust
, attrs
, &nb
);
1774 ok(hr
== S_OK
, "%s: [%02x] expected S_OK, got %08x\n", lf
.lfFaceName
, blanks
[j
], hr
);
1775 ok(nb
== 1, "%s: [%02x] expected 1, got %d\n", lf
.lfFaceName
, blanks
[j
], nb
);
1776 ok(!items
[0].a
.fNoGlyphIndex
, "%s: [%02x] got unexpected fNoGlyphIndex %#x.\n",
1777 lf
.lfFaceName
, blanks
[j
], items
[0].a
.fNoGlyphIndex
);
1779 ok(glyphs
[0] == glyphs2
[0] ||
1780 broken(glyphs2
[0] == blanks
[j
] && (blanks
[j
] < 0x10)),
1781 "%s: [%02x] expected %04x, got %04x\n", lf
.lfFaceName
, blanks
[j
], glyphs
[0], glyphs2
[0]);
1782 ok(attrs
[0].fZeroWidth
|| broken(!attrs
[0].fZeroWidth
&& (blanks
[j
] < 0x10) /* Vista */),
1783 "%s: [%02x] got unexpected fZeroWidth %#x.\n", lf
.lfFaceName
, blanks
[j
], attrs
[0].fZeroWidth
);
1785 items
[0].a
.fNoGlyphIndex
= 1;
1786 hr
= ScriptShape(hdc
, &sc
, &blanks
[j
], 1, 1, &items
[0].a
, glyphs2
, logclust
, attrs
, &nb
);
1787 ok(hr
== S_OK
, "%s: [%02x] expected S_OK, got %08x\n", lf
.lfFaceName
, blanks
[j
], hr
);
1788 ok(nb
== 1, "%s: [%02x] expected 1, got %d\n", lf
.lfFaceName
, blanks
[j
], nb
);
1790 if (blanks
[j
] == 0x200b || blanks
[j
] == 0x200c || blanks
[j
] == 0x200d)
1792 ok(glyphs2
[0] == 0x0020,
1793 "%s: [%02x] got unexpected %04x.\n", lf
.lfFaceName
, blanks
[j
], glyphs2
[0]);
1794 ok(attrs
[0].fZeroWidth
, "%s: [%02x] got unexpected fZeroWidth %#x.\n",
1795 lf
.lfFaceName
, blanks
[j
], attrs
[0].fZeroWidth
);
1799 ok(glyphs2
[0] == blanks
[j
],
1800 "%s: [%02x] got unexpected %04x.\n", lf
.lfFaceName
, blanks
[j
], glyphs2
[0]);
1801 ok(!attrs
[0].fZeroWidth
, "%s: [%02x] got unexpected fZeroWidth %#x.\n",
1802 lf
.lfFaceName
, blanks
[j
], attrs
[0].fZeroWidth
);
1806 DeleteObject(SelectObject(hdc
, oldfont
));
1807 ScriptFreeCache(&sc
);
1811 static void test_ScriptPlace(HDC hdc
)
1813 static const WCHAR test1
[] = {'t', 'e', 's', 't',0};
1816 SCRIPT_CACHE sc
= NULL
;
1817 WORD glyphs
[4], logclust
[4];
1818 SCRIPT_VISATTR attrs
[4];
1819 SCRIPT_ITEM items
[2];
1824 hr
= ScriptItemize(test1
, 4, 2, NULL
, NULL
, items
, NULL
);
1825 ok(hr
== S_OK
, "ScriptItemize should return S_OK not %08x\n", hr
);
1826 ok(items
[0].a
.fNoGlyphIndex
== FALSE
, "fNoGlyphIndex TRUE\n");
1828 hr
= ScriptShape(hdc
, &sc
, test1
, 4, 4, &items
[0].a
, glyphs
, logclust
, attrs
, &nb
);
1829 ok(hr
== S_OK
, "ScriptShape should return S_OK not %08x\n", hr
);
1830 ok(items
[0].a
.fNoGlyphIndex
== FALSE
, "fNoGlyphIndex TRUE\n");
1832 hr
= ScriptPlace(hdc
, &sc
, glyphs
, 4, NULL
, &items
[0].a
, widths
, NULL
, NULL
);
1833 ok(hr
== E_INVALIDARG
, "ScriptPlace should return E_INVALIDARG not %08x\n", hr
);
1835 hr
= ScriptPlace(NULL
, &sc
, glyphs
, 4, attrs
, &items
[0].a
, widths
, NULL
, NULL
);
1836 ok(broken(hr
== E_PENDING
) ||
1837 hr
== E_INVALIDARG
|| /* Vista, W2K8 */
1838 hr
== E_FAIL
, /* WIN7 */
1839 "ScriptPlace should return E_FAIL or E_INVALIDARG, not %08x\n", hr
);
1841 hr
= ScriptPlace(NULL
, &sc
, glyphs
, 4, attrs
, &items
[0].a
, widths
, offset
, NULL
);
1842 ok(hr
== E_PENDING
, "ScriptPlace should return E_PENDING not %08x\n", hr
);
1844 hr
= ScriptPlace(NULL
, &sc
, glyphs
, 4, attrs
, &items
[0].a
, widths
, NULL
, abc
);
1845 ok(broken(hr
== E_PENDING
) ||
1846 hr
== E_INVALIDARG
|| /* Vista, W2K8 */
1847 hr
== E_FAIL
, /* WIN7 */
1848 "ScriptPlace should return E_FAIL or E_INVALIDARG, not %08x\n", hr
);
1850 hr
= ScriptPlace(hdc
, &sc
, glyphs
, 4, attrs
, &items
[0].a
, widths
, offset
, NULL
);
1851 ok(hr
== S_OK
, "ScriptPlace should return S_OK not %08x\n", hr
);
1852 ok(items
[0].a
.fNoGlyphIndex
== FALSE
, "fNoGlyphIndex TRUE\n");
1856 int old_width
= widths
[0];
1857 attrs
[0].fZeroWidth
= 1;
1859 hr
= ScriptPlace(hdc
, &sc
, glyphs
, 4, attrs
, &items
[0].a
, widths
, offset
, NULL
);
1860 ok(hr
== S_OK
, "ScriptPlace should return S_OK not %08x\n", hr
);
1861 ok(widths
[0] == 0, "got width %d\n", widths
[0]);
1862 widths
[0] = old_width
;
1865 skip("Glyph already has zero-width - skipping fZeroWidth test\n");
1867 ret
= ExtTextOutW(hdc
, 1, 1, 0, NULL
, glyphs
, 4, widths
);
1868 ok(ret
, "ExtTextOutW should return TRUE\n");
1870 ScriptFreeCache(&sc
);
1873 static void test_ScriptItemIzeShapePlace(HDC hdc
, unsigned short pwOutGlyphs
[256])
1877 const SCRIPT_PROPERTIES
**ppSp
;
1881 SCRIPT_ITEM pItem
[255];
1883 WCHAR TestItem1
[] = {'T', 'e', 's', 't', 'a', 0};
1884 WCHAR TestItem2
[] = {'T', 'e', 's', 't', 'b', 0};
1885 WCHAR TestItem3
[] = {'T', 'e', 's', 't', 'c',' ','1','2','3',' ',' ','e','n','d',0};
1886 WCHAR TestItem4
[] = {'T', 'e', 's', 't', 'd',' ',0x0684,0x0694,0x06a4,' ',' ','\r','\n','e','n','d',0};
1887 WCHAR TestItem5
[] = {0x0684,'T','e','s','t','e',' ',0x0684,0x0694,0x06a4,' ',' ','e','n','d',0};
1888 WCHAR TestItem6
[] = {'T', 'e', 's', 't', 'f',' ',' ',' ','\r','\n','e','n','d',0};
1893 unsigned short pwOutGlyphs1
[256];
1894 unsigned short pwOutGlyphs2
[256];
1895 unsigned short pwLogClust
[256];
1896 SCRIPT_VISATTR psva
[256];
1899 GOFFSET pGoffset
[256];
1903 /* Start testing usp10 functions */
1904 /* This test determines that the pointer returned by ScriptGetProperties is valid
1905 * by checking a known value in the table */
1906 hr
= ScriptGetProperties(&ppSp
, &iMaxProps
);
1907 ok(hr
== S_OK
, "ScriptGetProperties failed: 0x%08x\n", hr
);
1908 trace("number of script properties %d\n", iMaxProps
);
1909 ok (iMaxProps
> 0, "Number of scripts returned should not be 0\n");
1911 ok( ppSp
[0]->langid
== 0, "Langid[0] not = to 0\n"); /* Check a known value to ensure */
1914 /* This is a valid test that will cause parsing to take place */
1917 hr
= ScriptItemize(TestItem1
, cInChars
, cMaxItems
, NULL
, NULL
, pItem
, &pcItems
);
1918 ok (hr
== S_OK
, "ScriptItemize should return S_OK, returned %08x\n", hr
);
1919 /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is *
1921 ok (pcItems
> 0, "The number of SCRIPT_ITEMS should be greater than 0\n");
1923 ok (pItem
[0].iCharPos
== 0 && pItem
[1].iCharPos
== cInChars
,
1924 "Start pos not = 0 (%d) or end pos not = %d (%d)\n",
1925 pItem
[0].iCharPos
, cInChars
, pItem
[1].iCharPos
);
1927 /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue
1928 * ie. ScriptItemize has succeeded and that pItem has been set */
1931 psc
= NULL
; /* must be null on first call */
1933 cMaxGlyphs
= cInChars
;
1934 hr
= ScriptShape(NULL
, &psc
, TestItem1
, cChars
,
1935 cMaxGlyphs
, &pItem
[0].a
,
1936 pwOutGlyphs1
, pwLogClust
, psva
, &pcGlyphs
);
1937 ok (hr
== E_PENDING
, "If psc is NULL (%08x) the E_PENDING should be returned\n", hr
);
1939 hr
= ScriptShape(hdc
, &psc
, TestItem1
, cChars
,
1940 cMaxGlyphs
, &pItem
[0].a
,
1941 pwOutGlyphs1
, pwLogClust
, psva
, &pcGlyphs
);
1942 ok (hr
== E_OUTOFMEMORY
, "If not enough output area cChars (%d) is > than CMaxGlyphs "
1943 "(%d) but not E_OUTOFMEMORY\n",
1944 cChars
, cMaxGlyphs
);
1946 hr
= ScriptShape(hdc
, &psc
, TestItem1
, cChars
,
1947 cMaxGlyphs
, &pItem
[0].a
,
1948 pwOutGlyphs1
, pwLogClust
, psva
, &pcGlyphs
);
1949 ok (hr
== S_OK
, "ScriptShape should return S_OK not (%08x)\n", hr
);
1950 ok (psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
1951 ok (pcGlyphs
== cChars
, "Chars in (%d) should equal Glyphs out (%d)\n", cChars
, pcGlyphs
);
1953 hr
= ScriptPlace(hdc
, &psc
, pwOutGlyphs1
, pcGlyphs
, psva
, &pItem
[0].a
, piAdvance
,
1955 ok (hr
== S_OK
, "ScriptPlace should return S_OK not (%08x)\n", hr
);
1956 hr
= ScriptPlace(NULL
, &psc
, pwOutGlyphs1
, pcGlyphs
, psva
, &pItem
[0].a
, piAdvance
,
1958 ok (hr
== S_OK
, "ScriptPlace should return S_OK not (%08x)\n", hr
);
1959 for (cnt
=0; cnt
< pcGlyphs
; cnt
++)
1960 pwOutGlyphs
[cnt
] = pwOutGlyphs1
[cnt
]; /* Send to next function */
1963 /* This test will check to make sure that SCRIPT_CACHE is reused and that not translation *
1964 * takes place if fNoGlyphIndex is set. */
1968 hr
= ScriptItemize(TestItem2
, cInChars
, cMaxItems
, NULL
, NULL
, pItem
, &pcItems
);
1969 ok (hr
== S_OK
, "ScriptItemize should return S_OK, returned %08x\n", hr
);
1970 /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is *
1972 ok (pItem
[0].iCharPos
== 0 && pItem
[1].iCharPos
== cInChars
,
1973 "Start pos not = 0 (%d) or end pos not = %d (%d)\n",
1974 pItem
[0].iCharPos
, cInChars
, pItem
[1].iCharPos
);
1975 /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue */
1979 pItem
[0].a
.fNoGlyphIndex
= 1; /* say no translate */
1980 hr
= ScriptShape(NULL
, &psc
, TestItem2
, cChars
,
1981 cMaxGlyphs
, &pItem
[0].a
,
1982 pwOutGlyphs2
, pwLogClust
, psva
, &pcGlyphs
);
1983 ok (hr
!= E_PENDING
, "If psc should not be NULL (%08x) and the E_PENDING should be returned\n", hr
);
1984 ok (hr
== S_OK
, "ScriptShape should return S_OK not (%08x)\n", hr
);
1985 ok (psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
1986 ok (pcGlyphs
== cChars
, "Chars in (%d) should equal Glyphs out (%d)\n", cChars
, pcGlyphs
);
1987 for (cnt
=0; cnt
< cChars
&& TestItem2
[cnt
] == pwOutGlyphs2
[cnt
]; cnt
++) {}
1988 ok (cnt
== cChars
, "Translation to place when told not to. WCHAR %d - %04x != %04x\n",
1989 cnt
, TestItem2
[cnt
], pwOutGlyphs2
[cnt
]);
1991 hr
= ScriptPlace(hdc
, &psc
, pwOutGlyphs2
, pcGlyphs
, psva
, &pItem
[0].a
, piAdvance
,
1993 ok (hr
== S_OK
, "ScriptPlace should return S_OK not (%08x)\n", hr
);
1996 ScriptFreeCache( &psc
);
1997 ok (!psc
, "psc is not null after ScriptFreeCache\n");
2001 /* This is a valid test that will cause parsing to take place and create 3 script_items */
2002 cInChars
= (sizeof(TestItem3
)/2)-1;
2004 hr
= ScriptItemize(TestItem3
, cInChars
, cMaxItems
, NULL
, NULL
, pItem
, &pcItems
);
2005 ok (hr
== S_OK
, "ScriptItemize should return S_OK, returned %08x\n", hr
);
2008 ok (pcItems
== 3, "The number of SCRIPT_ITEMS should be 3 not %d\n", pcItems
);
2011 ok (pItem
[0].iCharPos
== 0 && pItem
[1].iCharPos
== 6,
2012 "Start pos [0] not = 0 (%d) or end pos [1] not = %d\n",
2013 pItem
[0].iCharPos
, pItem
[1].iCharPos
);
2014 ok (pItem
[1].iCharPos
== 6 && pItem
[2].iCharPos
== 11,
2015 "Start pos [1] not = 6 (%d) or end pos [2] not = 11 (%d)\n",
2016 pItem
[1].iCharPos
, pItem
[2].iCharPos
);
2017 ok (pItem
[2].iCharPos
== 11 && pItem
[3].iCharPos
== cInChars
,
2018 "Start pos [2] not = 11 (%d) or end [3] pos not = 14 (%d), cInChars = %d\n",
2019 pItem
[2].iCharPos
, pItem
[3].iCharPos
, cInChars
);
2023 /* This is a valid test that will cause parsing to take place and create 5 script_items */
2024 cInChars
= (sizeof(TestItem4
)/2)-1;
2026 hr
= ScriptItemize(TestItem4
, cInChars
, cMaxItems
, NULL
, NULL
, pItem
, &pcItems
);
2027 ok (hr
== S_OK
, "ScriptItemize should return S_OK, returned %08x\n", hr
);
2030 ok (pcItems
== 5, "The number of SCRIPT_ITEMS should be 5 not %d\n", pcItems
);
2033 ok (pItem
[0].iCharPos
== 0 && pItem
[1].iCharPos
== 6,
2034 "Start pos [0] not = 0 (%d) or end pos [1] not = %d\n",
2035 pItem
[0].iCharPos
, pItem
[1].iCharPos
);
2036 ok (pItem
[0].a
.s
.uBidiLevel
== 0, "Should have been bidi=0 not %d\n",
2037 pItem
[0].a
.s
.uBidiLevel
);
2038 ok (pItem
[1].iCharPos
== 6 && pItem
[2].iCharPos
== 11,
2039 "Start pos [1] not = 6 (%d) or end pos [2] not = 11 (%d)\n",
2040 pItem
[1].iCharPos
, pItem
[2].iCharPos
);
2041 ok (pItem
[1].a
.s
.uBidiLevel
== 1, "Should have been bidi=1 not %d\n",
2042 pItem
[1].a
.s
.uBidiLevel
);
2043 ok (pItem
[2].iCharPos
== 11 && pItem
[3].iCharPos
== 12,
2044 "Start pos [2] not = 11 (%d) or end [3] pos not = 12 (%d)\n",
2045 pItem
[2].iCharPos
, pItem
[3].iCharPos
);
2046 ok (pItem
[2].a
.s
.uBidiLevel
== 0, "Should have been bidi=0 not %d\n",
2047 pItem
[2].a
.s
.uBidiLevel
);
2048 ok (pItem
[3].iCharPos
== 12 && pItem
[4].iCharPos
== 13,
2049 "Start pos [3] not = 12 (%d) or end [4] pos not = 13 (%d)\n",
2050 pItem
[3].iCharPos
, pItem
[4].iCharPos
);
2051 ok (pItem
[3].a
.s
.uBidiLevel
== 0, "Should have been bidi=0 not %d\n",
2052 pItem
[3].a
.s
.uBidiLevel
);
2053 ok (pItem
[4].iCharPos
== 13 && pItem
[5].iCharPos
== cInChars
,
2054 "Start pos [4] not = 13 (%d) or end [5] pos not = 16 (%d), cInChars = %d\n",
2055 pItem
[4].iCharPos
, pItem
[5].iCharPos
, cInChars
);
2060 * This test is for when the first unicode character requires bidi support
2062 cInChars
= (sizeof(TestItem5
)-1)/sizeof(WCHAR
);
2063 hr
= ScriptItemize(TestItem5
, cInChars
, cMaxItems
, NULL
, NULL
, pItem
, &pcItems
);
2064 ok (hr
== S_OK
, "ScriptItemize should return S_OK, returned %08x\n", hr
);
2065 ok (pcItems
== 4, "There should have been 4 items, found %d\n", pcItems
);
2066 ok (pItem
[0].a
.s
.uBidiLevel
== 1, "The first character should have been bidi=1 not %d\n",
2067 pItem
[0].a
.s
.uBidiLevel
);
2069 /* This test checks to make sure that the test to see if there are sufficient buffers to store *
2070 * the pointer to the last char works. Note that windows often needs a greater number of *
2071 * SCRIPT_ITEMS to process a string than is returned in pcItems. */
2072 cInChars
= (sizeof(TestItem6
)/2)-1;
2074 hr
= ScriptItemize(TestItem6
, cInChars
, cMaxItems
, NULL
, NULL
, pItem
, &pcItems
);
2075 ok (hr
== E_OUTOFMEMORY
, "ScriptItemize should return E_OUTOFMEMORY, returned %08x\n", hr
);
2079 static void test_ScriptGetCMap(HDC hdc
, unsigned short pwOutGlyphs
[256])
2082 SCRIPT_CACHE psc
= NULL
;
2085 unsigned short pwOutGlyphs2
[256];
2086 unsigned short pwOutGlyphs3
[256];
2090 static const WCHAR TestItem1
[] = {'T', 'e', 's', 't', 'a', 0};
2091 static const WCHAR TestItem2
[] = {0x202B, 'i', 'n', 0x202C,0};
2092 static const WCHAR TestItem3
[] = {'a','b','c','d','(','<','{','[',0x2039,0};
2093 static const WCHAR TestItem3b
[] = {'a','b','c','d',')','>','}',']',0x203A,0};
2095 /* Check to make sure that SCRIPT_CACHE gets allocated ok */
2097 cInChars
= cChars
= 5;
2098 /* Some sanity checks for ScriptGetCMap */
2100 hr
= ScriptGetCMap(NULL
, NULL
, NULL
, 0, 0, NULL
);
2101 ok( hr
== E_INVALIDARG
, "(NULL,NULL,NULL,0,0,NULL), "
2102 "expected E_INVALIDARG, got %08x\n", hr
);
2104 hr
= ScriptGetCMap(NULL
, NULL
, TestItem1
, cInChars
, dwFlags
, pwOutGlyphs3
);
2105 ok( hr
== E_INVALIDARG
, "(NULL,NULL,TestItem1, cInChars, dwFlags, pwOutGlyphs3), "
2106 "expected E_INVALIDARG, got %08x\n", hr
);
2108 /* Set psc to NULL, to be able to check if a pointer is returned in psc */
2110 hr
= ScriptGetCMap(NULL
, &psc
, TestItem1
, cInChars
, 0, pwOutGlyphs3
);
2111 ok( hr
== E_PENDING
, "(NULL,&psc,NULL,0,0,NULL), expected E_PENDING, "
2113 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2115 /* Set psc to NULL but add hdc, to be able to check if a pointer is returned in psc */
2117 hr
= ScriptGetCMap(hdc
, &psc
, TestItem1
, cInChars
, 0, pwOutGlyphs3
);
2118 ok( hr
== S_OK
, "ScriptGetCMap(NULL,&psc,NULL,0,0,NULL), expected S_OK, "
2120 ok( psc
!= NULL
, "ScritpGetCMap expected psc to be not NULL\n");
2121 ScriptFreeCache( &psc
);
2123 /* Set psc to NULL, to be able to check if a pointer is returned in psc */
2125 hr
= ScriptGetCMap(NULL
, &psc
, TestItem1
, cInChars
, dwFlags
, pwOutGlyphs3
);
2126 ok( hr
== E_PENDING
, "(NULL,&psc,), expected E_PENDING, got %08x\n", hr
);
2127 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2128 /* Check to see if the results are the same as those returned by ScriptShape */
2129 hr
= ScriptGetCMap(hdc
, &psc
, TestItem1
, cInChars
, dwFlags
, pwOutGlyphs3
);
2130 ok (hr
== S_OK
, "ScriptGetCMap should return S_OK not (%08x)\n", hr
);
2131 ok (psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2132 for (cnt
=0; cnt
< cChars
&& pwOutGlyphs
[cnt
] == pwOutGlyphs3
[cnt
]; cnt
++) {}
2133 ok (cnt
== cInChars
, "Translation not correct. WCHAR %d - %04x != %04x\n",
2134 cnt
, pwOutGlyphs
[cnt
], pwOutGlyphs3
[cnt
]);
2136 ScriptFreeCache( &psc
);
2137 ok (!psc
, "psc is not null after ScriptFreeCache\n");
2139 /* ScriptGetCMap returns whatever font defines, no special treatment for control chars */
2140 cInChars
= cChars
= 4;
2141 GetGlyphIndicesW(hdc
, TestItem2
, cInChars
, pwOutGlyphs2
, 0);
2143 hr
= ScriptGetCMap(hdc
, &psc
, TestItem2
, cInChars
, dwFlags
, pwOutGlyphs3
);
2144 if (pwOutGlyphs3
[0] == 0 || pwOutGlyphs3
[3] == 0)
2145 ok(hr
== S_FALSE
, "ScriptGetCMap should return S_FALSE not (%08x)\n", hr
);
2147 ok(hr
== S_OK
, "ScriptGetCMap should return S_OK not (%08x)\n", hr
);
2149 ok(psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2150 ok(pwOutGlyphs3
[0] == pwOutGlyphs2
[0], "expected glyph %d, got %d\n", pwOutGlyphs2
[0], pwOutGlyphs3
[0]);
2151 ok(pwOutGlyphs3
[3] == pwOutGlyphs2
[3], "expected glyph %d, got %d\n", pwOutGlyphs2
[3], pwOutGlyphs3
[3]);
2153 cInChars
= cChars
= 9;
2154 hr
= ScriptGetCMap(hdc
, &psc
, TestItem3b
, cInChars
, dwFlags
, pwOutGlyphs2
);
2155 ok (hr
== S_OK
, "ScriptGetCMap should return S_OK not (%08x)\n", hr
);
2156 ok (psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2158 cInChars
= cChars
= 9;
2160 hr
= ScriptGetCMap(hdc
, &psc
, TestItem3
, cInChars
, dwFlags
, pwOutGlyphs3
);
2161 ok (hr
== S_OK
, "ScriptGetCMap should return S_OK not (%08x)\n", hr
);
2162 ok (psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2163 ok(pwOutGlyphs3
[0] == pwOutGlyphs2
[0], "glyph incorrectly altered\n");
2164 ok(pwOutGlyphs3
[1] == pwOutGlyphs2
[1], "glyph incorrectly altered\n");
2165 ok(pwOutGlyphs3
[2] == pwOutGlyphs2
[2], "glyph incorrectly altered\n");
2166 ok(pwOutGlyphs3
[3] == pwOutGlyphs2
[3], "glyph incorrectly altered\n");
2167 ok(pwOutGlyphs3
[4] == pwOutGlyphs2
[4], "glyph not mirrored correctly\n");
2168 ok(pwOutGlyphs3
[5] == pwOutGlyphs2
[5], "glyph not mirrored correctly\n");
2169 ok(pwOutGlyphs3
[6] == pwOutGlyphs2
[6], "glyph not mirrored correctly\n");
2170 ok(pwOutGlyphs3
[7] == pwOutGlyphs2
[7], "glyph not mirrored correctly\n");
2171 ok(pwOutGlyphs3
[8] == pwOutGlyphs2
[8], "glyph not mirrored correctly\n");
2173 ScriptFreeCache( &psc
);
2174 ok (!psc
, "psc is not null after ScriptFreeCache\n");
2177 #define MAX_ENUM_FONTS 4096
2179 struct enum_font_data
2182 ENUMLOGFONTA elf
[MAX_ENUM_FONTS
];
2185 static INT CALLBACK
enum_bitmap_font_proc(const LOGFONTA
*lf
, const TEXTMETRICA
*ntm
, DWORD type
, LPARAM lParam
)
2187 struct enum_font_data
*efnd
= (struct enum_font_data
*)lParam
;
2189 if (type
& (TRUETYPE_FONTTYPE
| DEVICE_FONTTYPE
)) return 1;
2191 if (efnd
->total
< MAX_ENUM_FONTS
)
2193 efnd
->elf
[efnd
->total
++] = *(ENUMLOGFONTA
*)lf
;
2196 trace("enum tests invalid; you have more than %d fonts\n", MAX_ENUM_FONTS
);
2201 static INT CALLBACK
enum_truetype_proc(const LOGFONTA
*lf
, const TEXTMETRICA
*ntm
, DWORD type
, LPARAM lParam
)
2203 struct enum_font_data
*efnd
= (struct enum_font_data
*)lParam
;
2205 if (!(type
& (TRUETYPE_FONTTYPE
| DEVICE_FONTTYPE
))) return 1;
2207 if (efnd
->total
< MAX_ENUM_FONTS
)
2209 efnd
->elf
[efnd
->total
++] = *(ENUMLOGFONTA
*)lf
;
2212 trace("enum tests invalid; you have more than %d fonts\n", MAX_ENUM_FONTS
);
2217 static void test_ScriptGetFontProperties(HDC hdc
)
2220 SCRIPT_CACHE psc
,old_psc
;
2221 SCRIPT_FONTPROPERTIES sfp
;
2222 HFONT font
, oldfont
;
2224 struct enum_font_data efnd
;
2229 WORD system_lang_id
= PRIMARYLANGID(GetSystemDefaultLangID());
2230 static const WCHAR invalids
[] = {0x0020, 0x200B, 0xF71B};
2231 /* U+0020: numeric space
2232 U+200B: zero width space
2233 U+F71B: unknown, found by black box testing */
2234 BOOL is_arial
, is_times_new_roman
, is_arabic
= (system_lang_id
== LANG_ARABIC
);
2236 /* Some sanity checks for ScriptGetFontProperties */
2238 hr
= ScriptGetFontProperties(NULL
,NULL
,NULL
);
2239 ok( hr
== E_INVALIDARG
, "(NULL,NULL,NULL), expected E_INVALIDARG, got %08x\n", hr
);
2241 hr
= ScriptGetFontProperties(NULL
,NULL
,&sfp
);
2242 ok( hr
== E_INVALIDARG
, "(NULL,NULL,&sfp), expected E_INVALIDARG, got %08x\n", hr
);
2244 /* Set psc to NULL, to be able to check if a pointer is returned in psc */
2246 hr
= ScriptGetFontProperties(NULL
,&psc
,NULL
);
2247 ok( hr
== E_INVALIDARG
, "(NULL,&psc,NULL), expected E_INVALIDARG, got %08x\n", hr
);
2248 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2250 /* Set psc to NULL, to be able to check if a pointer is returned in psc */
2252 hr
= ScriptGetFontProperties(NULL
,&psc
,&sfp
);
2253 ok( hr
== E_PENDING
, "(NULL,&psc,&sfp), expected E_PENDING, got %08x\n", hr
);
2254 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2256 hr
= ScriptGetFontProperties(hdc
,NULL
,NULL
);
2257 ok( hr
== E_INVALIDARG
, "(hdc,NULL,NULL), expected E_INVALIDARG, got %08x\n", hr
);
2259 hr
= ScriptGetFontProperties(hdc
,NULL
,&sfp
);
2260 ok( hr
== E_INVALIDARG
, "(hdc,NULL,&sfp), expected E_INVALIDARG, got %08x\n", hr
);
2262 /* Set psc to NULL, to be able to check if a pointer is returned in psc */
2264 hr
= ScriptGetFontProperties(hdc
,&psc
,NULL
);
2265 ok( hr
== E_INVALIDARG
, "(hdc,&psc,NULL), expected E_INVALIDARG, got %08x\n", hr
);
2266 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2268 /* Pass an invalid sfp */
2270 sfp
.cBytes
= sizeof(SCRIPT_FONTPROPERTIES
) - 1;
2271 hr
= ScriptGetFontProperties(hdc
,&psc
,&sfp
);
2272 ok( hr
== E_INVALIDARG
, "(hdc,&psc,&sfp) invalid, expected E_INVALIDARG, got %08x\n", hr
);
2273 ok( psc
!= NULL
, "Expected a pointer in psc, got NULL\n");
2274 ScriptFreeCache(&psc
);
2275 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2277 /* Give it the correct cBytes, we don't care about what's coming back */
2278 sfp
.cBytes
= sizeof(SCRIPT_FONTPROPERTIES
);
2280 hr
= ScriptGetFontProperties(hdc
,&psc
,&sfp
);
2281 ok( hr
== S_OK
, "(hdc,&psc,&sfp) partly initialized, expected S_OK, got %08x\n", hr
);
2282 ok( psc
!= NULL
, "Expected a pointer in psc, got NULL\n");
2284 /* Save the psc pointer */
2286 /* Now a NULL hdc again */
2287 hr
= ScriptGetFontProperties(NULL
,&psc
,&sfp
);
2288 ok( hr
== S_OK
, "(NULL,&psc,&sfp), expected S_OK, got %08x\n", hr
);
2289 ok( psc
== old_psc
, "Expected psc not to be changed, was %p is now %p\n", old_psc
, psc
);
2290 ScriptFreeCache(&psc
);
2291 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2293 pGetGlyphIndicesW
= (void*)GetProcAddress(GetModuleHandleA("gdi32.dll"), "GetGlyphIndicesW");
2294 if (!pGetGlyphIndicesW
)
2296 win_skip("Skip on WINNT4\n");
2299 memset(&lf
, 0, sizeof(lf
));
2300 lf
.lfCharSet
= DEFAULT_CHARSET
;
2302 EnumFontFamiliesA(hdc
, NULL
, enum_bitmap_font_proc
, (LPARAM
)&efnd
);
2304 for (i
= 0; i
< efnd
.total
; i
++)
2306 if (strlen((char *)efnd
.elf
[i
].elfFullName
) >= LF_FACESIZE
)
2308 trace("Font name to long to test: %s\n",(char *)efnd
.elf
[i
].elfFullName
);
2311 lstrcpyA(lf
.lfFaceName
, (char *)efnd
.elf
[i
].elfFullName
);
2312 font
= CreateFontIndirectA(&lf
);
2313 oldfont
= SelectObject(hdc
, font
);
2315 sfp
.cBytes
= sizeof(SCRIPT_FONTPROPERTIES
);
2317 hr
= ScriptGetFontProperties(hdc
, &psc
, &sfp
);
2318 ok(hr
== S_OK
, "ScriptGetFontProperties expected S_OK, got %08x\n", hr
);
2319 if (winetest_interactive
)
2321 trace("bitmap font %s\n", lf
.lfFaceName
);
2322 trace("wgBlank %04x\n", sfp
.wgBlank
);
2323 trace("wgDefault %04x\n", sfp
.wgDefault
);
2324 trace("wgInvalid %04x\n", sfp
.wgInvalid
);
2325 trace("wgKashida %04x\n", sfp
.wgKashida
);
2326 trace("iKashidaWidth %d\n", sfp
.iKashidaWidth
);
2329 ret
= GetTextMetricsA(hdc
, &tmA
);
2330 ok(ret
!= 0, "GetTextMetricsA failed!\n");
2332 ret
= pGetGlyphIndicesW(hdc
, invalids
, 1, gi
, GGI_MARK_NONEXISTING_GLYPHS
);
2333 ok(ret
!= GDI_ERROR
, "GetGlyphIndicesW failed!\n");
2335 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]);
2337 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
);
2339 ok(sfp
.wgInvalid
== sfp
.wgBlank
|| broken(is_arabic
), "bitmap font %s wgInvalid %02x wgBlank %02x\n", lf
.lfFaceName
, sfp
.wgInvalid
, sfp
.wgBlank
);
2341 ok(sfp
.wgKashida
== 0xFFFF || broken(is_arabic
), "bitmap font %s wgKashida %02x\n", lf
.lfFaceName
, sfp
.wgKashida
);
2343 ScriptFreeCache(&psc
);
2345 SelectObject(hdc
, oldfont
);
2350 EnumFontFamiliesA(hdc
, NULL
, enum_truetype_proc
, (LPARAM
)&efnd
);
2352 for (i
= 0; i
< efnd
.total
; i
++)
2354 if (strlen((char *)efnd
.elf
[i
].elfFullName
) >= LF_FACESIZE
)
2356 trace("Font name to long to test: %s\n",(char *)efnd
.elf
[i
].elfFullName
);
2359 lstrcpyA(lf
.lfFaceName
, (char *)efnd
.elf
[i
].elfFullName
);
2360 font
= CreateFontIndirectA(&lf
);
2361 oldfont
= SelectObject(hdc
, font
);
2363 sfp
.cBytes
= sizeof(SCRIPT_FONTPROPERTIES
);
2365 hr
= ScriptGetFontProperties(hdc
, &psc
, &sfp
);
2366 ok(hr
== S_OK
, "ScriptGetFontProperties expected S_OK, got %08x\n", hr
);
2367 if (winetest_interactive
)
2369 trace("truetype font %s\n", lf
.lfFaceName
);
2370 trace("wgBlank %04x\n", sfp
.wgBlank
);
2371 trace("wgDefault %04x\n", sfp
.wgDefault
);
2372 trace("wgInvalid %04x\n", sfp
.wgInvalid
);
2373 trace("wgKashida %04x\n", sfp
.wgKashida
);
2374 trace("iKashidaWidth %d\n", sfp
.iKashidaWidth
);
2377 str
[0] = 0x0020; /* U+0020: numeric space */
2378 ret
= pGetGlyphIndicesW(hdc
, str
, 1, gi
, 0);
2379 ok(ret
!= GDI_ERROR
, "GetGlyphIndicesW failed!\n");
2380 ok(sfp
.wgBlank
== gi
[0], "truetype font %s wgBlank %04x gi[0] %04x\n", lf
.lfFaceName
, sfp
.wgBlank
, gi
[0]);
2382 ok(sfp
.wgDefault
== 0 || broken(is_arabic
), "truetype font %s wgDefault %04x\n", lf
.lfFaceName
, sfp
.wgDefault
);
2384 ret
= pGetGlyphIndicesW(hdc
, invalids
, 3, gi
, GGI_MARK_NONEXISTING_GLYPHS
);
2385 ok(ret
!= GDI_ERROR
, "GetGlyphIndicesW failed!\n");
2386 if (gi
[2] != 0xFFFF) /* index of default non exist char */
2387 ok(sfp
.wgInvalid
== gi
[2], "truetype font %s wgInvalid %04x gi[2] %04x\n", lf
.lfFaceName
, sfp
.wgInvalid
, gi
[2]);
2388 else if (gi
[1] != 0xFFFF)
2389 ok(sfp
.wgInvalid
== gi
[1], "truetype font %s wgInvalid %04x gi[1] %04x\n", lf
.lfFaceName
, sfp
.wgInvalid
, gi
[1]);
2390 else if (gi
[0] != 0xFFFF)
2391 ok(sfp
.wgInvalid
== gi
[0], "truetype font %s wgInvalid %04x gi[0] %04x\n", lf
.lfFaceName
, sfp
.wgInvalid
, gi
[0]);
2393 ok(sfp
.wgInvalid
== 0, "truetype font %s wgInvalid %04x expect 0\n", lf
.lfFaceName
, sfp
.wgInvalid
);
2395 str
[0] = 0x0640; /* U+0640: kashida */
2396 ret
= pGetGlyphIndicesW(hdc
, str
, 1, gi
, GGI_MARK_NONEXISTING_GLYPHS
);
2397 ok(ret
!= GDI_ERROR
, "GetGlyphIndicesW failed!\n");
2398 is_arial
= !lstrcmpA(lf
.lfFaceName
, "Arial");
2399 is_times_new_roman
= !lstrcmpA(lf
.lfFaceName
, "Times New Roman");
2400 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]);
2402 ScriptFreeCache(&psc
);
2404 SelectObject(hdc
, oldfont
);
2409 static void test_ScriptTextOut(HDC hdc
)
2415 SCRIPT_ITEM pItem
[255];
2417 WCHAR TestItem1
[] = {'T', 'e', 's', 't', 'a', 0};
2422 unsigned short pwOutGlyphs1
[256];
2423 WORD pwLogClust
[256];
2424 SCRIPT_VISATTR psva
[256];
2427 GOFFSET pGoffset
[256];
2432 BOOL fTrailing
= FALSE
;
2433 SCRIPT_LOGATTR
*psla
;
2434 SCRIPT_LOGATTR sla
[256];
2436 /* This is a valid test that will cause parsing to take place */
2439 hr
= ScriptItemize(TestItem1
, cInChars
, cMaxItems
, NULL
, NULL
, pItem
, &pcItems
);
2440 ok (hr
== S_OK
, "ScriptItemize should return S_OK, returned %08x\n", hr
);
2441 /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is *
2443 ok (pcItems
> 0, "The number of SCRIPT_ITEMS should be greater than 0\n");
2445 ok (pItem
[0].iCharPos
== 0 && pItem
[1].iCharPos
== cInChars
,
2446 "Start pos not = 0 (%d) or end pos not = %d (%d)\n",
2447 pItem
[0].iCharPos
, cInChars
, pItem
[1].iCharPos
);
2449 /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue
2450 * ie. ScriptItemize has succeeded and that pItem has been set */
2453 psc
= NULL
; /* must be null on first call */
2456 hr
= ScriptShape(hdc
, &psc
, TestItem1
, cChars
,
2457 cMaxGlyphs
, &pItem
[0].a
,
2458 pwOutGlyphs1
, pwLogClust
, psva
, &pcGlyphs
);
2459 ok (hr
== S_OK
, "ScriptShape should return S_OK not (%08x)\n", hr
);
2460 ok (psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2461 ok (pcGlyphs
== cChars
, "Chars in (%d) should equal Glyphs out (%d)\n", cChars
, pcGlyphs
);
2463 /* Note hdc is needed as glyph info is not yet in psc */
2464 hr
= ScriptPlace(hdc
, &psc
, pwOutGlyphs1
, pcGlyphs
, psva
, &pItem
[0].a
, piAdvance
,
2466 ok (hr
== S_OK
, "Should return S_OK not (%08x)\n", hr
);
2467 ScriptFreeCache(&psc
); /* Get rid of psc for next test set */
2468 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2470 hr
= ScriptTextOut(NULL
, NULL
, 0, 0, 0, NULL
, NULL
, NULL
, 0, NULL
, 0, NULL
, NULL
, NULL
);
2471 ok (hr
== E_INVALIDARG
, "Should return 0 not (%08x)\n", hr
);
2473 hr
= ScriptTextOut(NULL
, NULL
, 0, 0, 0, NULL
, &pItem
[0].a
, NULL
, 0, pwOutGlyphs1
, pcGlyphs
,
2474 piAdvance
, NULL
, pGoffset
);
2475 ok( hr
== E_INVALIDARG
, "(NULL,NULL,TestItem1, cInChars, dwFlags, pwOutGlyphs3), "
2476 "expected E_INVALIDARG, got %08x\n", hr
);
2478 /* Set psc to NULL, to be able to check if a pointer is returned in psc */
2480 hr
= ScriptTextOut(NULL
, &psc
, 0, 0, 0, NULL
, NULL
, NULL
, 0, NULL
, 0,
2482 ok( hr
== E_INVALIDARG
, "(NULL,&psc,NULL,0,0,0,NULL,), expected E_INVALIDARG, "
2484 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2486 /* hdc is required for this one rather than the usual optional */
2488 hr
= ScriptTextOut(NULL
, &psc
, 0, 0, 0, NULL
, &pItem
[0].a
, NULL
, 0, pwOutGlyphs1
, pcGlyphs
,
2489 piAdvance
, NULL
, pGoffset
);
2490 ok( hr
== E_INVALIDARG
, "(NULL,&psc,), expected E_INVALIDARG, got %08x\n", hr
);
2491 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2493 /* Set that it returns 0 status */
2494 hr
= ScriptTextOut(hdc
, &psc
, 0, 0, 0, NULL
, &pItem
[0].a
, NULL
, 0, pwOutGlyphs1
, pcGlyphs
,
2495 piAdvance
, NULL
, pGoffset
);
2496 ok (hr
== S_OK
, "ScriptTextOut should return S_OK not (%08x)\n", hr
);
2498 /* Test Rect Rgn is acceptable */
2499 SetRect(&rect
, 10, 10, 40, 20);
2500 hr
= ScriptTextOut(hdc
, &psc
, 0, 0, 0, &rect
, &pItem
[0].a
, NULL
, 0, pwOutGlyphs1
, pcGlyphs
,
2501 piAdvance
, NULL
, pGoffset
);
2502 ok (hr
== S_OK
, "ScriptTextOut should return S_OK not (%08x)\n", hr
);
2505 hr
= ScriptCPtoX(iCP
, fTrailing
, cChars
, pcGlyphs
, (const WORD
*) &pwLogClust
,
2506 (const SCRIPT_VISATTR
*) &psva
, (const int *)&piAdvance
, &pItem
[0].a
, &piX
);
2507 ok(hr
== S_OK
, "ScriptCPtoX Stub should return S_OK not %08x\n", hr
);
2509 psla
= (SCRIPT_LOGATTR
*)&sla
;
2510 hr
= ScriptBreak(TestItem1
, cChars
, &pItem
[0].a
, psla
);
2511 ok(hr
== S_OK
, "ScriptBreak Stub should return S_OK not %08x\n", hr
);
2513 /* Clean up and go */
2514 ScriptFreeCache(&psc
);
2515 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2520 static void test_ScriptTextOut2(HDC hdc
)
2522 /* Intent is to validate that the HDC passed into ScriptTextOut is
2523 * used instead of the (possibly) invalid cached one
2530 SCRIPT_ITEM pItem
[255];
2532 WCHAR TestItem1
[] = {'T', 'e', 's', 't', 'a', 0};
2537 unsigned short pwOutGlyphs1
[256];
2538 WORD pwLogClust
[256];
2539 SCRIPT_VISATTR psva
[256];
2542 GOFFSET pGoffset
[256];
2545 /* Create an extra DC that will be used until the ScriptTextOut */
2546 hdc1
= CreateCompatibleDC(hdc
);
2547 ok (hdc1
!= 0, "CreateCompatibleDC failed to create a DC\n");
2548 hdc2
= CreateCompatibleDC(hdc
);
2549 ok (hdc2
!= 0, "CreateCompatibleDC failed to create a DC\n");
2551 /* This is a valid test that will cause parsing to take place */
2554 hr
= ScriptItemize(TestItem1
, cInChars
, cMaxItems
, NULL
, NULL
, pItem
, &pcItems
);
2555 ok (hr
== S_OK
, "ScriptItemize should return S_OK, returned %08x\n", hr
);
2556 /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is *
2558 ok (pcItems
> 0, "The number of SCRIPT_ITEMS should be greater than 0\n");
2560 ok (pItem
[0].iCharPos
== 0 && pItem
[1].iCharPos
== cInChars
,
2561 "Start pos not = 0 (%d) or end pos not = %d (%d)\n",
2562 pItem
[0].iCharPos
, cInChars
, pItem
[1].iCharPos
);
2564 /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue
2565 * ie. ScriptItemize has succeeded and that pItem has been set */
2568 psc
= NULL
; /* must be null on first call */
2571 hr
= ScriptShape(hdc2
, &psc
, TestItem1
, cChars
,
2572 cMaxGlyphs
, &pItem
[0].a
,
2573 pwOutGlyphs1
, pwLogClust
, psva
, &pcGlyphs
);
2574 ok (hr
== S_OK
, "ScriptShape should return S_OK not (%08x)\n", hr
);
2575 ok (psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2576 ok (pcGlyphs
== cChars
, "Chars in (%d) should equal Glyphs out (%d)\n", cChars
, pcGlyphs
);
2580 /* Note hdc is needed as glyph info is not yet in psc */
2581 hr
= ScriptPlace(hdc2
, &psc
, pwOutGlyphs1
, pcGlyphs
, psva
, &pItem
[0].a
, piAdvance
,
2583 ok (hr
== S_OK
, "Should return S_OK not (%08x)\n", hr
);
2585 /* key part!!! cached dc is being deleted */
2586 ret
= DeleteDC(hdc2
);
2587 ok(ret
, "DeleteDC should return 1 not %d\n", ret
);
2589 /* At this point the cached hdc (hdc2) has been destroyed,
2590 * however, we are passing in a *real* hdc (the original hdc).
2591 * The text should be written to that DC
2593 hr
= ScriptTextOut(hdc1
, &psc
, 0, 0, 0, NULL
, &pItem
[0].a
, NULL
, 0, pwOutGlyphs1
, pcGlyphs
,
2594 piAdvance
, NULL
, pGoffset
);
2595 ok (hr
== S_OK
, "ScriptTextOut should return S_OK not (%08x)\n", hr
);
2596 ok (psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2600 /* Clean up and go */
2601 ScriptFreeCache(&psc
);
2602 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2607 static void test_ScriptTextOut3(HDC hdc
)
2613 SCRIPT_ITEM pItem
[255];
2615 WCHAR TestItem1
[] = {' ','\r', 0};
2620 unsigned short pwOutGlyphs1
[256];
2621 WORD pwLogClust
[256];
2622 SCRIPT_VISATTR psva
[256];
2625 GOFFSET pGoffset
[256];
2629 /* This is to ensure that nonexistent glyphs are translated into a valid glyph number */
2632 hr
= ScriptItemize(TestItem1
, cInChars
, cMaxItems
, NULL
, NULL
, pItem
, &pcItems
);
2633 ok (hr
== S_OK
, "ScriptItemize should return S_OK, returned %08x\n", hr
);
2634 /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is *
2636 ok (pcItems
> 0, "The number of SCRIPT_ITEMS should be greater than 0\n");
2638 ok (pItem
[0].iCharPos
== 0 && pItem
[2].iCharPos
== cInChars
,
2639 "Start pos not = 0 (%d) or end pos not = %d (%d)\n",
2640 pItem
[0].iCharPos
, cInChars
, pItem
[2].iCharPos
);
2642 /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue
2643 * ie. ScriptItemize has succeeded and that pItem has been set */
2646 psc
= NULL
; /* must be null on first call */
2649 hr
= ScriptShape(hdc
, &psc
, TestItem1
, cChars
,
2650 cMaxGlyphs
, &pItem
[0].a
,
2651 pwOutGlyphs1
, pwLogClust
, psva
, &pcGlyphs
);
2652 ok (hr
== S_OK
, "ScriptShape should return S_OK not (%08x)\n", hr
);
2653 ok (psc
!= NULL
, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2654 ok (pcGlyphs
== cChars
, "Chars in (%d) should equal Glyphs out (%d)\n", cChars
, pcGlyphs
);
2656 /* Note hdc is needed as glyph info is not yet in psc */
2657 hr
= ScriptPlace(hdc
, &psc
, pwOutGlyphs1
, pcGlyphs
, psva
, &pItem
[0].a
, piAdvance
,
2659 ok (hr
== S_OK
, "Should return S_OK not (%08x)\n", hr
);
2661 /* Test Rect Rgn is acceptable */
2662 SetRect(&rect
, 10, 10, 40, 20);
2663 hr
= ScriptTextOut(hdc
, &psc
, 0, 0, 0, &rect
, &pItem
[0].a
, NULL
, 0, pwOutGlyphs1
, pcGlyphs
,
2664 piAdvance
, NULL
, pGoffset
);
2665 ok (hr
== S_OK
, "ScriptTextOut should return S_OK not (%08x)\n", hr
);
2667 /* Clean up and go */
2668 ScriptFreeCache(&psc
);
2669 ok( psc
== NULL
, "Expected psc to be NULL, got %p\n", psc
);
2673 #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)
2675 static void _test_item_ScriptXtoX(SCRIPT_ANALYSIS
*psa
, int cChars
, int cGlyphs
, const int* offsets
, const WORD
*pwLogClust
, const int* piAdvance
)
2678 int icChars
, icGlyphs
;
2681 SCRIPT_VISATTR psva
[10];
2686 memset(psva
,0,sizeof(psva
));
2687 direction
= (psa
->fRTL
)?-1:+1;
2689 for(iCP
= 0; iCP
< cChars
; iCP
++)
2694 hr
= ScriptXtoCP(iX
, icChars
, icGlyphs
, pwLogClust
, psva
, piAdvance
, psa
, &piCP
, &piTrailing
);
2695 winetest_ok(hr
== S_OK
, "ScriptXtoCP: should return S_OK not %08x\n", hr
);
2696 winetest_ok(piCP
== iCP
, "ScriptXtoCP: iX=%d should return piCP=%d not %d\n", iX
, iCP
, piCP
);
2697 winetest_ok(piTrailing
== 0, "ScriptXtoCP: iX=%d should return piTrailing=0 not %d\n", iX
, piTrailing
);
2700 for(iCP
= 0; iCP
< cChars
; iCP
++)
2702 iX
= offsets
[iCP
]+direction
;
2705 hr
= ScriptXtoCP(iX
, icChars
, icGlyphs
, pwLogClust
, psva
, piAdvance
, psa
, &piCP
, &piTrailing
);
2706 winetest_ok(hr
== S_OK
, "ScriptXtoCP leading: should return S_OK not %08x\n", hr
);
2707 winetest_ok(piCP
== iCP
, "ScriptXtoCP leading: iX=%d should return piCP=%d not %d\n", iX
, iCP
, piCP
);
2708 winetest_ok(piTrailing
== 0, "ScriptXtoCP leading: iX=%d should return piTrailing=0 not %d\n", iX
, piTrailing
);
2711 for(iCP
= 0; iCP
< cChars
; iCP
++)
2713 iX
= offsets
[iCP
+1]-direction
;
2716 hr
= ScriptXtoCP(iX
, icChars
, icGlyphs
, pwLogClust
, psva
, piAdvance
, psa
, &piCP
, &piTrailing
);
2717 winetest_ok(hr
== S_OK
, "ScriptXtoCP trailing: should return S_OK not %08x\n", hr
);
2718 winetest_ok(piCP
== iCP
, "ScriptXtoCP trailing: iX=%d should return piCP=%d not %d\n", iX
, iCP
, piCP
);
2719 winetest_ok(piTrailing
== 1, "ScriptXtoCP trailing: iX=%d should return piTrailing=1 not %d\n", iX
, piTrailing
);
2722 for(iCP
= 0; iCP
<= cChars
+1; iCP
++)
2727 hr
= ScriptCPtoX(iCP
, fTrailing
, icChars
, icGlyphs
, pwLogClust
, psva
, piAdvance
, psa
, &piX
);
2728 winetest_ok(hr
== S_OK
, "ScriptCPtoX: should return S_OK not %08x\n", hr
);
2729 winetest_ok(piX
== offsets
[iCP
],
2730 "ScriptCPtoX: iCP=%d should return piX=%d not %d\n", iCP
, offsets
[iCP
], piX
);
2733 for(iCP
= 0; iCP
<= cChars
+1; iCP
++)
2738 hr
= ScriptCPtoX(iCP
, fTrailing
, icChars
, icGlyphs
, pwLogClust
, psva
, piAdvance
, psa
, &piX
);
2739 winetest_ok(hr
== S_OK
, "ScriptCPtoX trailing: should return S_OK not %08x\n", hr
);
2740 winetest_ok(piX
== offsets
[iCP
+1],
2741 "ScriptCPtoX trailing: iCP=%d should return piX=%d not %d\n", iCP
, offsets
[iCP
+1], piX
);
2745 #define test_caret_item_ScriptXtoCP(a,b,c,d,e,f) _test_caret_item_ScriptXtoCP(__LINE__,a,b,c,d,e,f)
2747 static void _test_caret_item_ScriptXtoCP(int line
, SCRIPT_ANALYSIS
*psa
, int cChars
, int cGlyphs
, const int* offsets
, const WORD
*pwLogClust
, const int* piAdvance
)
2750 int icChars
, icGlyphs
;
2754 SCRIPT_VISATTR psva
[10];
2758 memset(psva
,0,sizeof(psva
));
2759 direction
= (psa
->fRTL
)?-1:+1;
2761 for(iX
= -1, i
= iCP
= 0; i
< cChars
; i
++)
2763 if (offsets
[i
] != iX
)
2770 hr
= ScriptXtoCP(iX
, icChars
, icGlyphs
, pwLogClust
, psva
, piAdvance
, psa
, &piCP
, &piTrailing
);
2771 ok_(__FILE__
,line
)(hr
== S_OK
, "ScriptXtoCP: should return S_OK not %08x\n", hr
);
2772 ok_(__FILE__
,line
)(piCP
== iCP
, "ScriptXtoCP: iX=%d should return piCP=%d not %d\n", iX
, iCP
, piCP
);
2773 ok_(__FILE__
,line
)(piTrailing
== 0, "ScriptXtoCP: iX=%d should return piTrailing=0 not %d\n", iX
, piTrailing
);
2776 for(iX
= -2, i
= 0; i
< cChars
; i
++)
2778 if (offsets
[i
]+direction
!= iX
)
2780 iX
= offsets
[i
] + direction
;
2785 hr
= ScriptXtoCP(iX
, icChars
, icGlyphs
, pwLogClust
, psva
, piAdvance
, psa
, &piCP
, &piTrailing
);
2786 ok_(__FILE__
,line
)(hr
== S_OK
, "ScriptXtoCP leading: should return S_OK not %08x\n", hr
);
2787 ok_(__FILE__
,line
)(piCP
== iCP
, "ScriptXtoCP leading: iX=%d should return piCP=%d not %d\n", iX
, iCP
, piCP
);
2788 ok_(__FILE__
,line
)(piTrailing
== 0, "ScriptXtoCP leading: iX=%d should return piTrailing=0 not %d\n", iX
, piTrailing
);
2791 for(clusterSize
= 0, iCP
= 0, iX
= -2, i
= 0; i
< cChars
; i
++)
2794 if (offsets
[i
] != offsets
[i
+1])
2796 iX
= offsets
[i
+1]-direction
;
2799 hr
= ScriptXtoCP(iX
, icChars
, icGlyphs
, pwLogClust
, psva
, piAdvance
, psa
, &piCP
, &piTrailing
);
2800 ok_(__FILE__
,line
)(hr
== S_OK
, "ScriptXtoCP trailing: should return S_OK not %08x\n", hr
);
2801 ok_(__FILE__
,line
)(piCP
== iCP
, "ScriptXtoCP trailing: iX=%d should return piCP=%d not %d\n", iX
, iCP
, piCP
);
2802 ok_(__FILE__
,line
)(piTrailing
== clusterSize
, "ScriptXtoCP trailing: iX=%d should return piTrailing=%d not %d\n", iX
, clusterSize
, piTrailing
);
2809 static void test_ScriptXtoX(void)
2810 /****************************************************************************************
2811 * This routine tests the ScriptXtoCP and ScriptCPtoX functions using static variables *
2812 ****************************************************************************************/
2814 WORD pwLogClust
[10] = {0, 0, 0, 1, 1, 2, 2, 3, 3, 3};
2815 WORD pwLogClust_RTL
[10] = {3, 3, 3, 2, 2, 1, 1, 0, 0, 0};
2816 WORD pwLogClust_2
[7] = {4, 3, 3, 2, 1, 0 ,0};
2817 WORD pwLogClust_3
[17] = {0, 1, 1, 1, 1, 4, 5, 6, 6, 8, 8, 8, 8, 11, 11, 13, 13};
2818 WORD pwLogClust_3_RTL
[17] = {13, 13, 11, 11, 8, 8, 8, 8, 6, 6, 5, 4, 1, 1, 1, 1, 0};
2819 int piAdvance
[10] = {201, 190, 210, 180, 170, 204, 189, 195, 212, 203};
2820 int piAdvance_2
[5] = {39, 26, 19, 17, 11};
2821 int piAdvance_3
[15] = {6, 6, 0, 0, 10, 5, 10, 0, 12, 0, 0, 9, 0, 10, 0};
2822 static const int offsets
[13] = {0, 67, 134, 201, 296, 391, 496, 601, 1052, 1503, 1954, 1954, 1954};
2823 static const int offsets_RTL
[13] = {781, 721, 661, 601, 496, 391, 296, 201, 134, 67, 0, 0, 0};
2824 static const int offsets_2
[10] = {112, 101, 92, 84, 65, 39, 19, 0, 0, 0};
2826 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};
2827 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};
2829 SCRIPT_VISATTR psva
[15];
2831 SCRIPT_ITEM items
[2];
2836 static const WCHAR hebrW
[] = { 0x5be, 0};
2837 static const WCHAR thaiW
[] = { 0xe2a, 0};
2838 const SCRIPT_PROPERTIES
**ppScriptProperties
;
2840 memset(&sa
, 0 , sizeof(SCRIPT_ANALYSIS
));
2841 memset(psva
, 0, sizeof(psva
));
2844 hr
= ScriptXtoCP(-1, 10, 10, pwLogClust
, psva
, piAdvance
, &sa
, &piCP
, &piTrailing
);
2845 ok(hr
== S_OK
, "ScriptXtoCP should return S_OK not %08x\n", hr
);
2847 ok(piCP
== -1, "Negative iX should return piCP=-1 not %d\n", piCP
);
2849 ok(piCP
== 10, "Negative iX should return piCP=10 not %d\n", piCP
);
2851 for (iX
= 0; iX
<= 7; iX
++)
2855 hr
= ScriptXtoCP(iX
, 1, 1, &clust
, psva
, &advance
, &sa
, &piCP
, &piTrailing
);
2856 ok(piCP
==0 && piTrailing
==0,"%i should return 0(%i) and 0(%i)\n",iX
, piCP
,piTrailing
);
2858 for (iX
= 8; iX
< 16; iX
++)
2862 hr
= ScriptXtoCP(iX
, 1, 1, &clust
, psva
, &advance
, &sa
, &piCP
, &piTrailing
);
2863 ok(piCP
==0 && piTrailing
==1,"%i should return 0(%i) and 1(%i)\n",iX
, piCP
,piTrailing
);
2867 hr
= ScriptXtoCP(-1, 10, 10, pwLogClust_RTL
, psva
, piAdvance
, &sa
, &piCP
, &piTrailing
);
2868 ok(hr
== S_OK
, "ScriptXtoCP should return S_OK not %08x\n", hr
);
2870 ok(piCP
== -1, "Negative iX should return piCP=-1 not %d\n", piCP
);
2872 ok(piCP
== 10, "Negative iX should return piCP=10 not %d\n", piCP
);
2875 hr
= ScriptXtoCP(1954, 10, 10, pwLogClust_RTL
, psva
, piAdvance
, &sa
, &piCP
, &piTrailing
);
2876 ok(hr
== S_OK
, "ScriptXtoCP should return S_OK not %08x\n", hr
);
2877 ok(piCP
== -1, "iX=%d should return piCP=-1 not %d\n", iX
, piCP
);
2878 ok(piTrailing
== 1, "iX=%d should return piTrailing=1 not %d\n", iX
, piTrailing
);
2880 for (iX
= 1; iX
<= 8; iX
++)
2884 hr
= ScriptXtoCP(iX
, 1, 1, &clust
, psva
, &advance
, &sa
, &piCP
, &piTrailing
);
2885 ok(piCP
==0 && piTrailing
==1,"%i should return 0(%i) and 1(%i)\n",iX
,piCP
,piTrailing
);
2887 for (iX
= 9; iX
< 16; iX
++)
2891 hr
= ScriptXtoCP(iX
, 1, 1, &clust
, psva
, &advance
, &sa
, &piCP
, &piTrailing
);
2892 ok(piCP
==0 && piTrailing
==0,"%i should return 0(%i) and 0(%i)\n",iX
,piCP
,piTrailing
);
2896 test_item_ScriptXtoX(&sa
, 10, 10, offsets
, pwLogClust
, piAdvance
);
2898 test_item_ScriptXtoX(&sa
, 10, 10, offsets_RTL
, pwLogClust_RTL
, piAdvance
);
2899 test_item_ScriptXtoX(&sa
, 7, 5, offsets_2
, pwLogClust_2
, piAdvance_2
);
2901 /* Get thai eScript, This will do LTR and fNeedsCaretInfo */
2902 hr
= ScriptItemize(thaiW
, 1, 2, NULL
, NULL
, items
, &i
);
2903 ok(hr
== S_OK
, "got %08x\n", hr
);
2904 ok(i
== 1, "got %d\n", i
);
2907 test_caret_item_ScriptXtoCP(&sa
, 17, 15, offsets_3
, pwLogClust_3
, piAdvance_3
);
2909 /* Get hebrew eScript, This will do RTL and fNeedsCaretInfo */
2910 hr
= ScriptItemize(hebrW
, 1, 2, NULL
, NULL
, items
, &i
);
2911 ok(hr
== S_OK
, "got %08x\n", hr
);
2912 ok(i
== 1, "got %d\n", i
);
2915 /* Note: This behavior CHANGED in uniscribe versions...
2916 * so we only want to test if fNeedsCaretInfo is set */
2917 hr
= ScriptGetProperties(&ppScriptProperties
, &i
);
2918 if (ppScriptProperties
[sa
.eScript
]->fNeedsCaretInfo
)
2920 test_caret_item_ScriptXtoCP(&sa
, 17, 15, offsets_3_RTL
, pwLogClust_3_RTL
, piAdvance_3
);
2921 hr
= ScriptXtoCP(0, 17, 15, pwLogClust_3_RTL
, psva
, piAdvance_3
, &sa
, &piCP
, &piTrailing
);
2922 ok(hr
== S_OK
, "ScriptXtoCP: should return S_OK not %08x\n", hr
);
2923 ok(piCP
== 16, "ScriptXtoCP: iX=0 should return piCP=16 not %d\n", piCP
);
2924 ok(piTrailing
== 1, "ScriptXtoCP: iX=0 should return piTrailing=1 not %d\n", piTrailing
);
2927 win_skip("Uniscribe version too old to test Hebrew clusters\n");
2930 static void test_ScriptString(HDC hdc
)
2932 /*******************************************************************************************
2934 * This set of tests are for the string functions of uniscribe. The ScriptStringAnalyse
2935 * function allocates memory pointed to by the SCRIPT_STRING_ANALYSIS ssa pointer. This
2936 * memory is freed by ScriptStringFree. There needs to be a valid hdc for this as
2937 * ScriptStringAnalyse calls ScriptSItemize, ScriptShape and ScriptPlace which require it.
2942 WCHAR teststr
[] = {'T','e','s','t','1',' ','a','2','b','3', '\0'};
2943 int len
= (sizeof(teststr
) / sizeof(WCHAR
)) - 1;
2944 int Glyphs
= len
* 2 + 16;
2946 DWORD Flags
= SSA_GLYPHS
;
2948 static const int Dx
[(sizeof(teststr
) / sizeof(WCHAR
)) - 1];
2949 static const BYTE InClass
[(sizeof(teststr
) / sizeof(WCHAR
)) - 1];
2950 SCRIPT_STRING_ANALYSIS ssa
= NULL
;
2955 const RECT rc
= {0, 50, 100, 100};
2958 BOOL Disabled
= FALSE
;
2959 const int *clip_len
;
2964 Charset
= -1; /* this flag indicates unicode input */
2965 /* Test without hdc to get E_PENDING */
2966 hr
= ScriptStringAnalyse( NULL
, teststr
, len
, Glyphs
, Charset
, Flags
,
2967 ReqWidth
, NULL
, NULL
, Dx
, NULL
,
2969 ok(hr
== E_PENDING
, "ScriptStringAnalyse Stub should return E_PENDING not %08x\n", hr
);
2971 /* Test that 0 length string returns E_INVALIDARG */
2972 hr
= ScriptStringAnalyse( hdc
, teststr
, 0, Glyphs
, Charset
, Flags
,
2973 ReqWidth
, NULL
, NULL
, Dx
, NULL
,
2975 ok(hr
== E_INVALIDARG
, "ScriptStringAnalyse should return E_INVALIDARG not %08x\n", hr
);
2977 /* test with hdc, this should be a valid test */
2978 hr
= ScriptStringAnalyse( hdc
, teststr
, len
, Glyphs
, Charset
, Flags
,
2979 ReqWidth
, NULL
, NULL
, Dx
, NULL
,
2981 ok(hr
== S_OK
, "ScriptStringAnalyse should return S_OK not %08x\n", hr
);
2982 ScriptStringFree(&ssa
);
2984 /* test makes sure that a call with a valid pssa still works */
2985 hr
= ScriptStringAnalyse( hdc
, teststr
, len
, Glyphs
, Charset
, Flags
,
2986 ReqWidth
, NULL
, NULL
, Dx
, NULL
,
2988 ok(hr
== S_OK
, "ScriptStringAnalyse should return S_OK not %08x\n", hr
);
2989 ok(ssa
!= NULL
, "ScriptStringAnalyse pssa should not be NULL\n");
2993 hr
= ScriptStringOut(ssa
, X
, Y
, Options
, &rc
, MinSel
, MaxSel
, Disabled
);
2994 ok(hr
== S_OK
, "ScriptStringOut should return S_OK not %08x\n", hr
);
2997 clip_len
= ScriptString_pcOutChars(ssa
);
2998 ok(*clip_len
== len
, "ScriptString_pcOutChars failed, got %d, expected %d\n", *clip_len
, len
);
3000 order
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, *clip_len
* sizeof(UINT
));
3001 hr
= ScriptStringGetOrder(ssa
, order
);
3002 ok(hr
== S_OK
, "ScriptStringGetOrder failed, got %08x, expected S_OK\n", hr
);
3004 for (i
= 0; i
< *clip_len
; i
++) ok(order
[i
] == i
, "%d: got %d expected %d\n", i
, order
[i
], i
);
3005 HeapFree(GetProcessHeap(), 0, order
);
3007 hr
= ScriptStringFree(&ssa
);
3008 ok(hr
== S_OK
, "ScriptStringFree should return S_OK not %08x\n", hr
);
3011 static void test_ScriptStringXtoCP_CPtoX(HDC hdc
)
3013 /*****************************************************************************************
3015 * This test is for the ScriptStringXtoCP and ScriptStringXtoCP functions. Due to the
3016 * nature of the fonts between Windows and Wine, the test is implemented by generating
3017 * values using one one function then checking the output of the second. In this way
3018 * the validity of the functions is established using Windows as a base and confirming
3019 * similar behaviour in wine.
3023 static const WCHAR teststr1
[] = {0x05e9, 'i', 0x05dc, 'n', 0x05d5, 'e', 0x05dd, '.',0};
3024 static const BOOL rtl
[] = {1, 0, 1, 0, 1, 0, 1, 0};
3025 void *String
= (WCHAR
*) &teststr1
; /* ScriptStringAnalysis needs void */
3026 int String_len
= (sizeof(teststr1
)/sizeof(WCHAR
))-1;
3027 int Glyphs
= String_len
* 2 + 16; /* size of buffer as recommended */
3028 int Charset
= -1; /* unicode */
3029 DWORD Flags
= SSA_GLYPHS
;
3031 static const BYTE InClass
[(sizeof(teststr1
)/sizeof(WCHAR
))-1];
3032 SCRIPT_STRING_ANALYSIS ssa
= NULL
;
3034 int Ch
; /* Character position in string */
3036 int Cp
; /* Character position in string */
3041 /* Test with hdc, this should be a valid test
3042 * Here we generate an SCRIPT_STRING_ANALYSIS that will be used as input to the
3043 * following character positions to X and X to character position functions.
3046 hr
= ScriptStringAnalyse( hdc
, String
, String_len
, Glyphs
, Charset
, Flags
,
3047 ReqWidth
, NULL
, NULL
, NULL
, NULL
,
3050 hr
== E_INVALIDARG
, /* NT */
3051 "ScriptStringAnalyse should return S_OK or E_INVALIDARG not %08x\n", hr
);
3055 ok(ssa
!= NULL
, "ScriptStringAnalyse ssa should not be NULL\n");
3058 * Loop to generate character positions to provide starting positions for the
3059 * ScriptStringCPtoX and ScriptStringXtoCP functions
3061 for (Cp
= 0; Cp
< String_len
; Cp
++)
3063 /* The fTrailing flag is used to indicate whether the X being returned is at
3064 * the beginning or the end of the character. What happens here is that if
3065 * fTrailing indicates the end of the character, ie. FALSE, then ScriptStringXtoCP
3066 * returns the beginning of the next character and iTrailing is FALSE. So for this
3067 * loop iTrailing will be FALSE in both cases.
3069 hr
= ScriptStringCPtoX(ssa
, Cp
, TRUE
, &trail
);
3070 ok(hr
== S_OK
, "ScriptStringCPtoX should return S_OK not %08x\n", hr
);
3071 hr
= ScriptStringCPtoX(ssa
, Cp
, FALSE
, &lead
);
3072 ok(hr
== S_OK
, "ScriptStringCPtoX should return S_OK not %08x\n", hr
);
3074 ok(lead
> trail
, "Leading values should be after trailing for rtl characters(%i)\n",Cp
);
3076 ok(lead
< trail
, "Trailing values should be after leading for ltr characters(%i)\n",Cp
);
3078 /* move by 1 pixel so that we are not between 2 characters. That could result in being the lead of a rtl and
3079 at the same time the trail of an ltr */
3081 /* inside the leading edge */
3083 if (rtl
[Cp
]) X
--; else X
++;
3084 hr
= ScriptStringXtoCP(ssa
, X
, &Ch
, &iTrailing
);
3085 ok(hr
== S_OK
, "ScriptStringXtoCP should return S_OK not %08x\n", hr
);
3086 ok(Cp
== Ch
, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp
, Ch
, trail
);
3087 ok(iTrailing
== FALSE
, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n",
3090 /* inside the trailing edge */
3092 if (rtl
[Cp
]) X
++; else X
--;
3093 hr
= ScriptStringXtoCP(ssa
, X
, &Ch
, &iTrailing
);
3094 ok(hr
== S_OK
, "ScriptStringXtoCP should return S_OK not %08x\n", hr
);
3095 ok(Cp
== Ch
, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp
, Ch
, trail
);
3096 ok(iTrailing
== TRUE
, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = %d\n",
3099 /* outside the "trailing" edge */
3100 if (Cp
< String_len
-1)
3102 if (rtl
[Cp
]) X
= lead
; else X
= trail
;
3104 hr
= ScriptStringXtoCP(ssa
, X
, &Ch
, &iTrailing
);
3105 ok(hr
== S_OK
, "ScriptStringXtoCP should return S_OK not %08x\n", hr
);
3106 ok(Cp
+ 1 == Ch
, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp
+ 1, Ch
, trail
);
3108 ok(iTrailing
== TRUE
, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = %d\n",
3111 ok(iTrailing
== FALSE
, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n",
3115 /* outside the "leading" edge */
3118 if (rtl
[Cp
]) X
= trail
; else X
= lead
;
3120 hr
= ScriptStringXtoCP(ssa
, X
, &Ch
, &iTrailing
);
3121 ok(hr
== S_OK
, "ScriptStringXtoCP should return S_OK not %08x\n", hr
);
3122 ok(Cp
- 1 == Ch
, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp
- 1, Ch
, trail
);
3123 if (Cp
!= 0 && rtl
[Cp
-1])
3124 ok(iTrailing
== FALSE
, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n",
3127 ok(iTrailing
== TRUE
, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = %d\n",
3132 /* Check beyond the leading boundary of the whole string */
3135 /* having a leading rtl character seems to confuse usp */
3136 /* this looks to be a windows bug we should emulate */
3137 hr
= ScriptStringCPtoX(ssa
, 0, TRUE
, &X
);
3138 ok(hr
== S_OK
, "ScriptStringCPtoX should return S_OK not %08x\n", hr
);
3140 hr
= ScriptStringXtoCP(ssa
, X
, &Ch
, &iTrailing
);
3141 ok(hr
== S_OK
, "ScriptStringXtoCP should return S_OK not %08x\n", hr
);
3142 ok(Ch
== 1, "ScriptStringXtoCP should return Ch = 1 not %d for X outside leading edge when rtl\n", Ch
);
3143 ok(iTrailing
== FALSE
, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = outside leading edge when rtl\n",
3148 hr
= ScriptStringCPtoX(ssa
, 0, FALSE
, &X
);
3149 ok(hr
== S_OK
, "ScriptStringCPtoX should return S_OK not %08x\n", hr
);
3151 hr
= ScriptStringXtoCP(ssa
, X
, &Ch
, &iTrailing
);
3152 ok(hr
== S_OK
, "ScriptStringXtoCP should return S_OK not %08x\n", hr
);
3153 ok(Ch
== -1, "ScriptStringXtoCP should return Ch = -1 not %d for X outside leading edge\n", Ch
);
3154 ok(iTrailing
== TRUE
, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = outside leading edge\n",
3158 /* Check beyond the end boundary of the whole string */
3159 if (rtl
[String_len
-1])
3161 hr
= ScriptStringCPtoX(ssa
, String_len
-1, FALSE
, &X
);
3162 ok(hr
== S_OK
, "ScriptStringCPtoX should return S_OK not %08x\n", hr
);
3166 hr
= ScriptStringCPtoX(ssa
, String_len
-1, TRUE
, &X
);
3167 ok(hr
== S_OK
, "ScriptStringCPtoX should return S_OK not %08x\n", hr
);
3170 hr
= ScriptStringXtoCP(ssa
, X
, &Ch
, &iTrailing
);
3171 ok(hr
== S_OK
, "ScriptStringXtoCP should return S_OK not %08x\n", hr
);
3172 ok(Ch
== String_len
, "ScriptStringXtoCP should return Ch = %i not %d for X outside trailing edge\n", String_len
, Ch
);
3173 ok(iTrailing
== FALSE
, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = outside trailing edge\n",
3177 * Cleanup the SSA for the next round of tests
3179 hr
= ScriptStringFree(&ssa
);
3180 ok(hr
== S_OK
, "ScriptStringFree should return S_OK not %08x\n", hr
);
3183 * Test to see that exceeding the number of chars returns E_INVALIDARG. First
3184 * generate an SSA for the subsequent tests.
3186 hr
= ScriptStringAnalyse( hdc
, String
, String_len
, Glyphs
, Charset
, Flags
,
3187 ReqWidth
, NULL
, NULL
, NULL
, NULL
,
3189 ok(hr
== S_OK
, "ScriptStringAnalyse should return S_OK not %08x\n", hr
);
3192 * When ScriptStringCPtoX is called with a character position Cp that exceeds the
3193 * string length, return E_INVALIDARG. This also invalidates the ssa so a
3194 * ScriptStringFree should also fail.
3197 Cp
= String_len
+ 1;
3198 hr
= ScriptStringCPtoX(ssa
, Cp
, fTrailing
, &X
);
3199 ok(hr
== E_INVALIDARG
, "ScriptStringCPtoX should return E_INVALIDARG not %08x\n", hr
);
3201 ScriptStringFree(&ssa
);
3205 static void test_ScriptCacheGetHeight(HDC hdc
)
3208 SCRIPT_CACHE sc
= NULL
;
3211 hr
= ScriptCacheGetHeight(NULL
, NULL
, NULL
);
3212 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got 0x%08x\n", hr
);
3214 hr
= ScriptCacheGetHeight(NULL
, &sc
, NULL
);
3215 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got 0x%08x\n", hr
);
3217 hr
= ScriptCacheGetHeight(NULL
, &sc
, &height
);
3218 ok(hr
== E_PENDING
, "expected E_PENDING, got 0x%08x\n", hr
);
3222 hr
= ScriptCacheGetHeight(hdc
, &sc
, &height
);
3223 ok(hr
== S_OK
, "expected S_OK, got 0x%08x\n", hr
);
3224 ok(height
> 0, "expected height > 0\n");
3226 ScriptFreeCache(&sc
);
3229 static void test_ScriptGetGlyphABCWidth(HDC hdc
)
3232 SCRIPT_CACHE sc
= NULL
;
3235 hr
= ScriptGetGlyphABCWidth(NULL
, NULL
, 'a', NULL
);
3236 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got 0x%08x\n", hr
);
3238 hr
= ScriptGetGlyphABCWidth(NULL
, &sc
, 'a', NULL
);
3239 ok(broken(hr
== E_PENDING
) ||
3240 hr
== E_INVALIDARG
, /* WIN7 */
3241 "expected E_INVALIDARG, got 0x%08x\n", hr
);
3243 hr
= ScriptGetGlyphABCWidth(NULL
, &sc
, 'a', &abc
);
3244 ok(hr
== E_PENDING
, "expected E_PENDING, got 0x%08x\n", hr
);
3246 if (0) { /* crashes on WinXP */
3247 hr
= ScriptGetGlyphABCWidth(hdc
, &sc
, 'a', NULL
);
3248 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got 0x%08x\n", hr
);
3251 hr
= ScriptGetGlyphABCWidth(hdc
, &sc
, 'a', &abc
);
3252 ok(hr
== S_OK
, "expected S_OK, got 0x%08x\n", hr
);
3254 ScriptFreeCache(&sc
);
3257 static void test_ScriptLayout(void)
3260 static const BYTE levels
[][10] =
3262 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
3263 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
3264 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 },
3265 { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
3267 { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1},
3268 { 1, 1, 1, 2, 2, 2, 1, 1, 1, 1 },
3269 { 2, 2, 2, 1, 1, 1, 2, 2, 2, 2 },
3270 { 0, 0, 1, 1, 2, 2, 1, 1, 0, 0 },
3271 { 1, 1, 2, 2, 3, 3, 2, 2, 1, 1 },
3273 { 0, 0, 1, 1, 2, 2, 1, 1, 0, 1 },
3274 { 1, 0, 1, 2, 2, 1, 2, 1, 0, 1 },
3276 { 1, 2, 0, 0, 0, 0, 0, 0, 0, 0 },
3277 { 2, 2, 2, 0, 0, 0, 0, 0, 0, 0 },
3278 { 2, 2, 2, 4, 4, 4, 1, 1, 0, 0 },
3279 { 1, 2, 3, 0, 3, 2, 1, 0, 0, 0 }
3281 static const int expect_l2v
[][10] =
3283 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
3284 { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 },
3285 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
3286 { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 },
3288 { 0, 1, 2, 3, 4, 9, 8 ,7 ,6, 5},
3289 /**/ { 9, 8, 7, 4, 5, 6, 3 ,2 ,1, 0},
3290 /**/ { 7, 8, 9, 6, 5, 4, 0 ,1 ,2, 3},
3291 { 0, 1, 7, 6, 4, 5, 3 ,2 ,8, 9},
3292 { 9, 8, 2, 3, 5, 4, 6 ,7 ,1, 0},
3294 { 0, 1, 7, 6, 4, 5, 3 ,2 ,8, 9},
3295 /**/ { 0, 1, 7, 5, 6, 4, 3 ,2 ,8, 9},
3297 { 1, 0, 2, 3, 4, 5, 6, 7, 8, 9},
3298 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
3299 { 2, 3, 4, 5, 6, 7, 1, 0, 8, 9},
3300 { 2, 0, 1, 3, 5, 6, 4, 7, 8, 9}
3302 static const int expect_v2l
[][10] =
3304 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
3305 { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 },
3306 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
3307 { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 },
3309 { 0, 1, 2, 3, 4, 9, 8 ,7 ,6, 5},
3310 { 9, 8, 7, 6, 3, 4, 5 ,2 ,1, 0},
3311 { 6, 7, 8, 9, 5, 4, 3 ,0 ,1, 2},
3312 { 0, 1, 7, 6, 4, 5, 3 ,2 ,8, 9},
3313 { 9, 8, 2, 3, 5, 4, 6 ,7 ,1, 0},
3315 { 0, 1, 7, 6, 4, 5, 3 ,2 ,8, 9},
3316 { 0, 1, 7, 6, 5, 3, 4 ,2 ,8, 9},
3318 { 1, 0, 2, 3, 4, 5, 6, 7, 8, 9},
3319 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
3320 { 7, 6, 0, 1, 2, 3, 4, 5, 8, 9},
3321 { 1, 2, 0, 3, 6, 4, 5, 7, 8, 9}
3324 int i
, j
, vistolog
[sizeof(levels
[0])], logtovis
[sizeof(levels
[0])];
3326 hr
= ScriptLayout(sizeof(levels
[0]), NULL
, vistolog
, logtovis
);
3327 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got 0x%08x\n", hr
);
3329 hr
= ScriptLayout(sizeof(levels
[0]), levels
[0], NULL
, NULL
);
3330 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got 0x%08x\n", hr
);
3332 for (i
= 0; i
< sizeof(levels
)/sizeof(levels
[0]); i
++)
3334 hr
= ScriptLayout(sizeof(levels
[0]), levels
[i
], vistolog
, logtovis
);
3335 ok(hr
== S_OK
, "expected S_OK, got 0x%08x\n", hr
);
3337 for (j
= 0; j
< sizeof(levels
[i
]); j
++)
3339 ok(expect_v2l
[i
][j
] == vistolog
[j
],
3340 "failure: levels[%d][%d] = %d, vistolog[%d] = %d\n",
3341 i
, j
, levels
[i
][j
], j
, vistolog
[j
] );
3344 for (j
= 0; j
< sizeof(levels
[i
]); j
++)
3346 ok(expect_l2v
[i
][j
] == logtovis
[j
],
3347 "failure: levels[%d][%d] = %d, logtovis[%d] = %d\n",
3348 i
, j
, levels
[i
][j
], j
, logtovis
[j
] );
3353 static BOOL CALLBACK
enum_proc(LGRPID group
, LCID lcid
, LPSTR locale
, LONG_PTR lparam
)
3356 SCRIPT_DIGITSUBSTITUTE sds
;
3361 if (!IsValidLocale(lcid
, LCID_INSTALLED
)) return TRUE
;
3363 memset(&sds
, 0, sizeof(sds
));
3364 memset(&sc
, 0, sizeof(sc
));
3365 memset(&ss
, 0, sizeof(ss
));
3367 lcid_old
= GetThreadLocale();
3368 if (!SetThreadLocale(lcid
)) return TRUE
;
3370 hr
= ScriptRecordDigitSubstitution(lcid
, &sds
);
3371 ok(hr
== S_OK
, "ScriptRecordDigitSubstitution failed: 0x%08x\n", hr
);
3373 hr
= ScriptApplyDigitSubstitution(&sds
, &sc
, &ss
);
3374 ok(hr
== S_OK
, "ScriptApplyDigitSubstitution failed: 0x%08x\n", hr
);
3376 SetThreadLocale(lcid_old
);
3380 static void test_digit_substitution(void)
3384 static const LGRPID groups
[] =
3386 LGRPID_WESTERN_EUROPE
,
3387 LGRPID_CENTRAL_EUROPE
,
3394 LGRPID_TRADITIONAL_CHINESE
,
3395 LGRPID_SIMPLIFIED_CHINESE
,
3405 static BOOL (WINAPI
* pEnumLanguageGroupLocalesA
)(LANGGROUPLOCALE_ENUMPROCA
,LGRPID
,DWORD
,LONG_PTR
);
3407 hKernel32
= GetModuleHandleA("kernel32.dll");
3408 pEnumLanguageGroupLocalesA
= (void*)GetProcAddress(hKernel32
, "EnumLanguageGroupLocalesA");
3410 if (!pEnumLanguageGroupLocalesA
)
3412 win_skip("EnumLanguageGroupLocalesA not available on this platform\n");
3416 for (i
= 0; i
< sizeof(groups
)/sizeof(groups
[0]); i
++)
3418 ret
= pEnumLanguageGroupLocalesA(enum_proc
, groups
[i
], 0, 0);
3419 if (!ret
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED
)
3421 win_skip("EnumLanguageGroupLocalesA not implemented on this platform\n");
3425 ok(ret
, "EnumLanguageGroupLocalesA failed unexpectedly: %u\n", GetLastError());
3429 static void test_ScriptGetProperties(void)
3431 const SCRIPT_PROPERTIES
**props
;
3435 hr
= ScriptGetProperties(NULL
, NULL
);
3436 ok(hr
== E_INVALIDARG
, "ScriptGetProperties succeeded\n");
3438 hr
= ScriptGetProperties(NULL
, &num
);
3439 ok(hr
== S_OK
, "ScriptGetProperties failed: 0x%08x\n", hr
);
3441 hr
= ScriptGetProperties(&props
, NULL
);
3442 ok(hr
== S_OK
, "ScriptGetProperties failed: 0x%08x\n", hr
);
3444 hr
= ScriptGetProperties(&props
, &num
);
3445 ok(hr
== S_OK
, "ScriptGetProperties failed: 0x%08x\n", hr
);
3448 static void test_ScriptBreak(void)
3450 static const WCHAR test
[] = {' ','\r','\n',0};
3451 SCRIPT_ITEM items
[4];
3455 hr
= ScriptItemize(test
, 3, 4, NULL
, NULL
, items
, NULL
);
3456 ok(hr
== S_OK
, "ScriptItemize should return S_OK not %08x\n", hr
);
3459 * This Test crashes pre Vista.
3461 hr = ScriptBreak(test, 1, &items[0].a, NULL);
3462 ok(hr == E_INVALIDARG, "ScriptBreak should return E_INVALIDARG not %08x\n", hr);
3465 hr
= ScriptBreak(test
, 0, &items
[0].a
, &la
);
3466 ok(hr
== E_FAIL
|| broken(hr
== S_OK
), "ScriptBreak should return E_FAIL not %08x\n", hr
);
3468 hr
= ScriptBreak(test
, -1, &items
[0].a
, &la
);
3469 ok(hr
== E_INVALIDARG
|| broken(hr
== S_OK
), "ScriptBreak should return E_INVALIDARG not %08x\n", hr
);
3471 memset(&la
, 0, sizeof(la
));
3472 hr
= ScriptBreak(test
, 1, &items
[0].a
, &la
);
3473 ok(hr
== S_OK
, "ScriptBreak should return S_OK not %08x\n", hr
);
3475 ok(!la
.fSoftBreak
, "fSoftBreak set\n");
3476 ok(la
.fWhiteSpace
, "fWhiteSpace not set\n");
3477 ok(la
.fCharStop
, "fCharStop not set\n");
3478 ok(!la
.fWordStop
, "fWordStop set\n");
3479 ok(!la
.fInvalid
, "fInvalid set\n");
3480 ok(!la
.fReserved
, "fReserved set\n");
3482 memset(&la
, 0, sizeof(la
));
3483 hr
= ScriptBreak(test
+ 1, 1, &items
[1].a
, &la
);
3484 ok(hr
== S_OK
, "ScriptBreak should return S_OK not %08x\n", hr
);
3486 ok(!la
.fSoftBreak
, "fSoftBreak set\n");
3487 ok(!la
.fWhiteSpace
, "fWhiteSpace set\n");
3488 ok(la
.fCharStop
, "fCharStop not set\n");
3489 ok(!la
.fWordStop
, "fWordStop set\n");
3490 ok(!la
.fInvalid
, "fInvalid set\n");
3491 ok(!la
.fReserved
, "fReserved set\n");
3493 memset(&la
, 0, sizeof(la
));
3494 hr
= ScriptBreak(test
+ 2, 1, &items
[2].a
, &la
);
3495 ok(hr
== S_OK
, "ScriptBreak should return S_OK not %08x\n", hr
);
3497 ok(!la
.fSoftBreak
, "fSoftBreak set\n");
3498 ok(!la
.fWhiteSpace
, "fWhiteSpace set\n");
3499 ok(la
.fCharStop
, "fCharStop not set\n");
3500 ok(!la
.fWordStop
, "fWordStop set\n");
3501 ok(!la
.fInvalid
, "fInvalid set\n");
3502 ok(!la
.fReserved
, "fReserved set\n");
3505 static void test_newlines(void)
3507 static const WCHAR test1
[] = {'t','e','x','t','\r','t','e','x','t',0};
3508 static const WCHAR test2
[] = {'t','e','x','t','\n','t','e','x','t',0};
3509 static const WCHAR test3
[] = {'t','e','x','t','\r','\n','t','e','x','t',0};
3510 static const WCHAR test4
[] = {'t','e','x','t','\n','\r','t','e','x','t',0};
3511 static const WCHAR test5
[] = {'1','2','3','4','\n','\r','1','2','3','4',0};
3512 SCRIPT_ITEM items
[5];
3517 hr
= ScriptItemize(test1
, lstrlenW(test1
), 5, NULL
, NULL
, items
, &count
);
3518 ok(hr
== S_OK
, "ScriptItemize failed: 0x%08x\n", hr
);
3519 ok(count
== 3, "got %d expected 3\n", count
);
3522 hr
= ScriptItemize(test2
, lstrlenW(test2
), 5, NULL
, NULL
, items
, &count
);
3523 ok(hr
== S_OK
, "ScriptItemize failed: 0x%08x\n", hr
);
3524 ok(count
== 3, "got %d expected 3\n", count
);
3527 hr
= ScriptItemize(test3
, lstrlenW(test3
), 5, NULL
, NULL
, items
, &count
);
3528 ok(hr
== S_OK
, "ScriptItemize failed: 0x%08x\n", hr
);
3529 ok(count
== 4, "got %d expected 4\n", count
);
3532 hr
= ScriptItemize(test4
, lstrlenW(test4
), 5, NULL
, NULL
, items
, &count
);
3533 ok(hr
== S_OK
, "ScriptItemize failed: 0x%08x\n", hr
);
3534 ok(count
== 4, "got %d expected 4\n", count
);
3537 hr
= ScriptItemize(test5
, lstrlenW(test5
), 5, NULL
, NULL
, items
, &count
);
3538 ok(hr
== S_OK
, "ScriptItemize failed: 0x%08x\n", hr
);
3539 ok(count
== 4, "got %d expected 4\n", count
);
3542 static void test_ScriptGetFontFunctions(HDC hdc
)
3545 pScriptGetFontScriptTags
= (void*)GetProcAddress(GetModuleHandleA("usp10.dll"), "ScriptGetFontScriptTags");
3546 pScriptGetFontLanguageTags
= (void*)GetProcAddress(GetModuleHandleA("usp10.dll"), "ScriptGetFontLanguageTags");
3547 pScriptGetFontFeatureTags
= (void*)GetProcAddress(GetModuleHandleA("usp10.dll"), "ScriptGetFontFeatureTags");
3548 if (!pScriptGetFontScriptTags
|| !pScriptGetFontLanguageTags
|| !pScriptGetFontFeatureTags
)
3550 win_skip("ScriptGetFontScriptTags,ScriptGetFontLanguageTags or ScriptGetFontFeatureTags not available on this platform\n");
3554 SCRIPT_CACHE sc
= NULL
;
3555 OPENTYPE_TAG tags
[5];
3558 SCRIPT_ITEM outpItems
[15];
3559 SCRIPT_CONTROL Control
;
3561 static const WCHAR test_phagspa
[] = {0xa84f, 0xa861, 0xa843, 0x0020, 0xa863, 0xa861, 0xa859, 0x0020, 0xa850, 0xa85c, 0xa85e};
3563 hr
= pScriptGetFontScriptTags(hdc
, &sc
, NULL
, 0, NULL
, NULL
);
3564 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3565 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3566 hr
= pScriptGetFontScriptTags(hdc
, &sc
, NULL
, 0, NULL
, &count
);
3567 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3568 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3569 hr
= pScriptGetFontScriptTags(hdc
, &sc
, NULL
, 5, tags
, NULL
);
3570 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3571 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3572 hr
= pScriptGetFontScriptTags(hdc
, &sc
, NULL
, 0, tags
, &count
);
3573 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3574 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3575 hr
= pScriptGetFontScriptTags(NULL
, &sc
, NULL
, 5, tags
, &count
);
3576 ok(hr
== E_PENDING
,"Incorrect return code\n");
3577 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3578 hr
= pScriptGetFontScriptTags(hdc
, &sc
, NULL
, 5, tags
, &count
);
3579 ok((hr
== S_OK
|| hr
== E_OUTOFMEMORY
),"Incorrect return code\n");
3581 ok(count
<= 5, "Count should be less or equal to 5 with S_OK return\n");
3582 else if (hr
== E_OUTOFMEMORY
)
3583 ok(count
== 0, "Count should be 0 with E_OUTOFMEMORY return\n");
3584 ok(sc
!= NULL
, "ScriptCache should be initialized\n");
3586 ScriptFreeCache(&sc
);
3589 hr
= pScriptGetFontLanguageTags(hdc
, &sc
, NULL
, latn_tag
, 0, NULL
, NULL
);
3590 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3591 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3592 hr
= pScriptGetFontLanguageTags(hdc
, &sc
, NULL
, latn_tag
, 0, NULL
, &count
);
3593 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3594 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3595 hr
= pScriptGetFontLanguageTags(hdc
, &sc
, NULL
, latn_tag
, 5, tags
, NULL
);
3596 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3597 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3598 hr
= pScriptGetFontLanguageTags(hdc
, &sc
, NULL
, latn_tag
, 0, tags
, &count
);
3599 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3600 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3601 hr
= pScriptGetFontLanguageTags(NULL
, &sc
, NULL
, latn_tag
, 5, tags
, &count
);
3602 ok(hr
== E_PENDING
,"Incorrect return code\n");
3603 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3604 hr
= pScriptGetFontLanguageTags(hdc
, &sc
, NULL
, latn_tag
, 5, tags
, &count
);
3605 ok((hr
== S_OK
|| hr
== E_OUTOFMEMORY
),"Incorrect return code\n");
3607 ok(count
<= 5, "Count should be less or equal to 5 with S_OK return\n");
3608 else if (hr
== E_OUTOFMEMORY
)
3609 ok(count
== 0, "Count should be 0 with E_OUTOFMEMORY return\n");
3611 ScriptFreeCache(&sc
);
3614 hr
= pScriptGetFontFeatureTags(hdc
, &sc
, NULL
, latn_tag
, 0x0, 0, NULL
, NULL
);
3615 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3616 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3617 hr
= pScriptGetFontFeatureTags(hdc
, &sc
, NULL
, latn_tag
, 0x0, 0, NULL
, &count
);
3618 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3619 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3620 hr
= pScriptGetFontFeatureTags(hdc
, &sc
, NULL
, latn_tag
, 0x0, 5, tags
, NULL
);
3621 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3622 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3623 hr
= pScriptGetFontFeatureTags(hdc
, &sc
, NULL
, latn_tag
, 0x0, 0, tags
, &count
);
3624 ok(hr
== E_INVALIDARG
,"Incorrect return code\n");
3625 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3626 hr
= pScriptGetFontFeatureTags(NULL
, &sc
, NULL
, latn_tag
, 0x0, 5, tags
, &count
);
3627 ok(hr
== E_PENDING
,"Incorrect return code\n");
3628 ok(sc
== NULL
, "ScriptCache should remain uninitialized\n");
3629 hr
= pScriptGetFontFeatureTags(hdc
, &sc
, NULL
, latn_tag
, 0x0, 5, tags
, &count
);
3630 ok((hr
== S_OK
|| hr
== E_OUTOFMEMORY
),"Incorrect return code\n");
3632 ok(count
<= 5, "Count should be less or equal to 5 with S_OK return\n");
3633 else if (hr
== E_OUTOFMEMORY
)
3634 ok(count
== 0, "Count should be 0 with E_OUTOFMEMORY return\n");
3636 memset(&Control
, 0, sizeof(Control
));
3637 memset(&State
, 0, sizeof(State
));
3639 hr
= ScriptItemize(test_phagspa
, 10, 15, &Control
, &State
, outpItems
, &outnItems
);
3640 ok(hr
== S_OK
, "ScriptItemize failed: 0x%08x\n", hr
);
3641 memset(tags
,0,sizeof(tags
));
3642 hr
= pScriptGetFontScriptTags(hdc
, &sc
, &outpItems
[0].a
, 5, tags
, &count
);
3643 ok( hr
== USP_E_SCRIPT_NOT_IN_FONT
|| broken(hr
== S_OK
), "wrong return code\n");
3645 hr
= pScriptGetFontLanguageTags(hdc
, &sc
, NULL
, dsrt_tag
, 5, tags
, &count
);
3646 ok( hr
== S_OK
, "wrong return code\n");
3647 hr
= pScriptGetFontLanguageTags(hdc
, &sc
, &outpItems
[0].a
, dsrt_tag
, 5, tags
, &count
);
3648 ok( hr
== E_INVALIDARG
|| broken(hr
== S_OK
), "wrong return code\n");
3650 hr
= pScriptGetFontFeatureTags(hdc
, &sc
, NULL
, dsrt_tag
, 0x0, 5, tags
, &count
);
3651 ok( hr
== S_OK
, "wrong return code\n");
3652 hr
= pScriptGetFontFeatureTags(hdc
, &sc
, &outpItems
[0].a
, dsrt_tag
, 0x0, 5, tags
, &count
);
3653 ok( hr
== E_INVALIDARG
|| broken(hr
== S_OK
), "wrong return code\n");
3655 ScriptFreeCache(&sc
);
3659 struct logical_width_test
3666 BOOL clusterstart
[3];
3672 static const struct logical_width_test logical_width_tests
[] =
3674 { 3, 3, { 6, 9, 12 }, { 0, 1, 2 }, { 6, 9, 12 }, { 1, 1, 1 } },
3675 { 3, 3, { 6, 9, 12 }, { 0, 1, 2 }, { 6, 9, 12 }, { 1, 1, 1 }, { 1, 0, 0 } },
3676 { 3, 3, { 6, 9, 12 }, { 0, 1, 2 }, { 6, 9, 12 }, { 1, 1, 1 }, { 0 }, { 1, 1, 1 } },
3677 { 3, 3, { 6, 9, 12 }, { 0, 1, 2 }, { 27, 21, 12 }, { 0, 0, 0 }, { 0 }, { 0 }, TRUE
},
3678 { 3, 3, { 6, 9, 12 }, { 0, 1, 2 }, { 6, 21, 12 }, { 0, 1, 0 }, { 0 }, { 0 }, TRUE
},
3679 { 3, 3, { 6, 9, 12 }, { 0, 1, 2 }, { 6, 21, 12 }, { 1, 1, 0 }, { 0 }, { 0 }, TRUE
},
3680 { 3, 3, { 6, 9, 12 }, { 0, 2, 2 }, { 15, 6, 6 }, { 1, 0, 1 } },
3683 static void test_ScriptGetLogicalWidths(void)
3685 SCRIPT_ANALYSIS sa
= { 0 };
3688 for (i
= 0; i
< sizeof(logical_width_tests
)/sizeof(logical_width_tests
[0]); i
++)
3690 const struct logical_width_test
*ptr
= logical_width_tests
+ i
;
3691 SCRIPT_VISATTR attrs
[3];
3695 memset(attrs
, 0, sizeof(attrs
));
3696 for (j
= 0; j
< ptr
->glyph_count
; j
++)
3698 attrs
[j
].fClusterStart
= ptr
->clusterstart
[j
];
3699 attrs
[j
].fDiacritic
= ptr
->diacritic
[j
];
3700 attrs
[j
].fZeroWidth
= ptr
->zerowidth
[j
];
3703 hr
= ScriptGetLogicalWidths(&sa
, ptr
->char_count
, ptr
->glyph_count
, ptr
->advances
, ptr
->map
, attrs
, widths
);
3704 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
3706 todo_wine_if(ptr
->todo
)
3707 ok(!memcmp(ptr
->widths
, widths
, sizeof(widths
)), "test %u: got wrong widths\n", i
);
3718 unsigned short pwOutGlyphs
[256];
3720 /* We need a valid HDC to drive a lot of Script functions which requires the following *
3721 * to set up for the tests. */
3722 hwnd
= CreateWindowExA(0, "static", "", WS_POPUP
, 0,0,100,100,
3725 ShowWindow(hwnd
, SW_SHOW
);
3728 hdc
= GetDC(hwnd
); /* We now have a hdc */
3729 ok( hdc
!= NULL
, "HDC failed to be created %p\n", hdc
);
3731 memset(&lf
, 0, sizeof(LOGFONTA
));
3732 lstrcpyA(lf
.lfFaceName
, "Tahoma");
3737 hfont
= SelectObject(hdc
, CreateFontIndirectA(&lf
));
3738 ok(hfont
!= NULL
, "SelectObject failed: %p\n", hfont
);
3740 test_ScriptItemize();
3741 test_ScriptItemIzeShapePlace(hdc
,pwOutGlyphs
);
3742 test_ScriptGetCMap(hdc
, pwOutGlyphs
);
3743 test_ScriptCacheGetHeight(hdc
);
3744 test_ScriptGetGlyphABCWidth(hdc
);
3745 test_ScriptShape(hdc
);
3746 test_ScriptShapeOpenType(hdc
);
3747 test_ScriptPlace(hdc
);
3749 test_ScriptGetFontProperties(hdc
);
3750 test_ScriptTextOut(hdc
);
3751 test_ScriptTextOut2(hdc
);
3752 test_ScriptTextOut3(hdc
);
3754 test_ScriptString(hdc
);
3755 test_ScriptStringXtoCP_CPtoX(hdc
);
3757 test_ScriptLayout();
3758 test_digit_substitution();
3759 test_ScriptGetProperties();
3763 test_ScriptGetFontFunctions(hdc
);
3764 test_ScriptGetLogicalWidths();
3766 ReleaseDC(hwnd
, hdc
);
3767 DestroyWindow(hwnd
);