[REGTESTS]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Tue, 24 Aug 2010 05:20:16 +0000 (05:20 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Tue, 24 Aug 2010 05:20:16 +0000 (05:20 +0000)
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

rostests/regtests/bugs/bug3481.c [new file with mode: 0644]
rostests/regtests/bugs/bugs_regtest.rbuild [new file with mode: 0644]
rostests/regtests/bugs/testlist.c [new file with mode: 0644]
rostests/regtests/directory.rbuild

diff --git a/rostests/regtests/bugs/bug3481.c b/rostests/regtests/bugs/bug3481.c
new file mode 100644 (file)
index 0000000..4cef434
--- /dev/null
@@ -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();
+}
+
diff --git a/rostests/regtests/bugs/bugs_regtest.rbuild b/rostests/regtests/bugs/bugs_regtest.rbuild
new file mode 100644 (file)
index 0000000..a02c690
--- /dev/null
@@ -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>
diff --git a/rostests/regtests/bugs/testlist.c b/rostests/regtests/bugs/testlist.c
new file mode 100644 (file)
index 0000000..501e5c9
--- /dev/null
@@ -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 }
+};
+
index acbe991..5264d80 100644 (file)
@@ -7,4 +7,7 @@
        <directory name="crt">
                <xi:include href="crt/crt_regtest.rbuild" />
        </directory>
        <directory name="crt">
                <xi:include href="crt/crt_regtest.rbuild" />
        </directory>
+       <directory name="bugs">
+               <xi:include href="bugs/bugs_regtest.rbuild" />
+       </directory>
 </group>
 </group>