ReactOS 0.4.16-dev-340-g0540c21
bug3481.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS bug regression tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: rostests/regtests/bugs/bug3481.c
5 * PURPOSE: Test for bug 3481
6 * PROGRAMMERS: Timo Kreuzer
7 */
8
9#include <stdio.h>
10#include <wine/test.h>
11#include <windows.h>
12
13#define COUNT 26
14
16{
17 const char text[COUNT] = "abcdefghijklmnopqrstuvmxyz";
18 WORD agi[COUNT];
19 INT i, aiWidth1[COUNT], aiWidth2[COUNT];
21 HDC hdc;
22 SIZE size1, size2;
23
24 /* Create a DC */
26
28
29 /* Convert the charcaters into glyph indices */
31 ok(result != 0, "result=%d, GetLastError()=%ld\n", result, GetLastError());
32
33 /* Get the size of the string */
35 ok(result != 0, "result=%d, GetLastError()=%ld\n", result, GetLastError());
36
37 /* Get the size from glyph indices */
38 result = GetTextExtentPointI(hdc, agi, COUNT, &size2);
39 ok(result != 0, "result=%d, GetLastError()=%ld\n", result, GetLastError());
40
41 /* Compare sizes */
42 ok(size1.cx == size2.cx, "Sizes don't match. size1.cx=%ld, size2.cx=%ld\n", size1.cx, size2.cx);
43 ok(size1.cy == size2.cy, "Sizes don't match. size1.cy=%ld, size2.cy=%ld\n", size1.cy, size2.cy);
44
45 /* Get the size of the string */
46 result = GetTextExtentExPointA(hdc, text, COUNT, MAXLONG, NULL, aiWidth1, &size1);
47 ok(result != 0, "result=%d, GetLastError()=%ld\n", result, GetLastError());
48
49 /* Get the size from glyph indices */
50 result = GetTextExtentExPointI(hdc, agi, COUNT, MAXLONG, NULL, aiWidth2, &size2);
51 ok(result != 0, "result=%d, GetLastError()=%ld\n", result, GetLastError());
52
53 /* Compare sizes */
54 ok(size1.cx == size2.cx, "Sizes don't match. size1.cx=%ld, size2.cx=%ld\n", size1.cx, size2.cx);
55 ok(size1.cy == size2.cy, "Sizes don't match. size1.cy=%ld, size2.cy=%ld\n", size1.cy, size2.cy);
56
57 /* Loop all characters */
58 for (i = 0; i < COUNT; i++)
59 {
60 /* Check if we got identical spacing values */
61 ok(aiWidth1[i] == aiWidth2[i], "wrong spacing, i=%d, char:%d, index:%d\n", i, aiWidth1[i], aiWidth2[i]);
62 }
63
64 /* Cleanup */
66}
67
68START_TEST(bug3481)
69{
71}
72
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define COUNT
Definition: bug3481.c:13
void Test_bug3481()
Definition: bug3481.c:15
#define NULL
Definition: types.h:112
const WCHAR * text
Definition: package.c:1794
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint64EXT * result
Definition: glext.h:11304
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
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
int32_t INT
Definition: typedefs.h:58
#define MAXLONG
Definition: umtypes.h:116
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
BOOL WINAPI GetTextExtentExPointI(_In_ HDC hdc, _In_reads_(cwchString) LPWORD lpwszString, _In_ int cwchString, _In_ int nMaxExtent, _Out_opt_ LPINT lpnFit, _Out_writes_to_opt_(cwchString, *lpnFit) LPINT lpnDx, _Out_ LPSIZE lpSize)
HGDIOBJ WINAPI GetStockObject(_In_ int)
BOOL WINAPI GetTextExtentExPointA(_In_ HDC hdc, _In_reads_(cchString) LPCSTR lpszString, _In_ int cchString, _In_ int nMaxExtent, _Out_opt_ LPINT lpnFit, _Out_writes_to_opt_(cchString, *lpnFit) LPINT lpnDx, _Out_ LPSIZE lpSize)
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI GetTextExtentPointI(_In_ HDC hdc, _In_reads_(cgi) LPWORD pgiIn, _In_ int cgi, _Out_ LPSIZE psize)
Definition: text.c:440
DWORD WINAPI GetGlyphIndicesA(_In_ HDC hdc, _In_reads_(c) LPCSTR lpstr, _In_ int c, _Out_writes_(c) LPWORD pgi, _In_ DWORD fl)
BOOL WINAPI DeleteDC(_In_ HDC)
BOOL WINAPI GetTextExtentPoint32A(_In_ HDC hdc, _In_reads_(c) LPCSTR lpString, _In_ int c, _Out_ LPSIZE psizl)