ReactOS  0.4.14-dev-552-g2fad488
usp10.c File Reference
#include <assert.h>
#include <stdio.h>
#include <wine/test.h>
#include <windows.h>
#include <usp10.h>
Include dependency graph for usp10.c:

Go to the source code of this file.

Classes

struct  _itemTest
 
struct  _shapeTest_char
 
struct  _shapeTest_glyph
 
struct  _font_fingerprint
 
struct  tagRangeP
 
struct  enum_font_data
 
struct  logical_width_test
 

Macros

#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)
 
#define MS_MAKE_TAG(_x1, _x2, _x3, _x4)
 
#define latn_tag   MS_MAKE_TAG('l','a','t','n')
 
#define arab_tag   MS_MAKE_TAG('a','r','a','b')
 
#define thai_tag   MS_MAKE_TAG('t','h','a','i')
 
#define hebr_tag   MS_MAKE_TAG('h','e','b','r')
 
#define syrc_tag   MS_MAKE_TAG('s','y','r','c')
 
#define thaa_tag   MS_MAKE_TAG('t','h','a','a')
 
#define deva_tag   MS_MAKE_TAG('d','e','v','a')
 
#define beng_tag   MS_MAKE_TAG('b','e','n','g')
 
#define guru_tag   MS_MAKE_TAG('g','u','r','u')
 
#define gujr_tag   MS_MAKE_TAG('g','u','j','r')
 
#define orya_tag   MS_MAKE_TAG('o','r','y','a')
 
#define taml_tag   MS_MAKE_TAG('t','a','m','l')
 
#define telu_tag   MS_MAKE_TAG('t','e','l','u')
 
#define knda_tag   MS_MAKE_TAG('k','n','d','a')
 
#define mlym_tag   MS_MAKE_TAG('m','l','y','m')
 
#define mymr_tag   MS_MAKE_TAG('m','y','m','r')
 
#define tale_tag   MS_MAKE_TAG('t','a','l','e')
 
#define talu_tag   MS_MAKE_TAG('t','a','l','u')
 
#define khmr_tag   MS_MAKE_TAG('k','h','m','r')
 
#define hani_tag   MS_MAKE_TAG('h','a','n','i')
 
#define bopo_tag   MS_MAKE_TAG('b','o','p','o')
 
#define kana_tag   MS_MAKE_TAG('k','a','n','a')
 
#define hang_tag   MS_MAKE_TAG('h','a','n','g')
 
#define yi_tag   MS_MAKE_TAG('y','i',' ',' ')
 
#define ethi_tag   MS_MAKE_TAG('e','t','h','i')
 
#define mong_tag   MS_MAKE_TAG('m','o','n','g')
 
#define tfng_tag   MS_MAKE_TAG('t','f','n','g')
 
#define nko_tag   MS_MAKE_TAG('n','k','o',' ')
 
#define vai_tag   MS_MAKE_TAG('v','a','i',' ')
 
#define cher_tag   MS_MAKE_TAG('c','h','e','r')
 
#define cans_tag   MS_MAKE_TAG('c','a','n','s')
 
#define ogam_tag   MS_MAKE_TAG('o','g','a','m')
 
#define runr_tag   MS_MAKE_TAG('r','u','n','r')
 
#define brai_tag   MS_MAKE_TAG('b','r','a','i')
 
#define dsrt_tag   MS_MAKE_TAG('d','s','r','t')
 
#define osma_tag   MS_MAKE_TAG('o','s','m','a')
 
#define math_tag   MS_MAKE_TAG('m','a','t','h')
 
#define test_shape_ok(a, b, c, d, e, f, g, h, i)   (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _test_shape_ok(1,a,b,c,d,e,f,g,h,i,NULL)
 
#define test_shape_ok_valid(v, a, b, c, d, e, f, g, h, i)   (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _test_shape_ok(v,a,b,c,d,e,f,g,h,i,NULL)
 
#define test_shape_ok_valid_props2(v, a, b, c, d, e, f, g, h, i, j)   (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _test_shape_ok(v,a,b,c,d,e,f,g,h,i,j)
 
#define find_font_for_range(a, b, c, d, e, f, g)   (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _find_font_for_range(a,b,c,d,e,f,g)
 
#define MAX_ENUM_FONTS   4096
 
#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)
 
#define test_caret_item_ScriptXtoCP(a, b, c, d, e, f)   _test_caret_item_ScriptXtoCP(__LINE__,a,b,c,d,e,f)
 

Typedefs

typedef struct _itemTest itemTest
 
typedef struct _shapeTest_char shapeTest_char
 
typedef struct _shapeTest_glyph shapeTest_glyph
 
typedef struct _font_fingerprint font_fingerprint
 
typedef struct tagRangeP fontEnumParam
 

Functions

