From ff5076c0082d090133be8c8fa1a4bee66e6b9ed8 Mon Sep 17 00:00:00 2001 From: Evan Stade Date: Mon, 30 Jul 2007 19:09:08 -0700 Subject: [PATCH] gdi32: Added more tests for ExtCreatePen on PS_USERSTLYE. --- dlls/gdi32/tests/pen.c | 75 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/dlls/gdi32/tests/pen.c b/dlls/gdi32/tests/pen.c index 77073f173e2..0de3f0de423 100644 --- a/dlls/gdi32/tests/pen.c +++ b/dlls/gdi32/tests/pen.c @@ -482,8 +482,83 @@ static void test_ps_alternate(void) DeleteDC(hdc); } +static void test_ps_userstyle(void) +{ + static DWORD style[17] = {0, 2, 0, 4, 5, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 17}; + static DWORD bad_style[5] = {0, 0, 0, 0, 0}; + static DWORD bad_style2[5] = {4, 7, 8, 3, -1}; + + LOGBRUSH lb; + HPEN pen; + INT size, i; + + struct + { + EXTLOGPEN elp; + DWORD style_data[15]; + } ext_pen; + + lb.lbColor = 0x00ff0000; + lb.lbStyle = BS_SOLID; + lb.lbHatch = 0; + + pen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 50, &lb, 3, NULL); + ok(pen == 0, "ExtCreatePen should fail\n"); + expect(ERROR_INVALID_PARAMETER, GetLastError()); + DeleteObject(pen); + SetLastError(0xdeadbeef); + + pen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 50, &lb, 0, style); + ok(pen == 0, "ExtCreatePen should fail\n"); + todo_wine + expect(0xdeadbeef, GetLastError()); + DeleteObject(pen); + SetLastError(0xdeadbeef); + + pen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 50, &lb, 17, style); + ok(pen == 0, "ExtCreatePen should fail\n"); + expect(ERROR_INVALID_PARAMETER, GetLastError()); + DeleteObject(pen); + SetLastError(0xdeadbeef); + + pen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 50, &lb, -1, style); + ok(pen == 0, "ExtCreatePen should fail\n"); + todo_wine + expect(0xdeadbeef, GetLastError()); + DeleteObject(pen); + SetLastError(0xdeadbeef); + + pen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 50, &lb, 5, bad_style); + todo_wine + ok(pen == 0, "ExtCreatePen should fail\n"); + todo_wine + expect(ERROR_INVALID_PARAMETER, GetLastError()); + DeleteObject(pen); + SetLastError(0xdeadbeef); + + pen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 50, &lb, 5, bad_style2); + todo_wine + ok(pen == 0, "ExtCreatePen should fail\n"); + todo_wine + expect(ERROR_INVALID_PARAMETER, GetLastError()); + DeleteObject(pen); + SetLastError(0xdeadbeef); + + pen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 50, &lb, 16, style); + ok(pen != 0, "ExtCreatePen should not fail\n"); + + size = GetObject(pen, sizeof(ext_pen), &ext_pen); + expect(88, size); + + for(i = 0; i < 16; i++) + expect(style[i], ext_pen.elp.elpStyleEntry[i]); + + DeleteObject(pen); +} + START_TEST(pen) { test_logpen(); test_ps_alternate(); + test_ps_userstyle(); }