mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-30 19:26:05 +00:00
[GDI32_APITEST]
- Add tests for CombineRgn svn path=/trunk/; revision=56408
This commit is contained in:
@@ -6,6 +6,7 @@ list(APPEND SOURCE
|
||||
AddFontResource.c
|
||||
AddFontResourceEx.c
|
||||
BeginPath.c
|
||||
CombineRgn.c
|
||||
CombineTransform.c
|
||||
CreateBitmap.c
|
||||
CreateBitmapIndirect.c
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for ...
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define ok_long(expression, result) \
|
||||
{ \
|
||||
int _value = (expression); \
|
||||
ok(_value == (result), "Wrong value for %s, expected " #result " (0x%x), got 0x%x\n", \
|
||||
#expression, (int)(result), _value); \
|
||||
}
|
||||
|
||||
|
||||
void Test_CombineRgn_COPY()
|
||||
{
|
||||
HRGN hrgn1, hrgn2, hrgn3;
|
||||
|
||||
hrgn1 = CreateRectRgn(0, 0, 0, 0);
|
||||
hrgn2 = CreateRectRgn(0, 0, 10, 10);
|
||||
hrgn3 = CreateRectRgn(5, 5, 20, 20);
|
||||
|
||||
SetLastError(0xbadbabe);
|
||||
ok_long(CombineRgn(NULL, NULL, NULL, RGN_COPY), ERROR);
|
||||
ok_long(CombineRgn(NULL, hrgn1, NULL, RGN_COPY), ERROR);
|
||||
ok_long(CombineRgn(NULL, NULL, hrgn1, RGN_COPY), ERROR);
|
||||
ok_long(CombineRgn(NULL, hrgn1, hrgn2, RGN_COPY), ERROR);
|
||||
ok_long(GetLastError(), 0xbadbabe);
|
||||
|
||||
ok_long(CombineRgn(hrgn1, hrgn2, hrgn3, RGN_COPY), SIMPLEREGION);
|
||||
ok(EqualRgn(hrgn1, hrgn2), "Region is not correct\n");
|
||||
|
||||
ok_long(CombineRgn(hrgn1, hrgn1, NULL, RGN_COPY), SIMPLEREGION);
|
||||
ok(EqualRgn(hrgn1, hrgn2), "Region is not correct\n");
|
||||
|
||||
ok_long(CombineRgn(hrgn1, hrgn3, GetStockObject(BLACK_PEN), RGN_COPY), SIMPLEREGION);
|
||||
ok(EqualRgn(hrgn1, hrgn3), "Region is not correct\n");
|
||||
|
||||
ok_long(CombineRgn(hrgn1, GetStockObject(BLACK_PEN), hrgn2, RGN_COPY), ERROR);
|
||||
ok(EqualRgn(hrgn1, hrgn3), "Region is not correct\n");
|
||||
|
||||
ok_long(CombineRgn(hrgn1, NULL, hrgn2, RGN_COPY), ERROR);
|
||||
ok(EqualRgn(hrgn1, hrgn3), "Region is not correct\n");
|
||||
|
||||
ok_long(CombineRgn(hrgn1, NULL, NULL, RGN_COPY), ERROR);
|
||||
ok(EqualRgn(hrgn1, hrgn3), "Region is not correct\n");
|
||||
|
||||
ok_long(GetLastError(), 0xbadbabe);
|
||||
|
||||
}
|
||||
|
||||
void Test_CombineRgn_AND()
|
||||
{
|
||||
HRGN hrgn1, hrgn2, hrgn3;
|
||||
|
||||
hrgn1 = CreateRectRgn(0, 0, 0, 0);
|
||||
hrgn2 = CreateRectRgn(0, 0, 10, 10);
|
||||
hrgn3 = CreateRectRgn(5, 5, 20, 20);
|
||||
|
||||
SetLastError(0xbadbabe);
|
||||
ok_long(CombineRgn(NULL, NULL, NULL, RGN_AND), ERROR);
|
||||
ok_long(CombineRgn(hrgn1, NULL, NULL, RGN_AND), ERROR);
|
||||
ok_long(CombineRgn(hrgn1, hrgn2, NULL, RGN_AND), ERROR);
|
||||
ok_long(CombineRgn(hrgn1, NULL, hrgn2, RGN_AND), ERROR);
|
||||
ok_long(CombineRgn(hrgn1, GetStockObject(BLACK_PEN), hrgn2, RGN_AND), ERROR);
|
||||
ok_long(CombineRgn(hrgn1, hrgn2, GetStockObject(BLACK_PEN), RGN_AND), ERROR);
|
||||
ok_long(GetLastError(), 0xbadbabe);
|
||||
|
||||
|
||||
ok_long(CombineRgn(hrgn1, hrgn2, hrgn3, RGN_AND), SIMPLEREGION);
|
||||
SetRectRgn(hrgn2, 5, 5, 10, 10);
|
||||
ok(EqualRgn(hrgn1, hrgn2), "Region is not correct\n");
|
||||
|
||||
SetRectRgn(hrgn2, 0, 0, 5, 5);
|
||||
SetRectRgn(hrgn3, 5, 0, 10, 5);
|
||||
ok_long(CombineRgn(hrgn1, hrgn2, hrgn3, RGN_AND), NULLREGION);
|
||||
SetRectRgn(hrgn2, 0, 0, 0, 0);
|
||||
ok(EqualRgn(hrgn1, hrgn2), "Region is not correct\n");
|
||||
|
||||
SetRectRgn(hrgn2, 0, 0, 20, 20);
|
||||
SetRectRgn(hrgn3, 5, 5, 10, 10);
|
||||
ok_long(CombineRgn(hrgn1, hrgn2, hrgn3, RGN_AND), SIMPLEREGION);
|
||||
SetRectRgn(hrgn2, 5, 5, 10, 10);
|
||||
ok(EqualRgn(hrgn1, hrgn2), "Region is not correct\n");
|
||||
|
||||
|
||||
SetRectRgn(hrgn2, 0, 0, 30, 10);
|
||||
SetRectRgn(hrgn3, 10, 10, 20, 30);
|
||||
ok_long(CombineRgn(hrgn1, hrgn2, hrgn3, RGN_OR), COMPLEXREGION);
|
||||
SetRectRgn(hrgn2, 10, 0, 30, 30);
|
||||
ok_long(CombineRgn(hrgn1, hrgn1, hrgn2, RGN_AND), COMPLEXREGION);
|
||||
ok_long(CombineRgn(hrgn1, hrgn1, hrgn1, RGN_AND), COMPLEXREGION);
|
||||
SetRectRgn(hrgn2, 10, 10, 30, 30);
|
||||
ok_long(CombineRgn(hrgn1, hrgn1, hrgn2, RGN_AND), SIMPLEREGION);
|
||||
SetRectRgn(hrgn2, 0, 0, 10, 10);
|
||||
ok_long(CombineRgn(hrgn1, hrgn1, hrgn2, RGN_AND), NULLREGION);
|
||||
|
||||
SetRectRgn(hrgn1, 0, 0, 30, 10);
|
||||
ok_long(CombineRgn(hrgn1, hrgn1, hrgn1, RGN_AND), SIMPLEREGION);
|
||||
|
||||
}
|
||||
|
||||
void Test_CombineRgn_OR()
|
||||
{
|
||||
HRGN hrgn1, hrgn2, hrgn3;
|
||||
|
||||
hrgn1 = CreateRectRgn(0, 0, 0, 0);
|
||||
hrgn2 = CreateRectRgn(0, 0, 5, 5);
|
||||
hrgn3 = CreateRectRgn(5, 0, 10, 5);
|
||||
ok_long(CombineRgn(hrgn1, hrgn2, hrgn3, RGN_OR), SIMPLEREGION);
|
||||
SetRectRgn(hrgn2, 0, 0, 10, 5);
|
||||
ok(EqualRgn(hrgn1, hrgn2), "Region is not correct\n");
|
||||
|
||||
SetRectRgn(hrgn2, 0, 0, 10, 10);
|
||||
SetRectRgn(hrgn3, 10, 10, 20, 20);
|
||||
ok_long(CombineRgn(hrgn1, hrgn2, hrgn3, RGN_OR), COMPLEXREGION);
|
||||
SetRectRgn(hrgn2, 10, 0, 20, 10);
|
||||
ok_long(CombineRgn(hrgn1, hrgn1, hrgn2, RGN_OR), COMPLEXREGION);
|
||||
ok_long(CombineRgn(hrgn1, hrgn1, hrgn1, RGN_OR), COMPLEXREGION);
|
||||
SetRectRgn(hrgn2, 0, 10, 10, 20);
|
||||
ok_long(CombineRgn(hrgn1, hrgn1, hrgn2, RGN_OR), SIMPLEREGION);
|
||||
SetRectRgn(hrgn2, 0, 0, 20, 20);
|
||||
ok(EqualRgn(hrgn1, hrgn2), "Region is not correct\n");
|
||||
|
||||
}
|
||||
|
||||
void Test_CombineRgn_DIFF()
|
||||
{
|
||||
HRGN hrgn1, hrgn2, hrgn3;
|
||||
|
||||
hrgn1 = CreateRectRgn(0, 0, 0, 0);
|
||||
hrgn2 = CreateRectRgn(0, 0, 10, 10);
|
||||
hrgn3 = CreateRectRgn(5, 0, 10, 5);
|
||||
|
||||
SetLastError(0xbadbabe);
|
||||
ok_long(CombineRgn(NULL, NULL, NULL, RGN_DIFF), ERROR);
|
||||
ok_long(CombineRgn(hrgn1, NULL, NULL, RGN_DIFF), ERROR);
|
||||
ok_long(CombineRgn(hrgn1, hrgn2, NULL, RGN_DIFF), ERROR);
|
||||
ok_long(CombineRgn(hrgn1, NULL, hrgn2, RGN_DIFF), ERROR);
|
||||
ok_long(CombineRgn(hrgn1, GetStockObject(BLACK_PEN), hrgn2, RGN_DIFF), ERROR);
|
||||
ok_long(CombineRgn(hrgn1, hrgn2, GetStockObject(BLACK_PEN), RGN_DIFF), ERROR);
|
||||
ok_long(GetLastError(), 0xbadbabe);
|
||||
|
||||
ok_long(CombineRgn(hrgn1, hrgn1, hrgn1, RGN_DIFF), NULLREGION);
|
||||
ok_long(CombineRgn(hrgn1, hrgn2, hrgn2, RGN_DIFF), NULLREGION);
|
||||
ok_long(CombineRgn(hrgn1, hrgn1, hrgn2, RGN_DIFF), NULLREGION);
|
||||
|
||||
ok_long(CombineRgn(hrgn1, hrgn2, hrgn1, RGN_DIFF), SIMPLEREGION);
|
||||
ok_long(CombineRgn(hrgn1, hrgn2, hrgn3, RGN_DIFF), COMPLEXREGION);
|
||||
ok_long(CombineRgn(hrgn1, hrgn1, hrgn3, RGN_DIFF), COMPLEXREGION);
|
||||
ok_long(CombineRgn(hrgn1, hrgn1, hrgn2, RGN_DIFF), NULLREGION);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Test_CombineRgn_XOR()
|
||||
{
|
||||
HRGN hrgn1, hrgn2, hrgn3, hrgn4;
|
||||
|
||||
hrgn1 = CreateRectRgn(0, 0, 0, 0);
|
||||
hrgn2 = CreateRectRgn(0, 0, 5, 5);
|
||||
hrgn3 = CreateRectRgn(5, 5, 10, 10);
|
||||
hrgn4 = CreateRectRgn(0, 0, 0, 0);
|
||||
|
||||
SetLastError(0xbadbabe);
|
||||
ok_long(CombineRgn(NULL, NULL, NULL, RGN_XOR), ERROR);
|
||||
ok_long(CombineRgn(hrgn1, NULL, NULL, RGN_XOR), ERROR);
|
||||
ok_long(CombineRgn(hrgn1, hrgn2, NULL, RGN_XOR), ERROR);
|
||||
ok_long(CombineRgn(hrgn1, NULL, hrgn2, RGN_XOR), ERROR);
|
||||
ok_long(CombineRgn(hrgn1, GetStockObject(BLACK_PEN), hrgn2, RGN_XOR), ERROR);
|
||||
ok_long(CombineRgn(hrgn1, hrgn2, GetStockObject(BLACK_PEN), RGN_XOR), ERROR);
|
||||
ok_long(GetLastError(), 0xbadbabe);
|
||||
|
||||
ok_long(CombineRgn(hrgn1, hrgn2, hrgn3, RGN_XOR), COMPLEXREGION);
|
||||
ok_long(CombineRgn(hrgn4, hrgn2, hrgn3, RGN_OR), COMPLEXREGION);
|
||||
ok(EqualRgn(hrgn1, hrgn4), "Region is not correct\n");
|
||||
|
||||
ok_long(CombineRgn(hrgn1, hrgn1, hrgn2, RGN_XOR), SIMPLEREGION);
|
||||
ok(EqualRgn(hrgn1, hrgn3), "Region is not correct\n");
|
||||
ok_long(CombineRgn(hrgn1, hrgn1, hrgn3, RGN_XOR), NULLREGION);
|
||||
|
||||
|
||||
}
|
||||
|
||||
START_TEST(CombineRgn)
|
||||
{
|
||||
Test_CombineRgn_COPY();
|
||||
Test_CombineRgn_AND();
|
||||
Test_CombineRgn_OR();
|
||||
Test_CombineRgn_DIFF();
|
||||
Test_CombineRgn_XOR();
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
extern void func_AddFontResource(void);
|
||||
extern void func_AddFontResourceEx(void);
|
||||
extern void func_BeginPath(void);
|
||||
extern void func_CombineRgn(void);
|
||||
extern void func_CombineTransform(void);
|
||||
extern void func_CreateBitmap(void);
|
||||
extern void func_CreateBitmapIndirect(void);
|
||||
@@ -61,6 +62,7 @@ const struct test winetest_testlist[] =
|
||||
{ "AddFontResource", func_AddFontResource },
|
||||
{ "AddFontResourceEx", func_AddFontResourceEx },
|
||||
{ "BeginPath", func_BeginPath },
|
||||
{ "CombineRgn", func_CombineRgn },
|
||||
{ "CombineTransform", func_CombineTransform },
|
||||
{ "CreateBitmap", func_CreateBitmap },
|
||||
{ "CreateBitmapIndirect", func_CreateBitmapIndirect },
|
||||
|
||||
Reference in New Issue
Block a user