static HRESULT (WINAPI *pScriptItemizeOpenType)(const WCHAR *pwcInChars
 
static void _test_items_ok (LPCWSTR string, DWORD cchString, SCRIPT_CONTROL *Control, SCRIPT_STATE *State, DWORD nItems, const itemTest *items, BOOL nItemsToDo, const INT nItemsBroken[2])
 
static void test_ScriptItemize (void)
 
static void make_surrogate (DWORD i, WORD out[2])
 
static void test_ScriptItemize_surrogates (void)
 
static void _test_shape_ok (int valid, HDC hdc, LPCWSTR string, DWORD cchString, SCRIPT_CONTROL *Control, SCRIPT_STATE *State, DWORD item, DWORD nGlyphs, const shapeTest_char *charItems, const shapeTest_glyph *glyphItems, const SCRIPT_GLYPHPROP *props2)
 
static int CALLBACK enumFontProc (const LOGFONTA *lpelfe, const TEXTMETRICA *lpntme, DWORD FontType, LPARAM lParam)
 
static int _find_font_for_range (HDC hdc, const CHAR *recommended, BYTE range, const WCHAR check, HFONT *hfont, HFONT *origFont, const font_fingerprint *fingerprint)
 
static void test_ScriptShapeOpenType (HDC hdc)
 
static void test_ScriptShape (HDC hdc)
 
static void test_ScriptPlace (HDC hdc)
 
static void test_ScriptItemIzeShapePlace (HDC hdc, unsigned short pwOutGlyphs[256])
 
static void test_ScriptGetCMap (HDC hdc, unsigned short pwOutGlyphs[256])
 
static INT CALLBACK enum_bitmap_font_proc (const LOGFONTA *lf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
 
static INT CALLBACK enum_truetype_proc (const LOGFONTA *lf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
 
static void test_ScriptGetFontProperties (HDC hdc)
 
static void test_ScriptTextOut (HDC hdc)
 
static void test_ScriptTextOut2 (HDC hdc)
 
static void test_ScriptTextOut3 (HDC hdc)
 
static void _test_item_ScriptXtoX (SCRIPT_ANALYSIS *psa, int cChars, int cGlyphs, const int *offsets, const WORD *pwLogClust, const int *piAdvance)
 
static void _test_caret_item_ScriptXtoCP (int line, SCRIPT_ANALYSIS *psa, int cChars, int cGlyphs, const int *offsets, const WORD *pwLogClust, const int *piAdvance)
 
static void test_ScriptXtoX (void)
 
static void test_ScriptString (HDC hdc)
 
static void test_ScriptStringXtoCP_CPtoX (HDC hdc)
 
static HWND create_test_window (void)
 
static void test_ScriptCacheGetHeight (HDC hdc)
 
static void test_ScriptGetGlyphABCWidth (HDC hdc)
 
static void test_ScriptLayout (void)
 
static BOOL CALLBACK enum_proc (LGRPID group, LCID lcid, LPSTR locale, LONG_PTR lparam)
 
static void test_digit_substitution (void)
 
static void test_ScriptGetProperties (void)
 
static void test_ScriptBreak (void)
 
static void test_newlines (void)
 
static void test_ScriptGetFontFunctions (HDC hdc)
 
static void test_ScriptGetLogicalWidths (void)
 
static void test_ScriptIsComplex (void)
 
static void test_ScriptString_pSize (HDC hdc)
 
static void test_script_cache_reuse (void)
 
static void init_tests (void)
 
 START_TEST (usp10)
 

Variables

static int cInChars
 
static int int cMaxItems
 
static int int const SCRIPT_CONTROLpsControl
 
static int int const SCRIPT_CONTROL const SCRIPT_STATEpsState
 
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEMpItems
 
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEM ULONGpScriptTags
 
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEM ULONG intpcItems
 
static SCRIPT_CACHEpsc
 
static SCRIPT_CACHE SCRIPT_ANALYSISpsa
 
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG tagScript
 
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG tagLangSys
 
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG intrcRangeChars
 
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES ** rpRangeProperties
 
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int cRanges
 
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHARpwcChars
 
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int cChars
 
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int cMaxGlyphs
 
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORDpwLogClust
 
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD SCRIPT_CHARPROPpCharProps
 
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD SCRIPT_CHARPROP WORDpwOutGlyphs
 
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD SCRIPT_CHARPROP WORD SCRIPT_GLYPHPROPpOutGlyphProps
 
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD SCRIPT_CHARPROP WORD SCRIPT_GLYPHPROP intpcGlyphs
 
static SCRIPT_CACHE SCRIPT_ANALYSIS int cMaxTags
 
static SCRIPT_CACHE SCRIPT_ANALYSIS int OPENTYPE_TAG intpcTags
 
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG int OPENTYPE_TAGpLangSysTags
 
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int OPENTYPE_TAGpFeatureTags
 
static const struct logical_width_test logical_width_tests []
 

Macro Definition Documentation

◆ arab_tag

#define arab_tag   MS_MAKE_TAG('a','r','a','b')

Definition at line 143 of file usp10.c.

◆ beng_tag

#define beng_tag   MS_MAKE_TAG('b','e','n','g')

Definition at line 149 of file usp10.c.

◆ bopo_tag

#define bopo_tag   MS_MAKE_TAG('b','o','p','o')

Definition at line 162 of file usp10.c.

◆ brai_tag

#define brai_tag   MS_MAKE_TAG('b','r','a','i')

Definition at line 175 of file usp10.c.

◆ cans_tag

#define cans_tag   MS_MAKE_TAG('c','a','n','s')

Definition at line 172 of file usp10.c.

◆ cher_tag

#define cher_tag   MS_MAKE_TAG('c','h','e','r')

Definition at line 171 of file usp10.c.

◆ deva_tag

#define deva_tag   MS_MAKE_TAG('d','e','v','a')

Definition at line 148 of file usp10.c.

◆ dsrt_tag

#define dsrt_tag   MS_MAKE_TAG('d','s','r','t')

Definition at line 176 of file usp10.c.

◆ ethi_tag

#define ethi_tag   MS_MAKE_TAG('e','t','h','i')

Definition at line 166 of file usp10.c.

◆ find_font_for_range

#define find_font_for_range (   a,
  b,
  c,
  d,
  e,
  f,
  g 
)    (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _find_font_for_range(a,b,c,d,e,f,g)

Definition at line 1355 of file usp10.c.

◆ gujr_tag

#define gujr_tag   MS_MAKE_TAG('g','u','j','r')

Definition at line 151 of file usp10.c.

◆ guru_tag

#define guru_tag   MS_MAKE_TAG('g','u','r','u')

Definition at line 150 of file usp10.c.

◆ hang_tag

#define hang_tag   MS_MAKE_TAG('h','a','n','g')

Definition at line 164 of file usp10.c.

◆ hani_tag

#define hani_tag   MS_MAKE_TAG('h','a','n','i')

Definition at line 161 of file usp10.c.

◆ hebr_tag

#define hebr_tag   MS_MAKE_TAG('h','e','b','r')

Definition at line 145 of file usp10.c.

◆ kana_tag

#define kana_tag   MS_MAKE_TAG('k','a','n','a')

Definition at line 163 of file usp10.c.

◆ khmr_tag

#define khmr_tag   MS_MAKE_TAG('k','h','m','r')

Definition at line 160 of file usp10.c.

◆ knda_tag

#define knda_tag   MS_MAKE_TAG('k','n','d','a')

Definition at line 155 of file usp10.c.

◆ latn_tag

#define latn_tag   MS_MAKE_TAG('l','a','t','n')

Definition at line 142 of file usp10.c.

◆ math_tag

#define math_tag   MS_MAKE_TAG('m','a','t','h')

Definition at line 178 of file usp10.c.

◆ MAX_ENUM_FONTS

#define MAX_ENUM_FONTS   4096

Definition at line 2467 of file usp10.c.

◆ mlym_tag

#define mlym_tag   MS_MAKE_TAG('m','l','y','m')

Definition at line 156 of file usp10.c.

◆ mong_tag

#define mong_tag   MS_MAKE_TAG('m','o','n','g')

Definition at line 167 of file usp10.c.

◆ MS_MAKE_TAG

#define MS_MAKE_TAG (   _x1,
  _x2,
  _x3,
  _x4 
)
Value:
( ( (ULONG)_x4 << 24 ) | \
( (ULONG)_x3 << 16 ) | \
( (ULONG)_x2 << 8 ) | \
(ULONG)_x1 )
unsigned int ULONG
Definition: retypes.h:1

Definition at line 136 of file usp10.c.

◆ mymr_tag

#define mymr_tag   MS_MAKE_TAG('m','y','m','r')

Definition at line 157 of file usp10.c.

◆ nko_tag

#define nko_tag   MS_MAKE_TAG('n','k','o',' ')

Definition at line 169 of file usp10.c.

◆ ogam_tag

#define ogam_tag   MS_MAKE_TAG('o','g','a','m')

Definition at line 173 of file usp10.c.

◆ orya_tag

#define orya_tag   MS_MAKE_TAG('o','r','y','a')

Definition at line 152 of file usp10.c.

◆ osma_tag

#define osma_tag   MS_MAKE_TAG('o','s','m','a')

Definition at line 177 of file usp10.c.

◆ runr_tag

#define runr_tag   MS_MAKE_TAG('r','u','n','r')

Definition at line 174 of file usp10.c.

◆ syrc_tag

#define syrc_tag   MS_MAKE_TAG('s','y','r','c')

Definition at line 146 of file usp10.c.

◆ tale_tag

#define tale_tag   MS_MAKE_TAG('t','a','l','e')

Definition at line 158 of file usp10.c.

◆ talu_tag

#define talu_tag   MS_MAKE_TAG('t','a','l','u')

Definition at line 159 of file usp10.c.

◆ taml_tag

#define taml_tag   MS_MAKE_TAG('t','a','m','l')

Definition at line 153 of file usp10.c.

◆ telu_tag

#define telu_tag   MS_MAKE_TAG('t','e','l','u')

Definition at line 154 of file usp10.c.

◆ test_caret_item_ScriptXtoCP

#define test_caret_item_ScriptXtoCP (   a,
  b,
  c,
  d,
  e,
  f 
)    _test_caret_item_ScriptXtoCP(__LINE__,a,b,c,d,e,f)

Definition at line 2973 of file usp10.c.

◆ test_item_ScriptXtoX

#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)

Definition at line 2901 of file usp10.c.

◆ test_items_ok

#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)

Definition at line 134 of file usp10.c.

◆ test_shape_ok

#define test_shape_ok (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i 
)    (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _test_shape_ok(1,a,b,c,d,e,f,g,h,i,NULL)

Definition at line 1230 of file usp10.c.

◆ test_shape_ok_valid

#define test_shape_ok_valid (   v,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i 
)    (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _test_shape_ok(v,a,b,c,d,e,f,g,h,i,NULL)

Definition at line 1233 of file usp10.c.

◆ test_shape_ok_valid_props2

#define test_shape_ok_valid_props2 (   v,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j 
)    (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _test_shape_ok(v,a,b,c,d,e,f,g,h,i,j)

Definition at line 1236 of file usp10.c.

◆ tfng_tag

#define tfng_tag   MS_MAKE_TAG('t','f','n','g')

Definition at line 168 of file usp10.c.

◆ thaa_tag

#define thaa_tag   MS_MAKE_TAG('t','h','a','a')

Definition at line 147 of file usp10.c.

◆ thai_tag

#define thai_tag   MS_MAKE_TAG('t','h','a','i')

Definition at line 144 of file usp10.c.

◆ vai_tag

#define vai_tag   MS_MAKE_TAG('v','a','i',' ')

Definition at line 170 of file usp10.c.

◆ yi_tag

#define yi_tag   MS_MAKE_TAG('y','i',' ',' ')

Definition at line 165 of file usp10.c.

Typedef Documentation

◆ font_fingerprint

◆ fontEnumParam

◆ itemTest

◆ shapeTest_char

◆ shapeTest_glyph

Function Documentation

◆ _find_font_for_range()

static int _find_font_for_range ( HDC  hdc,
const CHAR recommended,
BYTE  range,
const WCHAR  check,
HFONT hfont,
HFONT origFont,
const font_fingerprint fingerprint 
)
static

Definition at line 1274 of file usp10.c.

1275 {
1276  int rc = 0;
1278 
1279  lParam.range = range;
1280  memset(&lParam.lf,0,sizeof(LOGFONTA));
1281  *hfont = NULL;
1282 
1283  if (recommended)
1284  {
1285  lstrcpyA(lParam.lf.lfFaceName, recommended);
1287  {
1289  if (*hfont)
1290  {
1291  winetest_trace("using font %s\n",lParam.lf.lfFaceName);
1292  if (fingerprint)
1293  {
1294  WORD output[10];
1295  int i;
1296 
1297  *origFont = SelectObject(hdc,*hfont);
1298  if (GetGlyphIndicesW(hdc, fingerprint->check, 10, output, 0) != GDI_ERROR)
1299  {
1300  for (i=0; i < 10; i++)
1301  if (output[i] != fingerprint->result[i])
1302  {
1303  winetest_trace("found font does not match fingerprint\n");
1304  SelectObject(hdc,*origFont);
1305  DeleteObject(*hfont);
1306  *hfont = NULL;
1307  break;
1308  }
1309  if (i == 10) rc = 1;
1310  }
1311  SelectObject(hdc, *origFont);
1312  }
1313  else rc = 1;
1314  }
1315  }
1316  if (!rc)
1317  winetest_skip("Font %s is not available.\n", recommended);
1318  }
1319 
1320  if (!*hfont)
1321  {
1322  memset(&lParam.lf,0,sizeof(LOGFONTA));
1323  lParam.lf.lfCharSet = DEFAULT_CHARSET;
1324 
1325  if (!EnumFontFamiliesExA(hdc, &lParam.lf, enumFontProc, (LPARAM)&lParam, 0) && lParam.lf.lfFaceName[0])
1326  {
1328  if (*hfont)
1329  winetest_trace("trying font %s: failures will only be warnings\n",lParam.lf.lfFaceName);
1330  }
1331  }
1332 
1333  if (*hfont)
1334  {
1335  WORD glyph = 0;
1336 
1337  *origFont = SelectObject(hdc,*hfont);
1338  if (GetGlyphIndicesW(hdc, &check, 1, &glyph, 0) == GDI_ERROR || glyph == 0)
1339  {
1340  winetest_trace(" Font fails to contain required glyphs\n");
1341  SelectObject(hdc,*origFont);
1342  DeleteObject(*hfont);
1343  *hfont=NULL;
1344  rc = 0;
1345  }
1346  else if (!rc)
1347  rc = -1;
1348  }
1349  else
1350  winetest_trace("Failed to find usable font\n");
1351 
1352  return rc;
1353 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
static int CALLBACK enumFontProc(const LOGFONTA *lpelfe, const TEXTMETRICA *lpntme, DWORD FontType, LPARAM lParam)
Definition: usp10.c:1244
WORD result[10]
Definition: usp10.c:58
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define DEFAULT_CHARSET
Definition: wingdi.h:383
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
WCHAR check[10]
Definition: usp10.c:57
static HFONT hfont
void __winetest_cdecl winetest_trace(const char *msg,...)
unsigned short WORD
Definition: ntddk_ex.h:93
void check(CONTEXT *pContext)
Definition: NtContinue.c:61
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
HDC hdc
Definition: main.c:9
GLenum GLint * range
Definition: glext.h:7539
DWORD WINAPI GetGlyphIndicesW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpstr, _In_ int c, _Out_writes_(c) LPWORD pgi, _In_ DWORD fl)
void __winetest_cdecl winetest_skip(const char *msg,...)
int WINAPI EnumFontFamiliesExA(_In_ HDC, _In_ PLOGFONTA, _In_ FONTENUMPROCA, _In_ LPARAM, _In_ DWORD)
#define GDI_ERROR
Definition: wingdi.h:1308
#define memset(x, y, z)
Definition: compat.h:39
LPARAM lParam
Definition: combotst.c:139

◆ _test_caret_item_ScriptXtoCP()

static void _test_caret_item_ScriptXtoCP ( int  line,
SCRIPT_ANALYSIS psa,
int  cChars,
int  cGlyphs,
const int offsets,
const WORD pwLogClust,
const int piAdvance 
)
static

Definition at line 2975 of file usp10.c.

2976 {
2977  int iX, iCP, i;
2978  int icChars, icGlyphs;
2979  int piCP;
2980  int clusterSize;
2981  HRESULT hr;
2982  SCRIPT_VISATTR psva[10];
2983  int piTrailing;
2984  int direction;
2985 
2986  memset(psva,0,sizeof(psva));
2987  direction = (psa->fRTL)?-1:+1;
2988 
2989  for(iX = -1, i = iCP = 0; i < cChars; i++)
2990  {
2991  if (offsets[i] != iX)
2992  {
2993  iX = offsets[i];
2994  iCP = i;
2995  }
2996  icChars = cChars;
2997  icGlyphs = cGlyphs;
2998  hr = ScriptXtoCP(iX, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piCP, &piTrailing);
2999  ok_(__FILE__,line)(hr == S_OK, "ScriptXtoCP: should return S_OK not %08x\n", hr);
3000  ok_(__FILE__,line)(piCP == iCP, "ScriptXtoCP: iX=%d should return piCP=%d not %d\n", iX, iCP, piCP);
3001  ok_(__FILE__,line)(piTrailing == 0, "ScriptXtoCP: iX=%d should return piTrailing=0 not %d\n", iX, piTrailing);
3002  }
3003 
3004  for(iX = -2, i = 0; i < cChars; i++)
3005  {
3006  if (offsets[i]+direction != iX)
3007  {
3008  iX = offsets[i] + direction;
3009  iCP = i;
3010  }
3011  icChars = cChars;
3012  icGlyphs = cGlyphs;
3013  hr = ScriptXtoCP(iX, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piCP, &piTrailing);
3014  ok_(__FILE__,line)(hr == S_OK, "ScriptXtoCP leading: should return S_OK not %08x\n", hr);
3015  ok_(__FILE__,line)(piCP == iCP, "ScriptXtoCP leading: iX=%d should return piCP=%d not %d\n", iX, iCP, piCP);
3016  ok_(__FILE__,line)(piTrailing == 0, "ScriptXtoCP leading: iX=%d should return piTrailing=0 not %d\n", iX, piTrailing);
3017  }
3018 
3019  for(clusterSize = 0, iCP = 0, iX = -2, i = 0; i < cChars; i++)
3020  {
3021  clusterSize++;
3022  if (offsets[i] != offsets[i+1])
3023  {
3024  iX = offsets[i+1]-direction;
3025  icChars = cChars;
3026  icGlyphs = cGlyphs;
3027  hr = ScriptXtoCP(iX, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piCP, &piTrailing);
3028  ok_(__FILE__,line)(hr == S_OK, "ScriptXtoCP trailing: should return S_OK not %08x\n", hr);
3029  ok_(__FILE__,line)(piCP == iCP, "ScriptXtoCP trailing: iX=%d should return piCP=%d not %d\n", iX, iCP, piCP);
3030  ok_(__FILE__,line)(piTrailing == clusterSize, "ScriptXtoCP trailing: iX=%d should return piTrailing=%d not %d\n", iX, clusterSize, piTrailing);
3031  iCP = i+1;
3032  clusterSize = 0;
3033  }
3034  }
3035 }
HRESULT hr
Definition: shlfolder.c:183
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD * pwLogClust
Definition: usp10.c:64
_In_ FONTOBJ _In_ ULONG _In_ ULONG cGlyphs
Definition: winddi.h:3799
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HRESULT WINAPI ScriptXtoCP(int iX, int cChars, int cGlyphs, const WORD *pwLogClust, const SCRIPT_VISATTR *psva, const int *piAdvance, const SCRIPT_ANALYSIS *psa, int *piCP, int *piTrailing)
Definition: usp10.c:2854
Definition: parser.c:48
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int cChars
Definition: usp10.c:64
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64
#define memset(x, y, z)
Definition: compat.h:39
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _test_item_ScriptXtoX()

static void _test_item_ScriptXtoX ( SCRIPT_ANALYSIS psa,
int  cChars,
int  cGlyphs,
const int offsets,
const WORD pwLogClust,
const int piAdvance 
)
static

Definition at line 2903 of file usp10.c.

2904 {
2905  int iX, iCP;
2906  int icChars, icGlyphs;
2907  int piCP, piX;
2908  HRESULT hr;
2909  SCRIPT_VISATTR psva[10];
2910  int piTrailing;
2911  BOOL fTrailing;
2912  int direction;
2913 
2914  memset(psva,0,sizeof(psva));
2915  direction = (psa->fRTL)?-1:+1;
2916 
2917  for(iCP = 0; iCP < cChars; iCP++)
2918  {
2919  iX = offsets[iCP];
2920  icChars = cChars;
2921  icGlyphs = cGlyphs;
2922  hr = ScriptXtoCP(iX, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piCP, &piTrailing);
2923  winetest_ok(hr == S_OK, "ScriptXtoCP: should return S_OK not %08x\n", hr);
2924  winetest_ok(piCP == iCP, "ScriptXtoCP: iX=%d should return piCP=%d not %d\n", iX, iCP, piCP);
2925  winetest_ok(piTrailing == 0, "ScriptXtoCP: iX=%d should return piTrailing=0 not %d\n", iX, piTrailing);
2926  }
2927 
2928  for(iCP = 0; iCP < cChars; iCP++)
2929  {
2930  iX = offsets[iCP]+direction;
2931  icChars = cChars;
2932  icGlyphs = cGlyphs;
2933  hr = ScriptXtoCP(iX, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piCP, &piTrailing);
2934  winetest_ok(hr == S_OK, "ScriptXtoCP leading: should return S_OK not %08x\n", hr);
2935  winetest_ok(piCP == iCP, "ScriptXtoCP leading: iX=%d should return piCP=%d not %d\n", iX, iCP, piCP);
2936  winetest_ok(piTrailing == 0, "ScriptXtoCP leading: iX=%d should return piTrailing=0 not %d\n", iX, piTrailing);
2937  }
2938 
2939  for(iCP = 0; iCP < cChars; iCP++)
2940  {
2941  iX = offsets[iCP+1]-direction;
2942  icChars = cChars;
2943  icGlyphs = cGlyphs;
2944  hr = ScriptXtoCP(iX, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piCP, &piTrailing);
2945  winetest_ok(hr == S_OK, "ScriptXtoCP trailing: should return S_OK not %08x\n", hr);
2946  winetest_ok(piCP == iCP, "ScriptXtoCP trailing: iX=%d should return piCP=%d not %d\n", iX, iCP, piCP);
2947  winetest_ok(piTrailing == 1, "ScriptXtoCP trailing: iX=%d should return piTrailing=1 not %d\n", iX, piTrailing);
2948  }
2949 
2950  for(iCP = 0; iCP <= cChars+1; iCP++)
2951  {
2952  fTrailing = FALSE;
2953  icChars = cChars;
2954  icGlyphs = cGlyphs;
2955  hr = ScriptCPtoX(iCP, fTrailing, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piX);
2956  winetest_ok(hr == S_OK, "ScriptCPtoX: should return S_OK not %08x\n", hr);
2957  winetest_ok(piX == offsets[iCP],
2958  "ScriptCPtoX: iCP=%d should return piX=%d not %d\n", iCP, offsets[iCP], piX);
2959  }
2960 
2961  for(iCP = 0; iCP <= cChars+1; iCP++)
2962  {
2963  fTrailing = TRUE;
2964  icChars = cChars;
2965  icGlyphs = cGlyphs;
2966  hr = ScriptCPtoX(iCP, fTrailing, icChars, icGlyphs, pwLogClust, psva, piAdvance, psa, &piX);
2967  winetest_ok(hr == S_OK, "ScriptCPtoX trailing: should return S_OK not %08x\n", hr);
2968  winetest_ok(piX == offsets[iCP+1],
2969  "ScriptCPtoX trailing: iCP=%d should return piX=%d not %d\n", iCP, offsets[iCP+1], piX);
2970  }
2971 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD * pwLogClust
Definition: usp10.c:64
_In_ FONTOBJ _In_ ULONG _In_ ULONG cGlyphs
Definition: winddi.h:3799
HRESULT WINAPI ScriptCPtoX(int iCP, BOOL fTrailing, int cChars, int cGlyphs, const WORD *pwLogClust, const SCRIPT_VISATTR *psva, const int *piAdvance, const SCRIPT_ANALYSIS *psa, int *piX)
Definition: usp10.c:2650
HRESULT WINAPI ScriptXtoCP(int iX, int cChars, int cGlyphs, const WORD *pwLogClust, const SCRIPT_VISATTR *psva, const int *piAdvance, const SCRIPT_ANALYSIS *psa, int *piCP, int *piTrailing)
Definition: usp10.c:2854
unsigned int BOOL
Definition: ntddk_ex.h:94
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int cChars
Definition: usp10.c:64
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64
#define memset(x, y, z)
Definition: compat.h:39

◆ _test_items_ok()

static void _test_items_ok ( LPCWSTR  string,
DWORD  cchString,
SCRIPT_CONTROL Control,
SCRIPT_STATE State,
DWORD  nItems,
const itemTest items,
BOOL  nItemsToDo,
const INT  nItemsBroken[2] 
)
inlinestatic

Definition at line 70 of file usp10.c.

74 {
75  HRESULT hr;
76  int x, outnItems;
77  SCRIPT_ITEM outpItems[15];
78  ULONG tags[15] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
79 
80  if (pScriptItemizeOpenType)
81  hr = pScriptItemizeOpenType(string, cchString, 15, Control, State, outpItems, tags, &outnItems);
82  else
83  hr = ScriptItemize(string, cchString, 15, Control, State, outpItems, &outnItems);
84 
85  winetest_ok(hr == S_OK, "ScriptItemize should return S_OK not %08x\n", hr);
86  if (nItemsBroken && (broken(nItemsBroken[0] == outnItems) || broken(nItemsBroken[1] == outnItems)))
87  {
88  winetest_win_skip("This test broken on this platform: nitems %d\n", outnItems);
89  return;
90  }
91  todo_wine_if (nItemsToDo)
92  winetest_ok(outnItems == nItems, "Wrong number of items (%u)\n", outnItems);
93  outnItems = min(outnItems, nItems);
94  for (x = 0; x <= outnItems; x++)
95  {
96  if (items[x].isBroken && broken(outpItems[x].iCharPos == items[x].broken_value[0]))
97  winetest_win_skip("This test broken on this platform: item %d CharPos %d\n", x, outpItems[x].iCharPos);
98  else todo_wine_if (items[x].todo_flag[0])
99  winetest_ok(outpItems[x].iCharPos == items[x].iCharPos, "%i:Wrong CharPos (%i)\n",x,outpItems[x].iCharPos);
100 
101  if (items[x].isBroken && broken(outpItems[x].a.fRTL== items[x].broken_value[1]))
102  winetest_win_skip("This test broken on this platform: item %d fRTL %d\n", x, outpItems[x].a.fRTL);
103  else todo_wine_if (items[x].todo_flag[1])
104  winetest_ok(outpItems[x].a.fRTL == items[x].fRTL, "%i:Wrong fRTL(%i)\n",x,outpItems[x].a.fRTL);
105 
106  if (items[x].isBroken && broken(outpItems[x].a.fLayoutRTL == items[x].broken_value[2]))
107  winetest_win_skip("This test broken on this platform: item %d fLayoutRTL %d\n", x, outpItems[x].a.fLayoutRTL);
108  else todo_wine_if (items[x].todo_flag[2])
109  winetest_ok(outpItems[x].a.fLayoutRTL == items[x].fLayoutRTL, "%i:Wrong fLayoutRTL(%i)\n",x,outpItems[x].a.fLayoutRTL);
110 
111  if (items[x].isBroken && broken(outpItems[x].a.s.uBidiLevel == items[x].broken_value[3]))
112  winetest_win_skip("This test broken on this platform: item %d BidiLevel %d\n", x, outpItems[x].a.s.uBidiLevel);
113  else todo_wine_if (items[x].todo_flag[3])
114  winetest_ok(outpItems[x].a.s.uBidiLevel == items[x].uBidiLevel, "%i:Wrong BidiLevel(%i)\n",x,outpItems[x].a.s.uBidiLevel);
115 
116  if (items[x].isBroken && broken(outpItems[x].a.s.fOverrideDirection == items[x].broken_value[4]))
117  winetest_win_skip("This test broken on this platform: item %d fOverrideDirection %d\n", x, outpItems[x].a.s.fOverrideDirection);
118  else todo_wine_if (items[x].todo_flag[4])
119  winetest_ok(outpItems[x].a.s.fOverrideDirection == items[x].fOverrideDirection, "%i:Wrong fOverrideDirection(%i)\n",x,outpItems[x].a.s.fOverrideDirection);
120 
121  if (x != outnItems)
122  winetest_ok(outpItems[x].a.eScript != SCRIPT_UNDEFINED, "%i: Undefined script\n",x);
123  if (pScriptItemizeOpenType)
124  {
125  if (items[x].isBroken && broken(tags[x] == items[x].broken_value[5]))
126  winetest_win_skip("This test broken on this platform: item %d Script Tag %x\n", x, tags[x]);
127  else todo_wine_if (items[x].todo_flag[5])
128  winetest_ok(tags[x] == items[x].scriptTag,"%i:Incorrect Script Tag %x != %x\n",x,tags[x],items[x].scriptTag);
129  }
130 
131  }
132 }
const char * tags[7 *8]
Definition: apphelp.c:214
HRESULT hr
Definition: shlfolder.c:183
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int nItems
Definition: appswitch.c:56
#define todo_wine_if(is_todo)
Definition: test.h:164
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItems, const SCRIPT_CONTROL *psControl, const SCRIPT_STATE *psState, SCRIPT_ITEM *pItems, int *pcItems)
Definition: usp10.c:1853
static const WCHAR Control[]
Definition: interface.c:27
#define broken(x)
Definition: _sntprintf.h:21
#define S_OK
Definition: intsafe.h:59
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1
void __winetest_cdecl winetest_win_skip(const char *msg,...)
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
static TCHAR * items[]
Definition: page1.c:45
#define SCRIPT_UNDEFINED
Definition: usp10.h:69

◆ _test_shape_ok()

static void _test_shape_ok ( int  valid,
HDC  hdc,
LPCWSTR  string,
DWORD  cchString,
SCRIPT_CONTROL Control,
SCRIPT_STATE State,
DWORD  item,
DWORD  nGlyphs,
const shapeTest_char charItems,
const shapeTest_glyph glyphItems,
const SCRIPT_GLYPHPROP props2 
)
inlinestatic

Definition at line 966 of file usp10.c.

972 {
973  HRESULT hr;
974  int x, outnItems = 0, outnGlyphs = 0, outnGlyphs2 = 0;
975  const SCRIPT_PROPERTIES **script_properties;
976  SCRIPT_ITEM outpItems[15];
977  SCRIPT_CACHE sc = NULL;
978  WORD *glyphs, *glyphs2;
979  WORD *logclust, *logclust2;
980  int maxGlyphs = cchString * 1.5;
981  SCRIPT_GLYPHPROP *glyphProp, *glyphProp2;
982  SCRIPT_CHARPROP *charProp, *charProp2;
983  int script_count;
984  WCHAR *string2;
985  ULONG tags[15];
986 
987  hr = ScriptGetProperties(&script_properties, &script_count);
988  winetest_ok(SUCCEEDED(hr), "Failed to get script properties, hr %#x.\n", hr);
989 
990  hr = pScriptItemizeOpenType(string, cchString, 15, Control, State, outpItems, tags, &outnItems);
991  if (valid > 0)
992  winetest_ok(hr == S_OK, "ScriptItemizeOpenType should return S_OK not %08x\n", hr);
993  else if (hr != S_OK)
994  winetest_trace("ScriptItemizeOpenType should return S_OK not %08x\n", hr);
995 
996  if (outnItems <= item)
997  {
998  if (valid > 0)
999  winetest_win_skip("Did not get enough items\n");
1000  else
1001  winetest_trace("Did not get enough items\n");
1002  return;
1003  }
1004 
1005  logclust = HeapAlloc(GetProcessHeap(), 0, sizeof(WORD) * cchString);
1006  memset(logclust,'a',sizeof(WORD) * cchString);
1007  charProp = HeapAlloc(GetProcessHeap(), 0, sizeof(SCRIPT_CHARPROP) * cchString);
1008  memset(charProp,'a',sizeof(SCRIPT_CHARPROP) * cchString);
1009  glyphs = HeapAlloc(GetProcessHeap(), 0, sizeof(WORD) * maxGlyphs);
1010  memset(glyphs,'a',sizeof(WORD) * cchString);
1011  glyphProp = HeapAlloc(GetProcessHeap(), 0, sizeof(SCRIPT_GLYPHPROP) * maxGlyphs);
1012  memset(glyphProp,'a',sizeof(SCRIPT_GLYPHPROP) * cchString);
1013 
1014  string2 = HeapAlloc(GetProcessHeap(), 0, cchString * sizeof(*string2));
1015  logclust2 = HeapAlloc(GetProcessHeap(), 0, cchString * sizeof(*logclust2));
1016  memset(logclust2, 'a', cchString * sizeof(*logclust2));
1017  charProp2 = HeapAlloc(GetProcessHeap(), 0, cchString * sizeof(*charProp2));
1018  memset(charProp2, 'a', cchString * sizeof(*charProp2));
1019  glyphs2 = HeapAlloc(GetProcessHeap(), 0, maxGlyphs * sizeof(*glyphs2));
1020  memset(glyphs2, 'a', maxGlyphs * sizeof(*glyphs2));
1021  glyphProp2 = HeapAlloc(GetProcessHeap(), 0, maxGlyphs * sizeof(*glyphProp2));
1022  memset(glyphProp2, 'a', maxGlyphs * sizeof(*glyphProp2));
1023 
1024  winetest_ok(!outpItems[item].a.fLogicalOrder, "Got unexpected fLogicalOrder %#x.\n",
1025  outpItems[item].a.fLogicalOrder);
1026  hr = pScriptShapeOpenType(hdc, &sc, &outpItems[item].a, tags[item], 0x00000000, NULL, NULL, 0, string, cchString, maxGlyphs, logclust, charProp, glyphs, glyphProp, &outnGlyphs);
1027  if (valid > 0)
1028  winetest_ok(hr == S_OK, "ScriptShapeOpenType failed (%x)\n",hr);
1029  else if (hr != S_OK)
1030  winetest_trace("ScriptShapeOpenType failed (%x)\n",hr);
1031  if (FAILED(hr))
1032  goto cleanup;
1033 
1034  for (x = 0; x < cchString; x++)
1035  {
1036  if (valid > 0)
1037  winetest_ok(logclust[x] == charItems[x].wLogClust, "%i: invalid LogClust(%i)\n",x,logclust[x]);
1038  else if (logclust[x] != charItems[x].wLogClust)
1039  winetest_trace("%i: invalid LogClust(%i)\n",x,logclust[x]);
1040  if (valid > 0)
1041  winetest_ok(charProp[x].fCanGlyphAlone == charItems[x].CharProp.fCanGlyphAlone, "%i: invalid fCanGlyphAlone\n",x);
1042  else if (charProp[x].fCanGlyphAlone != charItems[x].CharProp.fCanGlyphAlone)
1043  winetest_trace("%i: invalid fCanGlyphAlone\n",x);
1044  }
1045 
1046  if (valid > 0)
1047  winetest_ok(nGlyphs == outnGlyphs, "got incorrect number of glyphs (%i)\n",outnGlyphs);
1048  else if (nGlyphs != outnGlyphs)
1049  winetest_trace("got incorrect number of glyphs (%i)\n",outnGlyphs);
1050  for (x = 0; x < outnGlyphs; x++)
1051  {
1052  if (glyphItems[x].Glyph)
1053  {
1054  if (valid > 0)
1055  winetest_ok(glyphs[x]!=0, "%i: Glyph not present when it should be\n",x);
1056  else if (glyphs[x]==0)
1057  winetest_trace("%i: Glyph not present when it should be\n",x);
1058  }
1059  else
1060  {
1061  if (valid > 0)
1062  winetest_ok(glyphs[x]==0, "%i: Glyph present when it should not be\n",x);
1063  else if (glyphs[x]!=0)
1064  winetest_trace("%i: Glyph present when it should not be\n",x);
1065  }
1066  if (valid > 0)
1067  {
1068  todo_wine_if(tags[item] == syrc_tag && !x)
1069  winetest_ok(glyphProp[x].sva.uJustification == glyphItems[x].GlyphProp.sva.uJustification ||
1070  (props2 && glyphProp[x].sva.uJustification == props2[x].sva.uJustification),
1071  "%i: uJustification incorrect (%i)\n",x,glyphProp[x].sva.uJustification);
1072  }
1073  else if (glyphProp[x].sva.uJustification != glyphItems[x].GlyphProp.sva.uJustification)
1074  {
1075  winetest_trace("%i: uJustification incorrect (%i)\n",x,glyphProp[x].sva.uJustification);
1076  }
1077  if (valid > 0)
1078  winetest_ok(glyphProp[x].sva.fClusterStart == glyphItems[x].GlyphProp.sva.fClusterStart ||
1079  (props2 && glyphProp[x].sva.fClusterStart == props2[x].sva.fClusterStart),
1080  "%i: fClusterStart incorrect (%i)\n",x,glyphProp[x].sva.fClusterStart);
1081  else if (glyphProp[x].sva.fClusterStart != glyphItems[x].GlyphProp.sva.fClusterStart)
1082  winetest_trace("%i: fClusterStart incorrect (%i)\n",x,glyphProp[x].sva.fClusterStart);
1083  if (valid > 0)
1084  winetest_ok(glyphProp[x].sva.fDiacritic == glyphItems[x].GlyphProp.sva.fDiacritic ||
1085  (props2 && glyphProp[x].sva.fDiacritic == props2[x].sva.fDiacritic),
1086  "%i: fDiacritic incorrect (%i)\n",x,glyphProp[x].sva.fDiacritic);
1087  else if (glyphProp[x].sva.fDiacritic != glyphItems[x].GlyphProp.sva.fDiacritic)
1088  winetest_trace("%i: fDiacritic incorrect (%i)\n",x,glyphProp[x].sva.fDiacritic);
1089  if (valid > 0)
1090  winetest_ok(glyphProp[x].sva.fZeroWidth == glyphItems[x].GlyphProp.sva.fZeroWidth ||
1091  (props2 && glyphProp[x].sva.fZeroWidth == props2[x].sva.fZeroWidth),
1092  "%i: fZeroWidth incorrect (%i)\n",x,glyphProp[x].sva.fZeroWidth);
1093  else if (glyphProp[x].sva.fZeroWidth != glyphItems[x].GlyphProp.sva.fZeroWidth)
1094  winetest_trace("%i: fZeroWidth incorrect (%i)\n",x,glyphProp[x].sva.fZeroWidth);
1095  }
1096 
1097  outpItems[item].a.fLogicalOrder = 1;
1098  hr = pScriptShapeOpenType(hdc, &sc, &outpItems[item].a, tags[item], 0x00000000, NULL, NULL, 0,
1099  string, cchString, maxGlyphs, logclust2, charProp2, glyphs2, glyphProp2, &outnGlyphs2);
1100  winetest_ok(hr == S_OK, "ScriptShapeOpenType failed (%x)\n",hr);
1101  /* Cluster maps are hard. */
1102  if (tags[item] != thaa_tag && tags[item] != syrc_tag)
1103  {
1104  for (x = 0; x < cchString; ++x)
1105  {
1106  unsigned int compare_idx = outpItems[item].a.fRTL ? cchString - x - 1 : x;
1107  winetest_ok(logclust2[x] == logclust[compare_idx],
1108  "Got unexpected logclust2[%u] %#x, expected %#x.\n",
1109  x, logclust2[x], logclust[compare_idx]);
1110  winetest_ok(charProp2[x].fCanGlyphAlone == charProp[compare_idx].fCanGlyphAlone,
1111  "Got unexpected charProp2[%u].fCanGlyphAlone %#x, expected %#x.\n",
1112  x, charProp2[x].fCanGlyphAlone, charProp[compare_idx].fCanGlyphAlone);
1113  }
1114  }
1115  winetest_ok(outnGlyphs2 == outnGlyphs, "Got unexpected glyph count %u.\n", outnGlyphs2);
1116  for (x = 0; x < outnGlyphs2; ++x)
1117  {
1118  unsigned int compare_idx = outpItems[item].a.fRTL ? outnGlyphs2 - x - 1 : x;
1119  winetest_ok(glyphs2[x] == glyphs[compare_idx], "Got unexpected glyphs2[%u] %#x, expected %#x.\n",
1120  x, glyphs2[x], glyphs[compare_idx]);
1121  winetest_ok(glyphProp2[x].sva.uJustification == glyphProp[compare_idx].sva.uJustification,
1122  "Got unexpected glyphProp2[%u].sva.uJustification %#x, expected %#x.\n",
1123  x, glyphProp2[x].sva.uJustification, glyphProp[compare_idx].sva.uJustification);
1124  winetest_ok(glyphProp2[x].sva.fClusterStart == glyphProp[compare_idx].sva.fClusterStart,
1125  "Got unexpected glyphProp2[%u].sva.fClusterStart %#x, expected %#x.\n",
1126  x, glyphProp2[x].sva.fClusterStart, glyphProp[compare_idx].sva.fClusterStart);
1127  winetest_ok(glyphProp2[x].sva.fDiacritic == glyphProp[compare_idx].sva.fDiacritic,
1128  "Got unexpected glyphProp2[%u].sva.fDiacritic %#x, expected %#x.\n",
1129  x, glyphProp2[x].sva.fDiacritic, glyphProp[compare_idx].sva.fDiacritic);
1130  winetest_ok(glyphProp2[x].sva.fZeroWidth == glyphProp[compare_idx].sva.fZeroWidth,
1131  "Got unexpected glyphProp2[%u].sva.fZeroWidth %#x, expected %#x.\n",
1132  x, glyphProp2[x].sva.fZeroWidth, glyphProp[compare_idx].sva.fZeroWidth);
1133  }
1134 
1135  /* Most scripts get this wrong. For example, when the font has the
1136  * appropriate ligatures, "ttfffi" get rendered as "<ttf><ffi>", but
1137  * "<RLO>iffftt" gets rendered as "t<ft><ff>i". Arabic gets it right,
1138  * and there exist applications that depend on that. */
1139  if (tags[item] == arab_tag && broken(script_count <= 75))
1140  {
1141  winetest_win_skip("Test broken on this platform, skipping.\n");
1142  }
1143  else if (tags[item] == arab_tag)
1144  {
1145  for (x = 0; x < cchString; ++x)
1146  {
1147  string2[x] = string[cchString - x - 1];
1148  }
1149  outpItems[item].a.fLogicalOrder = 0;
1150  outpItems[item].a.fRTL = !outpItems[item].a.fRTL;
1151  hr = pScriptShapeOpenType(hdc, &sc, &outpItems[item].a, tags[item], 0x00000000, NULL, NULL, 0,
1152  string2, cchString, maxGlyphs, logclust2, charProp2, glyphs2, glyphProp2, &outnGlyphs2);
1153  winetest_ok(hr == S_OK, "ScriptShapeOpenType failed (%x)\n",hr);
1154  for (x = 0; x < cchString; ++x)
1155  {
1156  unsigned int compare_idx = cchString - x - 1;
1157  winetest_ok(logclust2[x] == logclust[compare_idx],
1158  "Got unexpected logclust2[%u] %#x, expected %#x.\n",
1159  x, logclust2[x], logclust[compare_idx]);
1160  winetest_ok(charProp2[x].fCanGlyphAlone == charProp[compare_idx].fCanGlyphAlone,
1161  "Got unexpected charProp2[%u].fCanGlyphAlone %#x, expected %#x.\n",
1162  x, charProp2[x].fCanGlyphAlone, charProp[compare_idx].fCanGlyphAlone);
1163  }
1164  winetest_ok(outnGlyphs2 == outnGlyphs, "Got unexpected glyph count %u.\n", outnGlyphs2);
1165  for (x = 0; x < outnGlyphs2; ++x)
1166  {
1167  winetest_ok(glyphs2[x] == glyphs[x], "Got unexpected glyphs2[%u] %#x, expected %#x.\n",
1168  x, glyphs2[x], glyphs[x]);
1169  winetest_ok(glyphProp2[x].sva.uJustification == glyphProp[x].sva.uJustification,
1170  "Got unexpected glyphProp2[%u].sva.uJustification %#x, expected %#x.\n",
1171  x, glyphProp2[x].sva.uJustification, glyphProp[x].sva.uJustification);
1172  winetest_ok(glyphProp2[x].sva.fClusterStart == glyphProp[x].sva.fClusterStart,
1173  "Got unexpected glyphProp2[%u].sva.fClusterStart %#x, expected %#x.\n",
1174  x, glyphProp2[x].sva.fClusterStart, glyphProp[x].sva.fClusterStart);
1175  winetest_ok(glyphProp2[x].sva.fDiacritic == glyphProp[x].sva.fDiacritic,
1176  "Got unexpected glyphProp2[%u].sva.fDiacritic %#x, expected %#x.\n",
1177  x, glyphProp2[x].sva.fDiacritic, glyphProp[x].sva.fDiacritic);
1178  winetest_ok(glyphProp2[x].sva.fZeroWidth == glyphProp[x].sva.fZeroWidth,
1179  "Got unexpected glyphProp2[%u].sva.fZeroWidth %#x, expected %#x.\n",
1180  x, glyphProp2[x].sva.fZeroWidth, glyphProp[x].sva.fZeroWidth);
1181  }
1182  outpItems[item].a.fLogicalOrder = 1;
1183  hr = pScriptShapeOpenType(hdc, &sc, &outpItems[item].a, tags[item], 0x00000000, NULL, NULL, 0,
1184  string2, cchString, maxGlyphs, logclust2, charProp2, glyphs2, glyphProp2, &outnGlyphs2);
1185  winetest_ok(hr == S_OK, "ScriptShapeOpenType failed (%x)\n",hr);
1186  for (x = 0; x < cchString; ++x)
1187  {
1188  unsigned int compare_idx = outpItems[item].a.fRTL ? x : cchString - x - 1;
1189  winetest_ok(logclust2[x] == logclust[compare_idx], "Got unexpected logclust2[%u] %#x, expected %#x.\n",
1190  x, logclust2[x], logclust[compare_idx]);
1191  winetest_ok(charProp2[x].fCanGlyphAlone == charProp[compare_idx].fCanGlyphAlone,
1192  "Got unexpected charProp2[%u].fCanGlyphAlone %#x, expected %#x.\n",
1193  x, charProp2[x].fCanGlyphAlone, charProp[compare_idx].fCanGlyphAlone);
1194  }
1195  winetest_ok(outnGlyphs2 == outnGlyphs, "Got unexpected glyph count %u.\n", outnGlyphs2);
1196  for (x = 0; x < outnGlyphs2; ++x)
1197  {
1198  unsigned int compare_idx = outpItems[item].a.fRTL ? outnGlyphs2 - x - 1 : x;
1199  winetest_ok(glyphs2[x] == glyphs[compare_idx], "Got unexpected glyphs2[%u] %#x, expected %#x.\n",
1200  x, glyphs2[x], glyphs[compare_idx]);
1201  winetest_ok(glyphProp2[x].sva.uJustification == glyphProp[compare_idx].sva.uJustification,
1202  "Got unexpected glyphProp2[%u].sva.uJustification %#x, expected %#x.\n",
1203  x, glyphProp2[x].sva.uJustification, glyphProp[compare_idx].sva.uJustification);
1204  winetest_ok(glyphProp2[x].sva.fClusterStart == glyphProp[compare_idx].sva.fClusterStart,
1205  "Got unexpected glyphProp2[%u].sva.fClusterStart %#x, expected %#x.\n",
1206  x, glyphProp2[x].sva.fClusterStart, glyphProp[compare_idx].sva.fClusterStart);
1207  winetest_ok(glyphProp2[x].sva.fDiacritic == glyphProp[compare_idx].sva.fDiacritic,
1208  "Got unexpected glyphProp2[%u].sva.fDiacritic %#x, expected %#x.\n",
1209  x, glyphProp2[x].sva.fDiacritic, glyphProp[compare_idx].sva.fDiacritic);
1210  winetest_ok(glyphProp2[x].sva.fZeroWidth == glyphProp[compare_idx].sva.fZeroWidth,
1211  "Got unexpected glyphProp2[%u].sva.fZeroWidth %#x, expected %#x.\n",
1212  x, glyphProp2[x].sva.fZeroWidth, glyphProp[compare_idx].sva.fZeroWidth);
1213  }
1214  }
1215 
1216 cleanup:
1218  HeapFree(GetProcessHeap(),0,logclust2);
1219  HeapFree(GetProcessHeap(),0,charProp2);
1220  HeapFree(GetProcessHeap(),0,glyphs2);
1221  HeapFree(GetProcessHeap(),0,glyphProp2);
1222 
1223  HeapFree(GetProcessHeap(),0,logclust);
1224  HeapFree(GetProcessHeap(),0,charProp);
1226  HeapFree(GetProcessHeap(),0,glyphProp);
1227  ScriptFreeCache(&sc);
1228 }
const char * tags[7 *8]
Definition: apphelp.c:214
HRESULT hr
Definition: shlfolder.c:183
static CHAR string2[MAX_PATH]
Definition: automation.c:468
HRESULT WINAPI ScriptGetProperties(const SCRIPT_PROPERTIES ***props, int *num)
Definition: usp10.c:1154
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static UINT UINT LPWORD glyphs
Definition: font.c:44
SCRIPT_ANALYSIS a
Definition: usp10.h:151
#define syrc_tag
Definition: usp10.c:146
#define thaa_tag
Definition: usp10.c:147
smooth NULL
Definition: ftsmooth.c:416
#define todo_wine_if(is_todo)
Definition: test.h:164
void __winetest_cdecl winetest_trace(const char *msg,...)
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
LONG HRESULT
Definition: typedefs.h:77
unsigned short WORD
Definition: ntddk_ex.h:93
HDC hdc
Definition: main.c:9
static const WCHAR Control[]
Definition: interface.c:27
#define broken(x)
Definition: _sntprintf.h:21
#define S_OK
Definition: intsafe.h:59
static ATOM item
Definition: dde.c:856
WORD fLogicalOrder
Definition: usp10.h:144
#define arab_tag
Definition: usp10.c:143
HRESULT WINAPI ScriptFreeCache(SCRIPT_CACHE *psc)
Definition: usp10.c:1080
unsigned int ULONG
Definition: retypes.h:1
void __winetest_cdecl winetest_win_skip(const char *msg,...)
char * cleanup(char *str)
Definition: wpickclick.c:99
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:402
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ create_test_window()

static HWND create_test_window ( void  )
static

Definition at line 3383 of file usp10.c.

3384 {
3385  HWND hwnd = CreateWindowExA(0, "Static", "", WS_POPUP, 0, 0, 100, 100, 0, 0, 0, NULL);
3386  ok(hwnd != NULL, "Failed to create test window.\n");
3387 
3389  UpdateWindow(hwnd);
3390 
3391  return hwnd;
3392 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI UpdateWindow(_In_ HWND)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
smooth NULL
Definition: ftsmooth.c:416
#define SW_SHOW
Definition: winuser.h:769
#define ok(value,...)
Definition: atltest.h:57
#define WS_POPUP
Definition: pedump.c:616
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)

Referenced by test_script_cache_reuse(), and test_ScriptCacheGetHeight().

◆ enum_bitmap_font_proc()

static INT CALLBACK enum_bitmap_font_proc ( const LOGFONTA lf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 2475 of file usp10.c.

2476 {
2477  struct enum_font_data *efnd = (struct enum_font_data *)lParam;
2478 
2479  if (type & (TRUETYPE_FONTTYPE | DEVICE_FONTTYPE)) return 1;
2480 
2481  if (efnd->total < MAX_ENUM_FONTS)
2482  {
2483  efnd->elf[efnd->total++] = *(ENUMLOGFONTA*)lf;
2484  }
2485  else
2486  trace("enum tests invalid; you have more than %d fonts\n", MAX_ENUM_FONTS);
2487 
2488  return 1;
2489 }
#define DEVICE_FONTTYPE
Definition: wingdi.h:1107
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
ENUMLOGFONTA elf[MAX_ENUM_FONTS]
Definition: usp10.c:2472
#define MAX_ENUM_FONTS
Definition: usp10.c:2467
#define trace
Definition: atltest.h:70
LOGFONTA * lf
Definition: font.c:2789
LPARAM lParam
Definition: combotst.c:139
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1108

Referenced by test_ScriptGetFontProperties().

◆ enum_proc()

static BOOL CALLBACK enum_proc ( LGRPID  group,
LCID  lcid,
LPSTR  locale,
LONG_PTR  lparam 
)
static

Definition at line 3640 of file usp10.c.

3641 {
3642  HRESULT hr;
3644  SCRIPT_CONTROL sc;
3645  SCRIPT_STATE ss;
3646  LCID lcid_old;
3647 
3648  if (!IsValidLocale(lcid, LCID_INSTALLED)) return TRUE;
3649 
3650  memset(&sds, 0, sizeof(sds));
3651  memset(&sc, 0, sizeof(sc));
3652  memset(&ss, 0, sizeof(ss));
3653 
3654  lcid_old = GetThreadLocale();
3655  if (!SetThreadLocale(lcid)) return TRUE;
3656 
3657  hr = ScriptRecordDigitSubstitution(lcid, &sds);
3658  ok(hr == S_OK, "ScriptRecordDigitSubstitution failed: 0x%08x\n", hr);
3659 
3660  hr = ScriptApplyDigitSubstitution(&sds, &sc, &ss);
3661  ok(hr == S_OK, "ScriptApplyDigitSubstitution failed: 0x%08x\n", hr);
3662 
3663  SetThreadLocale(lcid_old);
3664  return TRUE;
3665 }
#define TRUE
Definition: types.h:120
HRESULT WINAPI ScriptApplyDigitSubstitution(const SCRIPT_DIGITSUBSTITUTE *sds, SCRIPT_CONTROL *sc, SCRIPT_STATE *ss)
Definition: usp10.c:1275
HRESULT hr
Definition: shlfolder.c:183
DWORD LCID
Definition: nls.h:13
#define LCID_INSTALLED
Definition: winnls.h:198
BOOL WINAPI SetThreadLocale(LCID lcid)
Definition: lang.c:1468
LONG HRESULT
Definition: typedefs.h:77
BOOL WINAPI IsValidLocale(LCID lcid, DWORD flags)
Definition: lang.c:1548
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
#define ss
Definition: i386-dis.c:432
#define memset(x, y, z)
Definition: compat.h:39
HRESULT WINAPI ScriptRecordDigitSubstitution(LCID locale, SCRIPT_DIGITSUBSTITUTE *sds)
Definition: usp10.c:1209
LCID WINAPI GetThreadLocale(void)
Definition: lang.c:1449

Referenced by test_digit_substitution().

◆ enum_truetype_proc()

static INT CALLBACK enum_truetype_proc ( const LOGFONTA lf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 2491 of file usp10.c.

2492 {
2493  struct enum_font_data *efnd = (struct enum_font_data *)lParam;
2494 
2495  if (!(type & (TRUETYPE_FONTTYPE | DEVICE_FONTTYPE))) return 1;
2496 
2497  if (efnd->total < MAX_ENUM_FONTS)
2498  {
2499  efnd->elf[efnd->total++] = *(ENUMLOGFONTA*)lf;
2500  }
2501  else
2502  trace("enum tests invalid; you have more than %d fonts\n", MAX_ENUM_FONTS);
2503 
2504  return 1;
2505 }
#define DEVICE_FONTTYPE
Definition: wingdi.h:1107
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
ENUMLOGFONTA elf[MAX_ENUM_FONTS]
Definition: usp10.c:2472
#define MAX_ENUM_FONTS
Definition: usp10.c:2467
#define trace
Definition: atltest.h:70
LOGFONTA * lf
Definition: font.c:2789
LPARAM lParam
Definition: combotst.c:139
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1108

Referenced by test_ScriptGetFontProperties().

◆ enumFontProc()

static int CALLBACK enumFontProc ( const LOGFONTA lpelfe,
const TEXTMETRICA lpntme,
DWORD  FontType,
LPARAM  lParam 
)
static

Definition at line 1244 of file usp10.c.

1245 {
1246  NEWTEXTMETRICEXA *ntme = (NEWTEXTMETRICEXA*)lpntme;
1248  int idx = 0;
1249  DWORD i;
1250  DWORD mask = 0;
1251 
1252  if (FontType != TRUETYPE_FONTTYPE)
1253  return 1;
1254 
1255  i = rp->range;
1256  while (i >= sizeof(DWORD)*8)
1257  {
1258  idx++;
1259  i -= (sizeof(DWORD)*8);
1260  }
1261  if (idx > 3)
1262  return 0;
1263 
1264  mask = 1 << i;
1265 
1266  if (ntme->ntmFontSig.fsUsb[idx] & mask)
1267  {
1268  memcpy(&(rp->lf),lpelfe,sizeof(LOGFONTA));
1269  return 0;
1270  }
1271  return 1;
1272 }
#define DWORD
Definition: nt_native.h:44
LOGFONTA lf
Definition: usp10.c:1241
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLenum GLint GLuint mask
Definition: glext.h:6028
unsigned int idx
Definition: utils.c:41
FONTSIGNATURE ntmFontSig
Definition: wingdi.h:2671
BYTE range
Definition: usp10.c:1240
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
DWORD fsUsb[4]
Definition: wingdi.h:1541
LPARAM lParam
Definition: combotst.c:139
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1108

Referenced by _find_font_for_range().

◆ HRESULT()

static HRESULT ( WINAPI pScriptItemizeOpenType) const
static

◆ init_tests()

static void init_tests ( void  )
static

Definition at line 4177 of file usp10.c.

4178 {
4179  HMODULE module = GetModuleHandleA("usp10.dll");
4180 
4181  ok(module != 0, "Expected usp10.dll to be loaded.\n");
4182 
4183  pScriptItemizeOpenType = (void *)GetProcAddress(module, "ScriptItemizeOpenType");
4184  pScriptShapeOpenType = (void *)GetProcAddress(module, "ScriptShapeOpenType");
4185  pScriptGetFontScriptTags = (void *)GetProcAddress(module, "ScriptGetFontScriptTags");
4186  pScriptGetFontLanguageTags = (void *)GetProcAddress(module, "ScriptGetFontLanguageTags");
4187  pScriptGetFontFeatureTags = (void *)GetProcAddress(module, "ScriptGetFontFeatureTags");
4188 }
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define ok(value,...)
Definition: atltest.h:57
#define GetProcAddress(x, y)
Definition: compat.h:418

Referenced by START_TEST().

◆ make_surrogate()

static void make_surrogate ( DWORD  i,
WORD  out[2] 
)
static

Definition at line 925 of file usp10.c.

926 {
927  static const DWORD mask = (1 << 10) - 1;
928 
929  if (i <= 0xffff)
930  {
931  out[0] = i;
932  out[1] = 0;
933  }
934  else
935  {
936  i -= 0x010000;
937  out[0] = ((i >> 10) & mask) + 0xd800;
938  out[1] = (i & mask) + 0xdc00;
939  }
940 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLenum GLint GLuint mask
Definition: glext.h:6028
static FILE * out
Definition: regtests2xml.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95

Referenced by test_ScriptItemize_surrogates().

◆ START_TEST()

START_TEST ( usp10  )

Definition at line 4190 of file usp10.c.

4191 {
4192  HWND hwnd;
4193  HDC hdc;
4194  LOGFONTA lf;
4195  HFONT hfont;
4196 
4197  unsigned short pwOutGlyphs[256];
4198 
4199  /* We need a valid HDC to drive a lot of Script functions which requires the following *
4200  * to set up for the tests. */
4201  hwnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,
4202  0, 0, 0, NULL);
4203  assert(hwnd != 0);
4205  UpdateWindow(hwnd);
4206 
4207  hdc = GetDC(hwnd); /* We now have a hdc */
4208  ok( hdc != NULL, "HDC failed to be created %p\n", hdc);
4209 
4210  memset(&lf, 0, sizeof(LOGFONTA));
4211  lstrcpyA(lf.lfFaceName, "Tahoma");
4212  lf.lfHeight = 10;
4213  lf.lfWeight = 3;
4214  lf.lfWidth = 10;
4215 
4217  ok(hfont != NULL, "SelectObject failed: %p\n", hfont);
4218 
4219  init_tests();
4220 
4230 
4235  test_ScriptXtoX();
4239 
4243  test_ScriptBreak();
4244  test_newlines();
4245 
4248 
4251 
4252  ReleaseDC(hwnd, hdc);
4254 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static void test_ScriptGetCMap(HDC hdc, unsigned short pwOutGlyphs[256])
Definition: usp10.c:2369
HDC WINAPI GetDC(_In_opt_ HWND)
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
static void init_tests(void)
Definition: usp10.c:4177
static void test_ScriptBreak(void)
Definition: usp10.c:3718
static HDC
Definition: imagelist.c:92
BOOL WINAPI UpdateWindow(_In_ HWND)
static void test_digit_substitution(void)
Definition: usp10.c:3667
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define assert(x)
Definition: debug.h:53
static void test_ScriptShapeOpenType(HDC hdc)
Definition: usp10.c:1357
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
static void test_ScriptGetFontFunctions(HDC hdc)
Definition: usp10.c:3812
BOOL WINAPI DestroyWindow(_In_ HWND)
static void test_ScriptItemize_surrogates(void)
Definition: usp10.c:942
static void test_ScriptTextOut2(HDC hdc)
Definition: usp10.c:2780
static void test_ScriptString(HDC hdc)
Definition: usp10.c:3168
static void test_ScriptPlace(HDC hdc)
Definition: usp10.c:2093
LONG lfHeight
Definition: dimm.idl:42
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
LONG lfWeight
Definition: dimm.idl:46
smooth NULL
Definition: ftsmooth.c:416
static void test_newlines(void)
Definition: usp10.c:3775
#define SW_SHOW
Definition: winuser.h:769
static HFONT hfont
LOGFONTA * lf
Definition: font.c:2789
LONG lfWidth
Definition: dimm.idl:43
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
HDC hdc
Definition: main.c:9
static void test_ScriptShape(HDC hdc)
Definition: usp10.c:1833
static void test_ScriptString_pSize(HDC hdc)
Definition: usp10.c:4041
static void test_ScriptCacheGetHeight(HDC hdc)
Definition: usp10.c:3394
static void test_ScriptGetGlyphABCWidth(HDC hdc)
Definition: usp10.c:3466
static void test_script_cache_reuse(void)
Definition: usp10.c:4071
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD SCRIPT_CHARPROP WORD * pwOutGlyphs
Definition: usp10.c:64
static void test_ScriptGetFontProperties(HDC hdc)
Definition: usp10.c:2507
static void test_ScriptTextOut(HDC hdc)
Definition: usp10.c:2694
static void test_ScriptXtoX(void)
Definition: usp10.c:3037
#define ok(value,...)
Definition: atltest.h:57
#define WS_POPUP
Definition: pedump.c:616
static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256])
Definition: usp10.c:2221
static void test_ScriptGetLogicalWidths(void)
Definition: usp10.c:3951
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
static void test_ScriptTextOut3(HDC hdc)
Definition: usp10.c:2847
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
static void test_ScriptIsComplex(void)
Definition: usp10.c:3979
static void test_ScriptItemize(void)
Definition: usp10.c:180
static void test_ScriptStringXtoCP_CPtoX(HDC hdc)
Definition: usp10.c:3237
static void test_ScriptGetProperties(void)
Definition: usp10.c:3699
static void test_ScriptLayout(void)
Definition: usp10.c:3544
#define memset(x, y, z)
Definition: compat.h:39

◆ test_digit_substitution()

static void test_digit_substitution ( void  )
static

Definition at line 3667 of file usp10.c.

3668 {
3669  BOOL ret;
3670  unsigned int i;
3671  static const LGRPID groups[] =
3672  {
3675  LGRPID_BALTIC,
3676  LGRPID_GREEK,
3680  LGRPID_KOREAN,
3683  LGRPID_THAI,
3684  LGRPID_HEBREW,
3685  LGRPID_ARABIC,
3687  LGRPID_INDIC,
3690  };
3691 
3692  for (i = 0; i < ARRAY_SIZE(groups); ++i)
3693  {
3695  ok(ret, "EnumLanguageGroupLocalesA failed unexpectedly: %u\n", GetLastError());
3696  }
3697 }
#define LGRPID_KOREAN
Definition: winnls.h:464
DWORD LGRPID
Definition: winnls.h:517
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define LGRPID_ARABIC
Definition: winnls.h:469
#define LGRPID_TURKISH
Definition: winnls.h:462
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define LGRPID_VIETNAMESE
Definition: winnls.h:470
GLsizei GLuint * groups
Definition: glext.h:11113
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL CALLBACK enum_proc(LGRPID group, LCID lcid, LPSTR locale, LONG_PTR lparam)
Definition: usp10.c:3640
#define LGRPID_HEBREW
Definition: winnls.h:468
#define LGRPID_INDIC
Definition: winnls.h:471
int ret
#define LGRPID_CENTRAL_EUROPE
Definition: winnls.h:458
#define LGRPID_SIMPLIFIED_CHINESE
Definition: winnls.h:466
#define LGRPID_TRADITIONAL_CHINESE
Definition: winnls.h:465
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
#define LGRPID_CYRILLIC
Definition: winnls.h:461
#define LGRPID_GREEK
Definition: winnls.h:460
#define LGRPID_JAPANESE
Definition: winnls.h:463
#define LGRPID_BALTIC
Definition: winnls.h:459
#define LGRPID_GEORGIAN
Definition: winnls.h:472
#define LGRPID_THAI
Definition: winnls.h:467
#define LGRPID_WESTERN_EUROPE
Definition: winnls.h:457
BOOL WINAPI EnumLanguageGroupLocalesA(LANGGROUPLOCALE_ENUMPROCA pLangGrpLcEnumProc, LGRPID lgrpid, DWORD dwFlags, LONG_PTR lParam)
Definition: lang.c:3115
#define LGRPID_ARMENIAN
Definition: winnls.h:473

Referenced by START_TEST().

◆ test_newlines()

static void test_newlines ( void  )
static

Definition at line 3775 of file usp10.c.

3776 {
3777  static const WCHAR test1[] = {'t','e','x','t','\r','t','e','x','t',0};
3778  static const WCHAR test2[] = {'t','e','x','t','\n','t','e','x','t',0};
3779  static const WCHAR test3[] = {'t','e','x','t','\r','\n','t','e','x','t',0};
3780  static const WCHAR test4[] = {'t','e','x','t','\n','\r','t','e','x','t',0};
3781  static const WCHAR test5[] = {'1','2','3','4','\n','\r','1','2','3','4',0};
3782  SCRIPT_ITEM items[5];
3783  HRESULT hr;
3784  int count;
3785 
3786  count = 0;
3788  ok(hr == S_OK, "ScriptItemize failed: 0x%08x\n", hr);
3789  ok(count == 3, "got %d expected 3\n", count);
3790 
3791  count = 0;
3793  ok(hr == S_OK, "ScriptItemize failed: 0x%08x\n", hr);
3794  ok(count == 3, "got %d expected 3\n", count);
3795 
3796  count = 0;
3798  ok(hr == S_OK, "ScriptItemize failed: 0x%08x\n", hr);
3799  ok(count == 4, "got %d expected 4\n", count);
3800 
3801  count = 0;
3803  ok(hr == S_OK, "ScriptItemize failed: 0x%08x\n", hr);
3804  ok(count == 4, "got %d expected 4\n", count);
3805 
3806  count = 0;
3808  ok(hr == S_OK, "ScriptItemize failed: 0x%08x\n", hr);
3809  ok(count == 4, "got %d expected 4\n", count);
3810 }
HRESULT hr
Definition: shlfolder.c:183
void test3(void)
Definition: hivetest.c:423
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define lstrlenW
Definition: compat.h:415
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
void test1(void)
Definition: hivetest.c:366
HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItems, const SCRIPT_CONTROL *psControl, const SCRIPT_STATE *psState, SCRIPT_ITEM *pItems, int *pcItems)
Definition: usp10.c:1853
void test2(void)
Definition: regtest.c:173
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
void test5(void)
Definition: hivetest.c:623
static TCHAR * items[]
Definition: page1.c:45
void test4(void)
Definition: hivetest.c:461

Referenced by START_TEST().

◆ test_script_cache_reuse()

static void test_script_cache_reuse ( void  )
static

Definition at line 4071 of file usp10.c.

4072 {
4073  HRESULT hr;
4074  HWND hwnd1, hwnd2;
4075  HDC hdc1, hdc2;
4076  LOGFONTA lf;
4077  HFONT hfont1, hfont2;
4078  HFONT prev_hfont1, prev_hfont2;
4079  SCRIPT_CACHE sc = NULL;
4080  SCRIPT_CACHE sc2;
4081  LONG height;
4082 
4083  hwnd1 = create_test_window();
4084  hwnd2 = create_test_window();
4085 
4086  hdc1 = GetDC(hwnd1);
4087  hdc2 = GetDC(hwnd2);
4088  ok(hdc1 != NULL && hdc2 != NULL, "Failed to get window dc.\n");
4089 
4090  memset(&lf, 0, sizeof(LOGFONTA));
4091  lstrcpyA(lf.lfFaceName, "Tahoma");
4092 
4093  lf.lfHeight = 10;
4094  hfont1 = CreateFontIndirectA(&lf);
4095  ok(hfont1 != NULL, "CreateFontIndirectA failed\n");
4096  hfont2 = CreateFontIndirectA(&lf);
4097  ok(hfont2 != NULL, "CreateFontIndirectA failed\n");
4098  ok(hfont1 != hfont2, "Expected fonts %p and %p to differ\n", hfont1, hfont2);
4099 
4100  prev_hfont1 = SelectObject(hdc1, hfont1);
4101  ok(prev_hfont1 != NULL, "SelectObject failed: %p\n", prev_hfont1);
4102  prev_hfont2 = SelectObject(hdc2, hfont1);
4103  ok(prev_hfont2 != NULL, "SelectObject failed: %p\n", prev_hfont2);
4104 
4105  /* Get a script cache */
4106  hr = ScriptCacheGetHeight(hdc1, &sc, &height);
4107  ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
4108  ok(sc != NULL, "Script cache is NULL\n");
4109 
4110  /* Same font, same DC -> same SCRIPT_CACHE */
4111  sc2 = NULL;
4112  hr = ScriptCacheGetHeight(hdc1, &sc2, &height);
4113  ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
4114  ok(sc2 != NULL, "Script cache is NULL\n");
4115  ok(sc == sc2, "Expected caches %p, %p to be identical\n", sc, sc2);
4116  ScriptFreeCache(&sc2);
4117 
4118  /* Same font in different DC -> same SCRIPT_CACHE */
4119  sc2 = NULL;
4120  hr = ScriptCacheGetHeight(hdc2, &sc2, &height);
4121  ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
4122  ok(sc2 != NULL, "Script cache is NULL\n");
4123  ok(sc == sc2, "Expected caches %p, %p to be identical\n", sc, sc2);
4124  ScriptFreeCache(&sc2);
4125 
4126  /* Same font face & size, but different font handle */
4127  ok(SelectObject(hdc1, hfont2) != NULL, "SelectObject failed\n");
4128  ok(SelectObject(hdc2, hfont2) != NULL, "SelectObject failed\n");
4129 
4130  sc2 = NULL;
4131  hr = ScriptCacheGetHeight(hdc1, &sc2, &height);
4132  ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
4133  ok(sc2 != NULL, "Script cache is NULL\n");
4134  ok(sc == sc2, "Expected caches %p, %p to be identical\n", sc, sc2);
4135  ScriptFreeCache(&sc2);
4136 
4137  sc2 = NULL;
4138  hr = ScriptCacheGetHeight(hdc2, &sc2, &height);
4139  ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
4140  ok(sc2 != NULL, "Script cache is NULL\n");
4141  ok(sc == sc2, "Expected caches %p, %p to be identical\n", sc, sc2);
4142  ScriptFreeCache(&sc2);
4143 
4144  /* Different font size -- now we get a different SCRIPT_CACHE */
4145  SelectObject(hdc1, prev_hfont1);
4146  SelectObject(hdc2, prev_hfont2);
4147  DeleteObject(hfont2);
4148  lf.lfHeight = 20;
4149  hfont2 = CreateFontIndirectA(&lf);
4150  ok(hfont2 != NULL, "CreateFontIndirectA failed\n");
4151  ok(SelectObject(hdc1, hfont2) != NULL, "SelectObject failed\n");
4152  ok(SelectObject(hdc2, hfont2) != NULL, "SelectObject failed\n");
4153 
4154  sc2 = NULL;
4155  hr = ScriptCacheGetHeight(hdc1, &sc2, &height);
4156  ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
4157  ok(sc2 != NULL, "Script cache is NULL\n");
4158  ok(sc != sc2, "Expected caches %p, %p to be different\n", sc, sc2);
4159  ScriptFreeCache(&sc2);
4160 
4161  sc2 = NULL;
4162  hr = ScriptCacheGetHeight(hdc2, &sc2, &height);
4163  ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
4164  ok(sc2 != NULL, "Script cache is NULL\n");
4165  ok(sc != sc2, "Expected caches %p, %p to be different\n", sc, sc2);
4166  ScriptFreeCache(&sc2);
4167 
4168  ScriptFreeCache(&sc);
4169  SelectObject(hdc1, prev_hfont1);
4170  SelectObject(hdc2, prev_hfont2);
4171  DeleteObject(hfont1);
4172  DeleteObject(hfont2);
4173  DestroyWindow(hwnd1);
4174  DestroyWindow(hwnd2);
4175 }
HRESULT hr
Definition: shlfolder.c:183
HDC WINAPI GetDC(_In_opt_ HWND)
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI DestroyWindow(_In_ HWND)
HDC hdc2
Definition: SelectObject.c:10
long LONG
Definition: pedump.c:60
LONG lfHeight
Definition: dimm.idl:42
smooth NULL
Definition: ftsmooth.c:416
HDC hdc1
Definition: SelectObject.c:10
LONG HRESULT
Definition: typedefs.h:77
LOGFONTA * lf
Definition: font.c:2789
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static HWND create_test_window(void)
Definition: usp10.c:3383
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HRESULT WINAPI ScriptFreeCache(SCRIPT_CACHE *psc)
Definition: usp10.c:1080
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
#define memset(x, y, z)
Definition: compat.h:39
HRESULT WINAPI ScriptCacheGetHeight(HDC hdc, SCRIPT_CACHE *psc, LONG *height)
Definition: usp10.c:3680

Referenced by START_TEST().

◆ test_ScriptBreak()

static void test_ScriptBreak ( void  )
static

Definition at line 3718 of file usp10.c.

3719 {
3720  static const WCHAR test[] = {' ','\r','\n',0};
3721  SCRIPT_ITEM items[4];
3722  SCRIPT_LOGATTR la;
3723  HRESULT hr;
3724 
3725  hr = ScriptItemize(test, 3, 4, NULL, NULL, items, NULL);
3726  ok(hr == S_OK, "ScriptItemize should return S_OK not %08x\n", hr);
3727 
3728  /*
3729  * This Test crashes pre Vista.
3730 
3731  hr = ScriptBreak(test, 1, &items[0].a, NULL);
3732  ok(hr == E_INVALIDARG, "ScriptBreak should return E_INVALIDARG not %08x\n", hr);
3733  */
3734 
3735  hr = ScriptBreak(test, 0, &items[0].a, &la);
3736  ok(hr == E_FAIL || broken(hr == S_OK), "ScriptBreak should return E_FAIL not %08x\n", hr);
3737 
3738  hr = ScriptBreak(test, -1, &items[0].a, &la);
3739  ok(hr == E_INVALIDARG || broken(hr == S_OK), "ScriptBreak should return E_INVALIDARG not %08x\n", hr);
3740 
3741  memset(&la, 0, sizeof(la));
3742  hr = ScriptBreak(test, 1, &items[0].a, &la);
3743  ok(hr == S_OK, "ScriptBreak should return S_OK not %08x\n", hr);
3744 
3745  ok(!la.fSoftBreak, "fSoftBreak set\n");
3746  ok(la.fWhiteSpace, "fWhiteSpace not set\n");
3747  ok(la.fCharStop, "fCharStop not set\n");
3748  ok(!la.fWordStop, "fWordStop set\n");
3749  ok(!la.fInvalid, "fInvalid set\n");
3750  ok(!la.fReserved, "fReserved set\n");
3751 
3752  memset(&la, 0, sizeof(la));
3753  hr = ScriptBreak(test + 1, 1, &items[1].a, &la);
3754  ok(hr == S_OK, "ScriptBreak should return S_OK not %08x\n", hr);
3755 
3756  ok(!la.fSoftBreak, "fSoftBreak set\n");
3757  ok(!la.fWhiteSpace, "fWhiteSpace set\n");
3758  ok(la.fCharStop, "fCharStop not set\n");
3759  ok(!la.fWordStop, "fWordStop set\n");
3760  ok(!la.fInvalid, "fInvalid set\n");
3761  ok(!la.fReserved, "fReserved set\n");
3762 
3763  memset(&la, 0, sizeof(la));
3764  hr = ScriptBreak(test + 2, 1, &items[2].a, &la);
3765  ok(hr == S_OK, "ScriptBreak should return S_OK not %08x\n", hr);
3766 
3767  ok(!la.fSoftBreak, "fSoftBreak set\n");
3768  ok(!la.fWhiteSpace, "fWhiteSpace set\n");
3769  ok(la.fCharStop, "fCharStop not set\n");
3770  ok(!la.fWordStop, "fWordStop set\n");
3771  ok(!la.fInvalid, "fInvalid set\n");
3772  ok(!la.fReserved, "fReserved set\n");
3773 }
HRESULT hr
Definition: shlfolder.c:183
#define test
Definition: rosglue.h:37
#define E_FAIL
Definition: ddrawi.h:102
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItems, const SCRIPT_CONTROL *psControl, const SCRIPT_STATE *psState, SCRIPT_ITEM *pItems, int *pcItems)
Definition: usp10.c:1853
#define broken(x)
Definition: _sntprintf.h:21
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
BYTE fWhiteSpace
Definition: usp10.h:188
HRESULT WINAPI ScriptBreak(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT_LOGATTR *la)
Definition: usp10.c:3047
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
static TCHAR * items[]
Definition: page1.c:45
#define memset(x, y, z)
Definition: compat.h:39

