[REGTESTS]

Add bugs_regtest. This can be used to create testcases / regression tests for already fixed bugs. I added a first test for bug 3481

svn path=/trunk/; revision=48615
This commit is contained in:
Timo Kreuzer 2010-08-24 05:20:16 +00:00
parent 337a1faad6
commit fdd4f2b50b
4 changed files with 104 additions and 0 deletions

View file

@ -0,0 +1,72 @@
/*
* PROJECT: ReactOS CRT regression tests
* LICENSE: GPL - See COPYING in the top level directory
* FILE: rostests/regtests/crt/time.c
* PURPOSE: Test for bug 3481
* PROGRAMMERS: Timo Kreuzer
*/
#include <stdio.h>
#include <wine/test.h>
#include <windows.h>
#define COUNT 26
void Test_bug3481()
{
const char text[COUNT] = "abcdefghijklmnopqrstuvmxyz";
WORD agi[COUNT];
INT i, aiWidth1[COUNT], aiWidth2[COUNT];
BOOL result;
HDC hdc;
SIZE size1, size2;
/* Create a DC */
hdc = CreateCompatibleDC(NULL);
SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
/* Convert the charcaters into glyph indices */
result = GetGlyphIndicesA(hdc, text, COUNT, agi, 0);
ok(result != 0, "result=%d, GetLastError()=%ld\n", result, GetLastError());
/* Get the size of the string */
result = GetTextExtentPoint32A(hdc, text, COUNT, &size1);
ok(result != 0, "result=%d, GetLastError()=%ld\n", result, GetLastError());
/* Get the size from glyph indices */
result = GetTextExtentPointI(hdc, agi, COUNT, &size2);
ok(result != 0, "result=%d, GetLastError()=%ld\n", result, GetLastError());
/* Compare sizes */
ok(size1.cx == size2.cx, "Sizes don't match. size1.cx=%ld, size2.cx=%ld\n", size1.cx, size2.cx);
ok(size1.cy == size2.cy, "Sizes don't match. size1.cy=%ld, size2.cy=%ld\n", size1.cy, size2.cy);
/* Get the size of the string */
result = GetTextExtentExPointA(hdc, text, COUNT, MAXLONG, NULL, aiWidth1, &size1);
ok(result != 0, "result=%d, GetLastError()=%ld\n", result, GetLastError());
/* Get the size from glyph indices */
result = GetTextExtentExPointI(hdc, agi, COUNT, MAXLONG, NULL, aiWidth2, &size2);
ok(result != 0, "result=%d, GetLastError()=%ld\n", result, GetLastError());
/* Compare sizes */
ok(size1.cx == size2.cx, "Sizes don't match. size1.cx=%ld, size2.cx=%ld\n", size1.cx, size2.cx);
ok(size1.cy == size2.cy, "Sizes don't match. size1.cy=%ld, size2.cy=%ld\n", size1.cy, size2.cy);
/* Loop all characters */
for (i = 0; i < COUNT; i++)
{
/* Check if we got identical spacing values */
ok(aiWidth1[i] == aiWidth2[i], "wrong spacing, i=%d, char:%d, index:%d\n", i, aiWidth1[i], aiWidth2[i]);
}
/* Cleanup */
DeleteDC(hdc);
}
START_TEST(bug3481)
{
Test_bug3481();
}

View file

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="bugs_regtest" type="win32cui" installbase="bin" installname="bugs_regtest.exe">
<include base="bugs_regtest">.</include>
<library>wine</library>
<library>gdi32</library>
<file>testlist.c</file>
<file>bug3481.c</file>
</module>
</group>

View file

@ -0,0 +1,17 @@
/* Automatically generated file; DO NOT EDIT!! */
#define WIN32_LEAN_AND_MEAN
#define __ROS_LONG64__
#include <windows.h>
#define STANDALONE
#include "wine/test.h"
extern void func_bug3481(void);
const struct test winetest_testlist[] =
{
{ "bug3481", func_bug3481 },
{ 0, 0 }
};

View file

@ -7,4 +7,7 @@
<directory name="crt">
<xi:include href="crt/crt_regtest.rbuild" />
</directory>
<directory name="bugs">
<xi:include href="bugs/bugs_regtest.rbuild" />
</directory>
</group>