Module: wine Branch: master Commit: b70066007511aba97df730695b73e0759bc7e0a1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b70066007511aba97df730695b...
Author: Huw Davies huw@codeweavers.com Date: Wed Oct 19 12:41:53 2011 +0100
gdi32/tests: Add tests for non-rgb colorrefs.
---
dlls/gdi32/tests/dib.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/dlls/gdi32/tests/dib.c b/dlls/gdi32/tests/dib.c index 5577918..4c81330 100644 --- a/dlls/gdi32/tests/dib.c +++ b/dlls/gdi32/tests/dib.c @@ -27,6 +27,7 @@ #include "wingdi.h" #include "winuser.h" #include "wincrypt.h" +#include "mmsystem.h" /* DIBINDEX */
#include "wine/test.h"
@@ -129,6 +130,7 @@ static const char *sha1_graphics_a8r8g8b8[] = "d7dd4700f49808541bba99244b7eb5840e0a2439", "af99228aa4cfbd1f61bd824db046144a3c6c2ed7", "568f87f0194ca19b69a5b2bcdef795d89c5721ce", + "257d114354a93e681225072bcde756f155b70496", NULL };
@@ -186,6 +188,7 @@ static const char *sha1_graphics_a8b8g8r8[] = "86c84cc8306975edecc6d4a89a8aff29f59b55a7", "af99228aa4cfbd1f61bd824db046144a3c6c2ed7", "25675c30adfe24d6cae60793b156dfdaa36ac3ba", + "2c4f116451b571106beba8b85da8e4b923937246", NULL };
@@ -243,6 +246,7 @@ static const char *sha1_graphics_r10g10b10[] = "fc0c32afb719295f28bcfef22803bef94f798e20", "36f6db4fbe2a1630a7597d3a446f2902755c96ef", "d3f08946300e1700865042aed121870e292d1095", + "abb56db94becb64d663b51f0ea6b4bd535a88ba0", NULL };
@@ -300,6 +304,7 @@ static const char *sha1_graphics_r6g6b6[] = "49341c297a887186bd47d7465d827ab3147f05e3", "325279e76367200d3fd7194d81c09fd139988ece", "c3def160a1e847605ff0fc7edd30397fa90635a0", + "50acb1597c4d53ad63225376d2aa36f64e8a229d", NULL };
@@ -357,6 +362,7 @@ static const char *sha1_graphics_24[] = "b25ba91487ec945410deb2b51bc1156890c032a8", "d347ca5c6c4b6a61389247c3b6f61564033e8c25", "ee315634ed92da3a32c2675ecd1b369471c60936", + "3491e2bd81e70dd203c8551cc2d39b19401caafe", NULL };
@@ -418,6 +424,7 @@ static const char *sha1_graphics_r5g5b5[] = "3772003c7fb420003512d0c437b3659d96d89ce4", "dab47c9dc149e570045d699598b14a613bf319b3", "2daca4d26a086ed34894693be0b0374402232809", + "bf0e0b74ce5686b73c527843e0d0df0cd10efefe", NULL };
@@ -474,6 +481,7 @@ static const char *sha1_graphics_r4g4b4[] = "f0acb3cfcda62e95bee5f7bc8830ffeb3dd7e5a7", "07b10c3f191d0a93e5e5694aae37dcad407e10f5", "f7900e60347029876ba55e8f0c4c02e89deb36b6", + "734d4a7836891d729f4a9ec6916ead78eecb2596", NULL };
@@ -536,6 +544,7 @@ static const char *sha1_graphics_8_color[] = "9ae38bb94c7b4c0c6dfebbee23d1de4db9b77488", "678979a45126a76eb629992cd64734862f53a555", "2f7ba8803604c032cb1a1228bc021f0f1c03e245", + "0204f06422a01787f7379d0edb51104bb023758a", NULL };
@@ -603,6 +612,7 @@ static const char *sha1_graphics_8_grayscale[] = "3685c9ae95118a83db3569832c29753276fa1264", "09640bad951c33e7d70a1fced83b1869f65b3fc5", "cb9ea8137eca1450e049879772f5c11a0e11ff0a", + "a05e05b2e6e515baa59ea032d063ca11e70a72b5", NULL };
@@ -663,6 +673,7 @@ static const char *sha1_graphics_8[] = "31e667c2dbb81dcf81d01cb88f794e88ddb90ff2", "465d9cd0a77ab4fcf035aa67544b2a26269e0b09", "600d6b2713d5e4c0d90c02660245ed26c7ae3033", + "963d1fa8608c8b743e972eb9a4e9f3fc53c6c7e8", NULL };
@@ -719,6 +730,7 @@ static const char *sha1_graphics_4[] = "df5feb905a31c288008cf5e82d73ac818a160d82", "d8af3868c66c7d6dac35ec8ee0317b38a6910bb1", "ec8e2aebfb4a1c28ebcd0e053b9e4d8638b50951", + "da401c745421f6bdfaefd590ab99dee948dce412", NULL };
@@ -775,6 +787,7 @@ static const char *sha1_graphics_4_grayscale[] = "f8681c09f1abfc38d31e47622cb8798cd896a00e", "b5ee51cfc73acb59a2f6124509ea236f8fc7f9f7", "d374d4d92c940ae42a9b42c14d744341b68a8c14", + "25ec9fd2eeb1514ba4e0458a444149a5456cf63a", NULL };
@@ -846,6 +859,7 @@ static const char *sha1_graphics_1[] = "23366004515f3bc46796ea505d748f8d0f97fbe1", "88763f8e8fcf4f78fa864325791a9dd35a0bd279", "013cee26bac8f815eadad4bfc012d9b5d01c3b7f", + "6b2cb2346b5820bdd0251cd6a4aeb5c22ee82e85", NULL };
@@ -1055,6 +1069,14 @@ static const DWORD four_by_four_data[16] = { 0x000000, 0xff0000, 0x00ff00, 0x000 0x000000, 0xff0000, 0x00ff00, 0x0000ff, 0xffffff, 0x00ffff, 0xff00ff, 0xffff00 };
+static inline void solid_patblt( HDC hdc, int x, int y, int width, int height, COLORREF color ) +{ + HBRUSH brush = CreateSolidBrush( color ); + brush = SelectObject( hdc, brush ); + PatBlt( hdc, x, y, width, height, PATCOPY ); + DeleteObject( SelectObject( hdc, brush ) ); +} + static void draw_graphics(HDC hdc, BITMAPINFO *bmi, BYTE *bits, const char ***sha1) { DWORD dib_size = get_dib_size(bmi); @@ -1925,7 +1947,32 @@ static void draw_graphics(HDC hdc, BITMAPINFO *bmi, BYTE *bits, const char ***sh ok(ret == -4, "got %d\n", ret);
compare_hash_broken_todo( bmi, bits, sha1, "stretchdibits", dib_is_8bpp_gray ? 1 : 0, dib_is_8bpp_gray ); + memset(bits, 0xcc, dib_size); + + /* Solid colors */ + for (i = 0; i < 256; i++) + { + solid_patblt( hdc, i * 2, 10, 1, 1, DIBINDEX(i) ); + solid_patblt( hdc, i * 2, 20, 1, 1, PALETTEINDEX(i) ); + solid_patblt( hdc, i * 2, 30, 1, 1, RGB( (i & 0x07) << 5, (i & 0x38) << 2, i & 0xc0 ) ); + solid_patblt( hdc, i * 2, 40, 1, 1, PALETTERGB( (i & 0x07) << 5, (i & 0x38) << 2, i & 0xc0 ) ); + } + + /* A few extra colors that are interesting in the 1bpp case */ + + /* bk color */ + solid_patblt( hdc, 0, 50, 1, 1, RGB( 0, 0xff, 0 ) ); + solid_patblt( hdc, 2, 50, 1, 1, PALETTERGB( 0, 0xff, 0 ) ); + + /* color 0 */ + solid_patblt( hdc, 4, 50, 1, 1, RGB( 0, 0x1, 0xff ) ); + solid_patblt( hdc, 6, 50, 1, 1, PALETTERGB( 0, 0x1, 0xff ) ); + + /* color 1 */ + solid_patblt( hdc, 8, 50, 1, 1, RGB( 0xff, 0, 0 ) ); + solid_patblt( hdc, 10, 50, 1, 1, PALETTERGB( 0xff, 0, 0 ) );
+ compare_hash(bmi, bits, sha1, "Colors"); memset(bits, 0xcc, dib_size);
SelectObject(hdc, orig_brush);