Referenced by START_TEST().

◆ test_ScriptCacheGetHeight()

static void test_ScriptCacheGetHeight ( HDC  hdc)
static

Definition at line 3394 of file usp10.c.

3395 {
3396  HFONT hfont, prev_hfont;
3397  SCRIPT_CACHE sc = NULL;
3398  LONG height, height2;
3399  TEXTMETRICW tm;
3400  LOGFONTA lf;
3401  HRESULT hr;
3402  HWND hwnd;
3403  HDC hdc2;
3404 
3406  ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);
3407 
3408  hr = ScriptCacheGetHeight(NULL, &sc, NULL);
3409  ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);
3410 
3411  hr = ScriptCacheGetHeight(NULL, &sc, &height);
3412  ok(hr == E_PENDING, "expected E_PENDING, got 0x%08x\n", hr);
3413 
3414  height = 123;
3416  ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
3417  ok(height == 123, "Unexpected height.\n");
3418 
3419  memset(&tm, 0, sizeof(tm));
3420  GetTextMetricsW(hdc, &tm);
3421  ok(tm.tmHeight > 0, "Unexpected tmHeight %u.\n", tm.tmHeight);
3422 
3423  height = 0;
3424  hr = ScriptCacheGetHeight(hdc, &sc, &height);
3425  ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
3426  ok(height == tm.tmHeight, "expected height > 0\n");
3427 
3428  /* Try again with NULL dc. */
3429  height2 = 0;
3430  hr = ScriptCacheGetHeight(NULL, &sc, &height2);
3431  ok(hr == S_OK, "Failed to get cached height, hr %#x.\n", hr);
3432  ok(height2 == height, "Unexpected height %u.\n", height2);
3433 
3435 
3436  hdc2 = GetDC(hwnd);
3437  ok(hdc2 != NULL, "Failed to get window dc.\n");
3438 
3439  memset(&lf, 0, sizeof(LOGFONTA));
3440  lstrcpyA(lf.lfFaceName, "Tahoma");
3441  lf.lfHeight = -32;
3442 
3444  ok(hfont != NULL, "Failed to create font.\n");
3445 
3446  prev_hfont = SelectObject(hdc2, hfont);
3447 
3448  memset(&tm, 0, sizeof(tm));
3449  GetTextMetricsW(hdc2, &tm);
3450  ok(tm.tmHeight > height, "Unexpected tmHeight %u.\n", tm.tmHeight);
3451 
3452  height2 = 0;
3453  hr = ScriptCacheGetHeight(hdc2, &sc, &height2);
3454  ok(hr == S_OK, "Failed to get cached height, hr %#x.\n", hr);
3455  ok(height2 == height, "Unexpected height.\n");
3456 
3457  SelectObject(hdc2, prev_hfont);
3459 
3460  ReleaseDC(hwnd, hdc2);
3462 
3463  ScriptFreeCache(&sc);
3464 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
HRESULT hr
Definition: shlfolder.c:183
HDC WINAPI GetDC(_In_opt_ HWND)
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI DestroyWindow(_In_ HWND)
HDC hdc2
Definition: SelectObject.c:10
long LONG
Definition: pedump.c:60
LONG lfHeight
Definition: dimm.idl:42
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static HFONT hfont
LONG HRESULT
Definition: typedefs.h:77
LOGFONTA * lf
Definition: font.c:2789
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
HDC hdc
Definition: main.c:9
Definition: time.h:76
static HWND create_test_window(void)
Definition: usp10.c:3383
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HRESULT WINAPI ScriptFreeCache(SCRIPT_CACHE *psc)
Definition: usp10.c:1080
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
#define E_PENDING
Definition: dinput.h:172
#define memset(x, y, z)
Definition: compat.h:39
HRESULT WINAPI ScriptCacheGetHeight(HDC hdc, SCRIPT_CACHE *psc, LONG *height)
Definition: usp10.c:3680

Referenced by START_TEST().

◆ test_ScriptGetCMap()

static void test_ScriptGetCMap ( HDC  hdc,
unsigned short  pwOutGlyphs[256] 
)
static

Definition at line 2369 of file usp10.c.

2370 {
2371  HRESULT hr;
2372  SCRIPT_CACHE psc = NULL;
2373  int cInChars;
2374  int cChars;
2375  unsigned short pwOutGlyphs2[256];
2376  unsigned short pwOutGlyphs3[256];
2377  DWORD dwFlags;
2378  int cnt;
2379 
2380  static const WCHAR TestItem1[] = {'T', 'e', 's', 't', 'a', 0};
2381  static const WCHAR TestItem2[] = {0x202B, 'i', 'n', 0x202C,0};
2382  static const WCHAR TestItem3[] = {'a','b','c','d','(','<','{','[',0x2039,0};
2383  static const WCHAR TestItem3b[] = {'a','b','c','d',')','>','}',']',0x203A,0};
2384 
2385  /* Check to make sure that SCRIPT_CACHE gets allocated ok */
2386  dwFlags = 0;
2387  cInChars = cChars = 5;
2388  /* Some sanity checks for ScriptGetCMap */
2389 
2390  hr = ScriptGetCMap(NULL, NULL, NULL, 0, 0, NULL);
2391  ok( hr == E_INVALIDARG, "(NULL,NULL,NULL,0,0,NULL), "
2392  "expected E_INVALIDARG, got %08x\n", hr);
2393 
2394  hr = ScriptGetCMap(NULL, NULL, TestItem1, cInChars, dwFlags, pwOutGlyphs3);
2395  ok( hr == E_INVALIDARG, "(NULL,NULL,TestItem1, cInChars, dwFlags, pwOutGlyphs3), "
2396  "expected E_INVALIDARG, got %08x\n", hr);
2397 
2398  /* Set psc to NULL, to be able to check if a pointer is returned in psc */
2399  psc = NULL;
2400  hr = ScriptGetCMap(NULL, &psc, TestItem1, cInChars, 0, pwOutGlyphs3);
2401  ok( hr == E_PENDING, "(NULL,&psc,NULL,0,0,NULL), expected E_PENDING, "
2402  "got %08x\n", hr);
2403  ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
2404 
2405  /* Set psc to NULL but add hdc, to be able to check if a pointer is returned in psc */
2406  psc = NULL;
2407  hr = ScriptGetCMap(hdc, &psc, TestItem1, cInChars, 0, pwOutGlyphs3);
2408  ok( hr == S_OK, "ScriptGetCMap(NULL,&psc,NULL,0,0,NULL), expected S_OK, "
2409  "got %08x\n", hr);
2410  ok( psc != NULL, "ScriptGetCMap expected psc to be not NULL\n");
2411  ScriptFreeCache( &psc);
2412 
2413  /* Set psc to NULL, to be able to check if a pointer is returned in psc */
2414  psc = NULL;
2415  hr = ScriptGetCMap(NULL, &psc, TestItem1, cInChars, dwFlags, pwOutGlyphs3);
2416  ok( hr == E_PENDING, "(NULL,&psc,), expected E_PENDING, got %08x\n", hr);
2417  ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
2418  /* Check to see if the results are the same as those returned by ScriptShape */
2419  hr = ScriptGetCMap(hdc, &psc, TestItem1, cInChars, dwFlags, pwOutGlyphs3);
2420  ok (hr == S_OK, "ScriptGetCMap should return S_OK not (%08x)\n", hr);
2421  ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2422  for (cnt=0; cnt < cChars && pwOutGlyphs[cnt] == pwOutGlyphs3[cnt]; cnt++) {}
2423  ok (cnt == cInChars, "Translation not correct. WCHAR %d - %04x != %04x\n",
2424  cnt, pwOutGlyphs[cnt], pwOutGlyphs3[cnt]);
2425 
2426  ScriptFreeCache( &psc);
2427  ok (!psc, "psc is not null after ScriptFreeCache\n");
2428 
2429  /* ScriptGetCMap returns whatever font defines, no special treatment for control chars */
2430  cInChars = cChars = 4;
2431  GetGlyphIndicesW(hdc, TestItem2, cInChars, pwOutGlyphs2, 0);
2432 
2433  hr = ScriptGetCMap(hdc, &psc, TestItem2, cInChars, dwFlags, pwOutGlyphs3);
2434  if (pwOutGlyphs3[0] == 0 || pwOutGlyphs3[3] == 0)
2435  ok(hr == S_FALSE, "ScriptGetCMap should return S_FALSE not (%08x)\n", hr);
2436  else
2437  ok(hr == S_OK, "ScriptGetCMap should return S_OK not (%08x)\n", hr);
2438 
2439  ok(psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2440  ok(pwOutGlyphs3[0] == pwOutGlyphs2[0], "expected glyph %d, got %d\n", pwOutGlyphs2[0], pwOutGlyphs3[0]);
2441  ok(pwOutGlyphs3[3] == pwOutGlyphs2[3], "expected glyph %d, got %d\n", pwOutGlyphs2[3], pwOutGlyphs3[3]);
2442 
2443  cInChars = cChars = 9;
2444  hr = ScriptGetCMap(hdc, &psc, TestItem3b, cInChars, dwFlags, pwOutGlyphs2);
2445  ok (hr == S_OK, "ScriptGetCMap should return S_OK not (%08x)\n", hr);
2446  ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2447 
2448  cInChars = cChars = 9;
2449  dwFlags = SGCM_RTL;
2450  hr = ScriptGetCMap(hdc, &psc, TestItem3, cInChars, dwFlags, pwOutGlyphs3);
2451  ok (hr == S_OK, "ScriptGetCMap should return S_OK not (%08x)\n", hr);
2452  ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");
2453  ok(pwOutGlyphs3[0] == pwOutGlyphs2[0], "glyph incorrectly altered\n");
2454  ok(pwOutGlyphs3[1] == pwOutGlyphs2[1], "glyph incorrectly altered\n");
2455  ok(pwOutGlyphs3[2] == pwOutGlyphs2[2], "glyph incorrectly altered\n");
2456  ok(pwOutGlyphs3[3] == pwOutGlyphs2[3], "glyph incorrectly altered\n");
2457  ok(pwOutGlyphs3[4] == pwOutGlyphs2[4], "glyph not mirrored correctly\n");
2458  ok(pwOutGlyphs3[5] == pwOutGlyphs2[5], "glyph not mirrored correctly\n");
2459  ok(pwOutGlyphs3[6] == pwOutGlyphs2[6], "glyph not mirrored correctly\n");
2460  ok(pwOutGlyphs3[7] == pwOutGlyphs2[7], "glyph not mirrored correctly\n");
2461  ok(pwOutGlyphs3[8] == pwOutGlyphs2[8], "glyph not mirrored correctly\n");
2462 
2463  ScriptFreeCache( &psc);
2464  ok (!psc, "psc is not null after ScriptFreeCache\n");
2465 }
HRESULT hr
Definition: shlfolder.c:183
static int cInChars
Definition: usp10.c:62
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int cChars
Definition: usp10.c:64
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC hdc
Definition: main.c:9
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define SGCM_RTL
Definition: usp10.h:61
HRESULT WINAPI ScriptGetCMap(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcInChars, int cChars, DWORD dwFlags, WORD *pwOutGlyphs)
Definition: usp10.c:3554
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD SCRIPT_CHARPROP WORD * pwOutGlyphs
Definition: usp10.c:64
#define S_OK
Definition: intsafe.h:59
static SCRIPT_CACHE * psc
Definition: usp10.c:64
#define ok(value,...)
Definition: atltest.h:57
DWORD WINAPI GetGlyphIndicesW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpstr, _In_ int c, _Out_writes_(c) LPWORD pgi, _In_ DWORD fl)
HRESULT WINAPI ScriptFreeCache(SCRIPT_CACHE *psc)
Definition: usp10.c:1080
#define E_PENDING
Definition: dinput.h:172

Referenced by START_TEST().

◆ test_ScriptGetFontFunctions()

static void test_ScriptGetFontFunctions ( HDC  hdc)
static

Definition at line 3812 of file usp10.c.

3813 {
3814  static const WCHAR test_phagspa[] = {0xa84f, 0xa861, 0xa843, 0x0020, 0xa863, 0xa861, 0xa859,
3815  0x0020, 0xa850, 0xa85c, 0xa85e};
3816  SCRIPT_CONTROL control;
3817  SCRIPT_CACHE sc = NULL;
3818  SCRIPT_ITEM items[15];
3819  OPENTYPE_TAG tags[5];
3821  int count = 0;
3822  HRESULT hr;
3823 
3824  if (!pScriptGetFontScriptTags || !pScriptGetFontLanguageTags || !pScriptGetFontFeatureTags)
3825  {
3826  win_skip("ScriptGetFontScriptTags, ScriptGetFontLanguageTags or "
3827  "ScriptGetFontFeatureTags not available on this platform.\n");
3828  return;
3829  }
3830 
3831  hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, NULL, NULL);
3832  ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
3833  ok(!sc, "Got unexpected script cache %p.\n", sc);
3834  hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, NULL, &count);
3835  ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
3836  ok(!sc, "Got unexpected script cache %p.\n", sc);
3837  hr = pScriptGetFontScriptTags(hdc, &sc, NULL, ARRAY_SIZE(tags), tags, NULL);
3838  ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
3839  ok(!sc, "Got unexpected script cache %p.\n", sc);
3840  hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, tags, &count);
3841  ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
3842  ok(!sc, "Got unexpected script cache %p.\n", sc);
3843  hr = pScriptGetFontScriptTags(NULL, &sc, NULL, ARRAY_SIZE(tags), tags, &count);
3844  ok(hr == E_PENDING, "Got unexpected hr %#x.\n", hr);
3845  ok(!sc, "Got unexpected script cache %p.\n", sc);
3846  hr = pScriptGetFontScriptTags(hdc, &sc, NULL, ARRAY_SIZE(tags), tags, &count);
3847  ok(hr == S_OK || hr == E_OUTOFMEMORY, "Got unexpected hr %#x.\n", hr);
3848  if (hr == S_OK)
3849  ok(count <= 5, "Got unexpected count %d.\n", count);
3850  else
3851  ok(!count, "Got unexpected count %d.\n", count);
3852  ok(!!sc, "Got unexpected script cache %p.\n", sc);
3853 
3854  ScriptFreeCache(&sc);
3855  sc = NULL;
3856 
3857  hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, NULL, NULL);
3858  ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
3859  ok(!sc, "Got unexpected script cache %p.\n", sc);
3860  hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, NULL, &count);
3861  ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
3862  ok(!sc, "Got unexpected script cache %p.\n", sc);
3863  hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, ARRAY_SIZE(tags), tags, NULL);
3864  ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
3865  ok(!sc, "Got unexpected script cache %p.\n", sc);
3866  hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, tags, &count);
3867  ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
3868  ok(!sc, "Got unexpected script cache %p.\n", sc);
3869  hr = pScriptGetFontLanguageTags(NULL, &sc, NULL, latn_tag, ARRAY_SIZE(tags), tags, &count);
3870  ok(hr == E_PENDING, "Got unexpected hr %#x.\n", hr);
3871  ok(!sc, "Got unexpected script cache %p.\n", sc);
3872  hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, ARRAY_SIZE(tags), tags, &count);
3873  ok(hr == S_OK || hr == E_OUTOFMEMORY, "Got unexpected hr %#x.\n", hr);
3874  if (hr == S_OK)
3875  ok(count <= 5, "Got unexpected count %d.\n", count);
3876  else
3877  ok(!count, "Got unexpected count %d.\n", count);
3878 
3879  ScriptFreeCache(&sc);
3880  sc = NULL;
3881 
3882  hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, NULL, NULL);
3883  ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
3884  ok(!sc, "Got unexpected script cache %p.\n", sc);
3885  hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, NULL, &count);
3886  ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
3887  ok(!sc, "Got unexpected script cache %p.\n", sc);
3888  hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, ARRAY_SIZE(tags), tags, NULL);
3889  ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
3890  ok(!sc, "Got unexpected script cache %p.\n", sc);
3891  hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, tags, &count);
3892  ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
3893  ok(!sc, "Got unexpected script cache %p.\n", sc);
3894  hr = pScriptGetFontFeatureTags(NULL, &sc, NULL, latn_tag, 0x0, ARRAY_SIZE(tags), tags, &count);
3895  ok(hr == E_PENDING, "Got unexpected hr %#x.\n", hr);
3896  ok(!sc, "Got unexpected script cache %p.\n", sc);
3897  hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, ARRAY_SIZE(tags), tags, &count);
3898  ok(hr == S_OK || hr == E_OUTOFMEMORY, "Got unexpected hr %#x.\n", hr);
3899  if (hr == S_OK)
3900  ok(count <= 5, "Got unexpected count %d.\n", count);
3901  else
3902  ok(!count, "Got unexpected count %d.\n", count);
3903 
3904  memset(&control, 0, sizeof(control));
3905  memset(&state, 0, sizeof(state));
3906 
3907  hr = ScriptItemize(test_phagspa, ARRAY_SIZE(test_phagspa), ARRAY_SIZE(items),
3908  &control, &state, items, &count);
3909  ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
3910  memset(tags, 0, sizeof(tags));
3911  hr = pScriptGetFontScriptTags(hdc, &sc, &items[0].a, ARRAY_SIZE(tags), tags, &count);
3912  ok(hr == USP_E_SCRIPT_NOT_IN_FONT || broken(hr == S_OK), "Got unexpected hr %#x.\n", hr);
3913 
3914  hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, dsrt_tag, ARRAY_SIZE(tags), tags, &count);
3915  ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
3916  hr = pScriptGetFontLanguageTags(hdc, &sc, &items[0].a, dsrt_tag, ARRAY_SIZE(tags), tags, &count);
3917  ok(hr == E_INVALIDARG || broken(hr == S_OK), "Got unexpected hr %#x.\n", hr);
3918 
3919  hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, dsrt_tag, 0x0, ARRAY_SIZE(tags), tags, &count);
3920  ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
3921  hr = pScriptGetFontFeatureTags(hdc, &sc, &items[0].a, dsrt_tag, 0x0, ARRAY_SIZE(tags), tags, &count);
3922  ok(hr == E_INVALIDARG || broken(hr == S_OK), "Got unexpected hr %#x.\n", hr);
3923 
3924  ScriptFreeCache(&sc);
3925 }
#define dsrt_tag
Definition: usp10.c:176
const char * tags[7 *8]
Definition: apphelp.c:214
#define USP_E_SCRIPT_NOT_IN_FONT
Definition: usp10.h:71
HRESULT hr
Definition: shlfolder.c:183
GLint x0
Definition: linetemp.h:95
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define latn_tag
Definition: usp10.c:142
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItems, const SCRIPT_CONTROL *psControl, const SCRIPT_STATE *psState, SCRIPT_ITEM *pItems, int *pcItems)
Definition: usp10.c:1853
HDC hdc
Definition: main.c:9
static int state
Definition: maze.c:121
#define broken(x)
Definition: _sntprintf.h:21
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
HRESULT WINAPI ScriptFreeCache(SCRIPT_CACHE *psc)
Definition: usp10.c:1080
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define E_PENDING
Definition: dinput.h:172
static TCHAR * items[]
Definition: page1.c:45
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:150
ULONG OPENTYPE_TAG
Definition: usp10.h:205

Referenced by START_TEST().

◆ test_ScriptGetFontProperties()

static void test_ScriptGetFontProperties ( HDC  hdc)
static

Definition at line 2507 of file usp10.c.

2508 {
2509  HRESULT hr;
2510  SCRIPT_CACHE psc,old_psc;
2512  HFONT font, oldfont;
2513  LOGFONTA lf;
2514  struct enum_font_data efnd;
2515  TEXTMETRICA tmA;
2516  WORD gi[3];
2517  WCHAR str[3];
2518  DWORD i, ret;
2520  static const WCHAR invalids[] = {0x0020, 0x200B, 0xF71B};
2521  /* U+0020: numeric space
2522  U+200B: zero width space
2523  U+F71B: unknown, found by black box testing */
2524  BOOL is_arial, is_times_new_roman, is_arabic = (system_lang_id == LANG_ARABIC);
2525 
2526  /* Some sanity checks for ScriptGetFontProperties */
2527 
2529  ok( hr == E_INVALIDARG, "(NULL,NULL,NULL), expected E_INVALIDARG, got %08x\n", hr);
2530 
2532  ok( hr == E_INVALIDARG, "(NULL,NULL,&sfp), expected E_INVALIDARG, got %08x\n", hr);
2533 
2534  /* Set psc to NULL, to be able to check if a pointer is returned in psc */
2535  psc = NULL;
2537  ok( hr == E_INVALIDARG, "(NULL,&psc,NULL), expected E_INVALIDARG, got %08x\n", hr);
2538  ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
2539 
2540  /* Set psc to NULL, to be able to check if a pointer is returned in psc */
2541  psc = NULL;
2543  ok( hr == E_PENDING, "(NULL,&psc,&sfp), expected E_PENDING, got %08x\n", hr);
2544  ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
2545 
2547  ok( hr == E_INVALIDARG, "(hdc,NULL,NULL), expected E_INVALIDARG, got %08x\n", hr);
2548 
2550  ok( hr == E_INVALIDARG, "(hdc,NULL,&sfp), expected E_INVALIDARG, got %08x\n", hr);
2551 
2552  /* Set psc to NULL, to be able to check if a pointer is returned in psc */
2553  psc = NULL;
2555  ok( hr == E_INVALIDARG, "(hdc,&psc,NULL), expected E_INVALIDARG, got %08x\n", hr);
2556  ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
2557 
2558  /* Pass an invalid sfp */
2559  psc = NULL;
2560  sfp.cBytes = sizeof(SCRIPT_FONTPROPERTIES) - 1;
2561  hr = ScriptGetFontProperties(hdc,&psc,&sfp);
2562  ok( hr == E_INVALIDARG, "(hdc,&psc,&sfp) invalid, expected E_INVALIDARG, got %08x\n", hr);
2563  ok( psc != NULL, "Expected a pointer in psc, got NULL\n");
2564  ok( sfp.cBytes == sizeof(SCRIPT_FONTPROPERTIES) - 1, "Unexpected cBytes.\n");
2565  ScriptFreeCache(&psc);
2566  ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
2567 
2568  /* Give it the correct cBytes, we don't care about what's coming back */
2569  sfp.cBytes = sizeof(SCRIPT_FONTPROPERTIES);
2570  psc = NULL;
2571  hr = ScriptGetFontProperties(hdc,&psc,&sfp);
2572  ok( hr == S_OK, "(hdc,&psc,&sfp) partly initialized, expected S_OK, got %08x\n", hr);
2573  ok( psc != NULL, "Expected a pointer in psc, got NULL\n");
2574 
2575  /* Save the psc pointer */
2576  old_psc = psc;
2577  /* Now a NULL hdc again */
2579  ok( hr == S_OK, "(NULL,&psc,&sfp), expected S_OK, got %08x\n", hr);
2580  ok( psc == old_psc, "Expected psc not to be changed, was %p is now %p\n", old_psc, psc);
2581  ScriptFreeCache(&psc);
2582  ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
2583 
2584  memset(&lf, 0, sizeof(lf));
2586  efnd.total = 0;
2588 
2589  for (i = 0; i < efnd.total; i++)
2590  {
2591  if (strlen((char *)efnd.elf[i].elfFullName) >= LF_FACESIZE)
2592  {
2593  trace("Font name to long to test: %s\n",(char *)efnd.elf[i].elfFullName);
2594  continue;
2595  }
2596  lstrcpyA(lf.lfFaceName, (char *)efnd.elf[i].elfFullName);
2598  oldfont = SelectObject(hdc, font);
2599 
2600  sfp.cBytes = sizeof(SCRIPT_FONTPROPERTIES);
2601  psc = NULL;
2602  hr = ScriptGetFontProperties(hdc, &psc, &sfp);
2603  ok(hr == S_OK, "ScriptGetFontProperties expected S_OK, got %08x\n", hr);
2605  {
2606  trace("bitmap font %s\n", lf.lfFaceName);
2607  trace("wgBlank %04x\n", sfp.wgBlank);
2608  trace("wgDefault %04x\n", sfp.wgDefault);
2609  trace("wgInvalid %04x\n", sfp.wgInvalid);
2610  trace("wgKashida %04x\n", sfp.wgKashida);
2611  trace("iKashidaWidth %d\n", sfp.iKashidaWidth);
2612  }
2613 
2614  ret = GetTextMetricsA(hdc, &tmA);
2615  ok(ret != 0, "GetTextMetricsA failed!\n");
2616 
2617  ret = GetGlyphIndicesW(hdc, invalids, 1, gi, GGI_MARK_NONEXISTING_GLYPHS);
2618  ok(ret != GDI_ERROR, "GetGlyphIndicesW failed!\n");
2619 
2620  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]);
2621 
2622  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);
2623 
2624  ok(sfp.wgInvalid == sfp.wgBlank || broken(is_arabic), "bitmap font %s wgInvalid %02x wgBlank %02x\n", lf.lfFaceName, sfp.wgInvalid, sfp.wgBlank);
2625 
2626  ok(sfp.wgKashida == 0xFFFF || broken(is_arabic), "bitmap font %s wgKashida %02x\n", lf.lfFaceName, sfp.wgKashida);
2627 
2628  ScriptFreeCache(&psc);
2629 
2630  SelectObject(hdc, oldfont);
2631  DeleteObject(font);
2632  }
2633 
2634  efnd.total = 0;
2636 
2637  for (i = 0; i < efnd.total; i++)
2638  {
2639  if (strlen((char *)efnd.elf[i].elfFullName) >= LF_FACESIZE)
2640  {
2641  trace("Font name to long to test: %s\n",(char *)efnd.elf[i].elfFullName);
2642  continue;
2643  }
2644  lstrcpyA(lf.lfFaceName, (char *)efnd.elf[i].elfFullName);
2646  oldfont = SelectObject(hdc, font);
2647 
2648  sfp.cBytes = sizeof(SCRIPT_FONTPROPERTIES);
2649  psc = NULL;
2650  hr = ScriptGetFontProperties(hdc, &psc, &sfp);
2651  ok(hr == S_OK, "ScriptGetFontProperties expected S_OK, got %08x\n", hr);
2653  {
2654  trace("truetype font %s\n", lf.lfFaceName);
2655  trace("wgBlank %04x\n", sfp.wgBlank);
2656  trace("wgDefault %04x\n", sfp.wgDefault);
2657  trace("wgInvalid %04x\n", sfp.wgInvalid);
2658  trace("wgKashida %04x\n", sfp.wgKashida);
2659  trace("iKashidaWidth %d\n", sfp.iKashidaWidth);
2660  }
2661 
2662  str[0] = 0x0020; /* U+0020: numeric space */
2663  ret = GetGlyphIndicesW(hdc, str, 1, gi, 0);
2664  ok(ret != GDI_ERROR, "GetGlyphIndicesW failed!\n");
2665  ok(sfp.wgBlank == gi[0], "truetype font %s wgBlank %04x gi[0] %04x\n", lf.lfFaceName, sfp.wgBlank, gi[0]);
2666 
2667  ok(sfp.wgDefault == 0 || broken(is_arabic), "truetype font %s wgDefault %04x\n", lf.lfFaceName, sfp.wgDefault);
2668 
2669  ret = GetGlyphIndicesW(hdc, invalids, 3, gi, GGI_MARK_NONEXISTING_GLYPHS);
2670  ok(ret != GDI_ERROR, "GetGlyphIndicesW failed!\n");
2671  if (gi[2] != 0xFFFF) /* index of default non exist char */
2672  ok(sfp.wgInvalid == gi[2], "truetype font %s wgInvalid %04x gi[2] %04x\n", lf.lfFaceName, sfp.wgInvalid, gi[2]);
2673  else if (gi[1] != 0xFFFF)
2674  ok(sfp.wgInvalid == gi[1], "truetype font %s wgInvalid %04x gi[1] %04x\n", lf.lfFaceName, sfp.wgInvalid, gi[1]);
2675  else if (gi[0] != 0xFFFF)
2676  ok(sfp.wgInvalid == gi[0], "truetype font %s wgInvalid %04x gi[0] %04x\n", lf.lfFaceName, sfp.wgInvalid, gi[0]);
2677  else
2678  ok(sfp.wgInvalid == 0, "truetype font %s wgInvalid %04x expect 0\n", lf.lfFaceName, sfp.wgInvalid);
2679 
2680  str[0] = 0x0640; /* U+0640: kashida */
2682  ok(ret != GDI_ERROR, "GetGlyphIndicesW failed!\n");
2683  is_arial = !lstrcmpA(lf.lfFaceName, "Arial");
2684  is_times_new_roman= !lstrcmpA(lf.lfFaceName, "Times New Roman");
2685  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]);
2686 
2687  ScriptFreeCache(&psc);
2688 
2689  SelectObject(hdc, oldfont);
2690  DeleteObject(font);
2691  }
2692 }
#define LF_FACESIZE
Definition: dimm.idl:39
HRESULT hr
Definition: shlfolder.c:183
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
Definition: mk_font.cpp:20
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
struct tag_SCRIPT_FONTPROPERTIES SCRIPT_FONTPROPERTIES
HRESULT WINAPI ScriptGetFontProperties(HDC hdc, SCRIPT_CACHE *psc, SCRIPT_FONTPROPERTIES *sfp)
Definition: usp10.c:1176
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BYTE lfCharSet
Definition: dimm.idl:50
#define LANG_ARABIC
Definition: nls.h:29
int winetest_interactive
#define DEFAULT_CHARSET
Definition: wingdi.h:383
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
int WINAPI EnumFontFamiliesA(_In_ HDC, _In_opt_ LPCSTR, _In_ FONTENUMPROCA, _In_ LPARAM)
#define E_INVALIDARG
Definition: ddrawi.h:101
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
Definition: text.c:200
#define trace
Definition: atltest.h:70
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
LANGID WINAPI GetSystemDefaultLangID(void)
Definition: lang.c:751
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
LOGFONTA * lf
Definition: font.c:2789
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
#define GGI_MARK_NONEXISTING_GLYPHS
Definition: wingdi.h:1084
int ret
HDC hdc
Definition: main.c:9
static INT CALLBACK enum_bitmap_font_proc(const LOGFONTA *lf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
Definition: usp10.c:2475
#define broken(x)
Definition: _sntprintf.h:21
#define S_OK
Definition: intsafe.h:59
static SCRIPT_CACHE * psc
Definition: usp10.c:64
static INT CALLBACK enum_truetype_proc(const LOGFONTA *lf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
Definition: usp10.c:2491
#define ok(value,...)
Definition: atltest.h:57
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
DWORD WINAPI GetGlyphIndicesW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpstr, _In_ int c, _Out_writes_(c) LPWORD pgi, _In_ DWORD fl)
HRESULT WINAPI ScriptFreeCache(SCRIPT_CACHE *psc)
Definition: usp10.c:1080
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
#define E_PENDING
Definition: dinput.h:172
#define GDI_ERROR
Definition: wingdi.h:1308
#define memset(x, y, z)
Definition: compat.h:39
static WORD system_lang_id
Definition: font.c:67
#define PRIMARYLANGID(l)
Definition: nls.h:16

Referenced by START_TEST().

◆ test_ScriptGetGlyphABCWidth()

static void test_ScriptGetGlyphABCWidth ( HDC  hdc)
static

Definition at line 3466 of file usp10.c.

3467 {
3468  HRESULT hr;
3469  SCRIPT_CACHE sc = NULL;
3470  HFONT hfont, prev_hfont;
3471  TEXTMETRICA tm;
3472  ABC abc, abc2;
3473  LOGFONTA lf;
3474  WORD glyph;
3475  INT width;
3476  DWORD ret;
3477 
3478  glyph = 0;
3479  ret = GetGlyphIndicesA(hdc, "a", 1, &glyph, 0);
3480  ok(ret == 1, "Failed to get glyph index.\n");
3481  ok(glyph != 0, "Unexpected glyph index.\n");
3482 
3483  hr = ScriptGetGlyphABCWidth(NULL, NULL, glyph, NULL);
3484  ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);
3485 
3486  hr = ScriptGetGlyphABCWidth(NULL, &sc, glyph, NULL);
3487  ok(broken(hr == E_PENDING) ||
3488  hr == E_INVALIDARG, /* WIN7 */
3489  "expected E_INVALIDARG, got 0x%08x\n", hr);
3490 
3491  hr = ScriptGetGlyphABCWidth(NULL, &sc, glyph, &abc);
3492  ok(hr == E_PENDING, "expected E_PENDING, got 0x%08x\n", hr);
3493 
3494  if (0) { /* crashes on WinXP */
3495  hr = ScriptGetGlyphABCWidth(hdc, &sc, glyph, NULL);
3496  ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);
3497  }
3498 
3499  hr = ScriptGetGlyphABCWidth(hdc, &sc, glyph, &abc);
3500  ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
3501  ok(abc.abcB != 0, "Unexpected width.\n");
3502 
3503  ret = GetCharABCWidthsI(hdc, glyph, 1, NULL, &abc2);
3504  ok(ret, "Failed to get char width.\n");
3505  ok(!memcmp(&abc, &abc2, sizeof(abc)), "Unexpected width.\n");
3506 
3507  ScriptFreeCache(&sc);
3508 
3509  /* Bitmap font */
3510  memset(&lf, 0, sizeof(lf));
3511  strcpy(lf.lfFaceName, "System");
3512  lf.lfHeight = 20;
3513 
3515  prev_hfont = SelectObject(hdc, hfont);
3516 
3517  ret = GetTextMetricsA(hdc, &tm);
3518  ok(ret, "Failed to get text metrics.\n");
3519  ok(!(tm.tmPitchAndFamily & TMPF_TRUETYPE), "Unexpected TrueType font.\n");
3520  ok(tm.tmPitchAndFamily & TMPF_FIXED_PITCH, "Unexpected fixed pitch font.\n");
3521 
3522  glyph = 0;
3523  ret = GetGlyphIndicesA(hdc, "i", 1, &glyph, 0);
3524  ok(ret == 1, "Failed to get glyph index.\n");
3525  ok(glyph != 0, "Unexpected glyph index.\n");
3526 
3527  sc = NULL;
3528  hr = ScriptGetGlyphABCWidth(hdc, &sc, glyph, &abc);
3529  ok(hr == S_OK, "Failed to get glyph width, hr %#x.\n", hr);
3530  ok(abc.abcB != 0, "Unexpected width.\n");
3531 
3532  ret = GetCharWidthI(hdc, glyph, 1, NULL, &width);
3533  ok(ret, "Failed to get char width.\n");
3534  abc2.abcA = abc2.abcC = 0;
3535  abc2.abcB = width;
3536  ok(!memcmp(&abc, &abc2, sizeof(abc)), "Unexpected width.\n");
3537 
3538  SelectObject(hdc, prev_hfont);
3540 
3541  ScriptFreeCache(&sc);
3542 }
GLint GLint GLsizei width
Definition: gl.h:1546
Definition: wingdi.h:1409
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HRESULT hr
Definition: shlfolder.c:183
int abcC
Definition: wingdi.h:1412
DWORD WINAPI GetGlyphIndicesA(_In_ HDC hdc, _In_reads_(c) LPCSTR lpstr, _In_ int c, _Out_writes_(c) LPWORD pgi, _In_ DWORD fl)
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
int32_t INT
Definition: typedefs.h:56
BOOL WINAPI GetCharABCWidthsI(_In_ HDC hdc, _In_ UINT giFirst, _In_ UINT cgi, _In_reads_opt_(cgi) LPWORD pgi, _Out_writes_(cgi) LPABC pabc)
#define TMPF_TRUETYPE
Definition: wingdi.h:1312
LONG lfHeight
Definition: dimm.idl:42
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
Definition: text.c:200
static HFONT hfont
UINT abcB
Definition: wingdi.h:1411
LONG HRESULT
Definition: typedefs.h:77
int abcA
Definition: wingdi.h:1410
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
LOGFONTA * lf
Definition: font.c:2789
int ret
HDC hdc
Definition: main.c:9
Definition: time.h:76
#define broken(x)
Definition: _sntprintf.h:21
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
HRESULT WINAPI ScriptFreeCache(SCRIPT_CACHE *psc)
Definition: usp10.c:1080
HRESULT WINAPI ScriptGetGlyphABCWidth(HDC hdc, SCRIPT_CACHE *psc, WORD glyph, ABC *abc)
Definition: usp10.c:3708
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
BOOL WINAPI GetCharWidthI(_In_ HDC hdc, _In_ UINT giFirst, _In_ UINT cgi, _In_reads_opt_(cgi) LPWORD pgi, _Out_writes_(cgi) LPINT piWidths)
#define TMPF_FIXED_PITCH
Definition: wingdi.h:1310
static UINT UINT LPWORD LPABC abc
Definition: font.c:44
#define E_PENDING
Definition: dinput.h:172
#define memset(x, y, z)
Definition: compat.h:39

Referenced by START_TEST().

◆ test_ScriptGetLogicalWidths()

static void test_ScriptGetLogicalWidths ( void  )
static

Definition at line 3951 of file usp10.c.

3952 {
3953  SCRIPT_ANALYSIS sa = { 0 };
3954  unsigned int i, j;
3955 
3956  for (i = 0; i < ARRAY_SIZE(logical_width_tests); ++i)
3957  {
3958  const struct logical_width_test *ptr = logical_width_tests + i;
3959  SCRIPT_VISATTR attrs[3];
3960  int widths[3];
3961  HRESULT hr;
3962 
3963  memset(attrs, 0, sizeof(attrs));
3964  for (j = 0; j < ptr->glyph_count; j++)
3965  {
3966  attrs[j].fClusterStart = ptr->clusterstart[j];
3967  attrs[j].fDiacritic = ptr->diacritic[j];
3968  attrs[j].fZeroWidth = ptr->zerowidth[j];
3969  }
3970 
3971  hr = ScriptGetLogicalWidths(&sa, ptr->char_count, ptr->glyph_count, ptr->advances, ptr->map, attrs, widths);
3972  ok(hr == S_OK, "got 0x%08x\n", hr);
3973 
3974  todo_wine_if(ptr->todo)
3975  ok(!memcmp(ptr->widths, widths, sizeof(widths)), "test %u: got wrong widths\n", i);
3976  }
3977 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HRESULT hr
Definition: shlfolder.c:183
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
GLdouble n
Definition: glext.h:7729
HRESULT WINAPI ScriptGetLogicalWidths(const SCRIPT_ANALYSIS *sa, int nbchars, int nbglyphs, const int *advances, const WORD *log_clust, const SCRIPT_VISATTR *sva, int *widths)
Definition: usp10.c:3998
#define test
Definition: rosglue.h:37
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static PVOID ptr
Definition: dispmode.c:27
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define todo_wine_if(is_todo)
Definition: test.h:164
WORD fClusterStart
Definition: usp10.h:179
LONG HRESULT
Definition: typedefs.h:77
static const struct logical_width_test logical_width_tests[]
Definition: usp10.c:3940
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
#define memset(x, y, z)
Definition: compat.h:39
static struct sockaddr_in sa
Definition: adnsresfilter.c:69

Referenced by START_TEST().

◆ test_ScriptGetProperties()

static void test_ScriptGetProperties ( void  )
static

Definition at line 3699 of file usp10.c.

3700 {
3701  const SCRIPT_PROPERTIES **props;
3702  HRESULT hr;
3703  int num;
3704 
3706  ok(hr == E_INVALIDARG, "ScriptGetProperties succeeded\n");
3707 
3709  ok(hr == S_OK, "ScriptGetProperties failed: 0x%08x\n", hr);
3710 
3712  ok(hr == S_OK, "ScriptGetProperties failed: 0x%08x\n", hr);
3713 
3715  ok(hr == S_OK, "ScriptGetProperties failed: 0x%08x\n", hr);
3716 }
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI ScriptGetProperties(const SCRIPT_PROPERTIES ***props, int *num)
Definition: usp10.c:1154
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
GLuint GLuint num
Definition: glext.h:9618
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
static const WCHAR props[]
Definition: wbemdisp.c:288

Referenced by START_TEST().

◆ test_ScriptIsComplex()

static void test_ScriptIsComplex ( void  )
static

Definition at line 3979 of file usp10.c.

3980 {
3981  static const WCHAR testW[] = {0x202a,'1',0x202c,0};
3982  static const WCHAR test2W[] = {'1',0};
3983  static const struct complex_test
3984  {
3985  const WCHAR *text;
3986  DWORD flags;
3987  HRESULT hr;
3988  BOOL todo;
3989  } complex_tests[] =
3990  {
3991  { test2W, SIC_ASCIIDIGIT, S_OK },
3992  { test2W, SIC_COMPLEX, S_FALSE },
3993  { test2W, SIC_COMPLEX | SIC_ASCIIDIGIT, S_OK },
3995  { testW, SIC_NEUTRAL, S_FALSE, TRUE },
3996  { testW, SIC_COMPLEX, S_OK },
3997  { testW, 0, S_FALSE },
3998  };
3999  unsigned int i;
4000  HRESULT hr;
4001 
4002  hr = ScriptIsComplex(NULL, 0, 0);
4003  ok(hr == E_INVALIDARG || broken(hr == S_FALSE) /* winxp/vista */, "got 0x%08x\n", hr);
4004 
4005  if (hr == E_INVALIDARG)
4006  {
4007  hr = ScriptIsComplex(NULL, 1, 0);
4008  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
4009  }
4010 
4011  hr = ScriptIsComplex(test2W, -1, SIC_ASCIIDIGIT);
4012  ok(hr == E_INVALIDARG || broken(hr == S_FALSE) /* winxp/vista */, "got 0x%08x\n", hr);
4013 
4014  hr = ScriptIsComplex(test2W, 0, SIC_ASCIIDIGIT);
4015  ok(hr == S_FALSE, "got 0x%08x\n", hr);
4016 
4017  for (i = 0; i < ARRAY_SIZE(complex_tests); ++i)
4018  {
4019  hr = ScriptIsComplex(complex_tests[i].text, lstrlenW(complex_tests[i].text), complex_tests[i].flags);
4020  todo_wine_if(complex_tests[i].todo)
4021  ok(hr == complex_tests[i].hr, "%u: got %#x, expected %#x, flags %#x\n", i, hr, complex_tests[i].hr,
4022  complex_tests[i].flags);
4023  }
4024 
4025  hr = ScriptIsComplex(test2W, 1, ~0u);
4026  ok(hr == S_OK, "got 0x%08x\n", hr);
4027 
4028  hr = ScriptIsComplex(testW, 3, 0);
4029  ok(hr == S_FALSE, "got 0x%08x\n", hr);
4030 
4032  ok(hr == S_OK, "got 0x%08x\n", hr);
4033 
4035  ok(hr == S_OK, "got 0x%08x\n", hr);
4036 
4037  hr = ScriptIsComplex(test2W, 1, SIC_COMPLEX);
4038  ok(hr == S_FALSE, "got 0x%08x\n", hr);
4039 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI ScriptIsComplex(const WCHAR *chars, int len, DWORD flag)
Definition: usp10.c:3074
const WCHAR * text
Definition: package.c:1827
BOOL todo
Definition: filedlg.c:313
#define SIC_ASCIIDIGIT
Definition: usp10.h:57
#define lstrlenW
Definition: compat.h:415
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define SIC_NEUTRAL
Definition: usp10.h:58
unsigned int BOOL
Definition: ntddk_ex.h:94
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define todo_wine_if(is_todo)
Definition: test.h:164
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SIC_COMPLEX
Definition: usp10.h:56
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
#define broken(x)
Definition: _sntprintf.h:21
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
static const WCHAR testW[]
Definition: jsregexp.c:44

Referenced by START_TEST().

◆ test_ScriptItemize()

static void test_ScriptItemize ( void  )
static

Definition at line 180 of file usp10.c.

181 {
182  static const WCHAR test1[] = {'t', 'e', 's', 't',0};
183  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}};
184  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}};
185 
186  static const WCHAR test1b[] = {' ', ' ', ' ', ' ',0};
187  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}};
188  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}};
189 
190  static const WCHAR test1c[] = {' ', ' ', ' ', '1', '2', ' ',0};
191  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}};
192  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}};
193 
194  /* Arabic, English*/
195  static const WCHAR test2[] = {'1','2','3','-','5','2',0x064a,0x064f,0x0633,0x0627,0x0648,0x0650,0x064a,'7','1','.',0};
196  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}};
197  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}};
198  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}};
199  static const itemTest t24[5] = {{{0,0,0,0,0,0},0,0,0,0,1,0,FALSE},
200  {{0,0,0,0,0,0},6,0,0,0,1,arab_tag,FALSE},
201  {{0,0,0,0,0,0},13,0,1,0,1,0,FALSE},
202  {{0,0,0,0,0,0},15,0,0,0,1,0,FALSE},
203  {{0,0,0,0,0,0},16,0,0,0,0,-1,FALSE}};
204 
205  static const WCHAR test2b[] = {'A','B','C','-','D','E','F',' ',0x0621,0x0623,0x0624,0};
206  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}};
207  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}};
208  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}};
209  static const itemTest t2b4[5] = {{{0,0,0,0,0,0},0,0,0,0,1,latn_tag,FALSE},
210  {{0,0,0,0,0,0},3,0,0,0,1,0,FALSE},
211  {{0,0,0,0,0,0},4,0,0,0,1,latn_tag,FALSE},
212  {{0,0,0,0,0,0},8,0,0,0,1,arab_tag,FALSE},
213  {{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE}};
214  static const int b2[2] = {4,4};
215 
216  /* leading space */
217  static const WCHAR test2c[] = {' ',0x0621,0x0623,0x0624,'A','B','C','-','D','E','F',0};
218  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}};
219  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}};
220  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}};
221  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}};
222  static const itemTest t2c5[5] = {{{0,0,0,0,0,0},0,0,0,0,1,arab_tag,FALSE},
223  {{0,0,0,0,0,0},4,0,0,0,1,latn_tag,FALSE},
224  {{0,0,0,0,0,0},7,0,0,0,1,0,FALSE},
225  {{0,0,0,0,0,0},8,0,0,0,1,latn_tag,FALSE},
226  {{0,0,0,0,0,0},11,0,0,0,0,-1,FALSE}};
227 
228  /* trailing space */
229  static const WCHAR test2d[] = {'A','B','C','-','D','E','F',0x0621,0x0623,0x0624,' ',0};
230  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}};
231  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}};
232  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}};
233  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