Dmitry Timoshkov : gdi: Add a test which shows that GDI does not
support compressed DIB sections.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Jan 3 06:37:36 CST 2006
Module: wine
Branch: refs/heads/master
Commit: 6f7b62b729f1ee79e82c149ed0ca3d1e06d86e38
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=6f7b62b729f1ee79e82c149ed0ca3d1e06d86e38
Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date: Tue Jan 3 12:09:22 2006 +0100
gdi: Add a test which shows that GDI does not support compressed DIB sections.
---
dlls/gdi/tests/bitmap.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/dlls/gdi/tests/bitmap.c b/dlls/gdi/tests/bitmap.c
index edad192..5eeda35 100644
--- a/dlls/gdi/tests/bitmap.c
+++ b/dlls/gdi/tests/bitmap.c
@@ -198,9 +198,67 @@ static void test_dibsections(void)
COLORREF c0, c1;
int i;
int screen_depth;
+ MEMORY_BASIC_INFORMATION info;
hdc = GetDC(0);
screen_depth = GetDeviceCaps(hdc, BITSPIXEL) * GetDeviceCaps(hdc, PLANES);
+
+ memset(pbmi, 0, sizeof(bmibuf));
+ pbmi->bmiHeader.biSize = sizeof(pbmi->bmiHeader);
+ pbmi->bmiHeader.biHeight = 100;
+ pbmi->bmiHeader.biWidth = 512;
+ pbmi->bmiHeader.biBitCount = 24;
+ pbmi->bmiHeader.biPlanes = 1;
+ pbmi->bmiHeader.biCompression = BI_RGB;
+
+ SetLastError(0xdeadbeef);
+ hdib = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
+ ok(hdib != NULL, "CreateDIBSection error %ld\n", GetLastError());
+ ok(GetObject(hdib, sizeof(DIBSECTION), &dibsec) != 0, "GetObject failed for DIBSection\n");
+ ok(dibsec.dsBm.bmBits == bits, "dibsec.dsBits %p != bits %p\n", dibsec.dsBm.bmBits, bits);
+
+ /* test the DIB memory */
+ ok(VirtualQuery(bits, &info, sizeof(info)) == sizeof(info),
+ "VirtualQuery failed\n");
+ ok(info.BaseAddress == bits, "%p != %p\n", info.BaseAddress, bits);
+ ok(info.AllocationBase == bits, "%p != %p\n", info.AllocationBase, bits);
+ ok(info.AllocationProtect == PAGE_READWRITE, "%lx != PAGE_READWRITE\n", info.AllocationProtect);
+ ok(info.RegionSize == 0x26000, "0x%lx != 0x26000\n", info.RegionSize);
+ ok(info.State == MEM_COMMIT, "%lx != MEM_COMMIT\n", info.State);
+ ok(info.Protect == PAGE_READWRITE, "%lx != PAGE_READWRITE\n", info.Protect);
+ ok(info.Type == MEM_PRIVATE, "%lx != MEM_PRIVATE\n", info.Type);
+
+ DeleteObject(hdib);
+
+ pbmi->bmiHeader.biBitCount = 8;
+ pbmi->bmiHeader.biCompression = BI_RLE8;
+ SetLastError(0xdeadbeef);
+ hdib = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
+ ok(hdib == NULL, "CreateDIBSection should fail when asked to create a compressed DIB section\n");
+ ok(GetLastError() == 0xdeadbeef, "wrong error %ld\n", GetLastError());
+
+ pbmi->bmiHeader.biBitCount = 16;
+ pbmi->bmiHeader.biCompression = BI_BITFIELDS;
+ ((PDWORD)pbmi->bmiColors)[0] = 0xf800;
+ ((PDWORD)pbmi->bmiColors)[1] = 0x07e0;
+ ((PDWORD)pbmi->bmiColors)[2] = 0x001f;
+ SetLastError(0xdeadbeef);
+ hdib = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
+ ok(hdib != NULL, "CreateDIBSection error %ld\n", GetLastError());
+
+ /* test the DIB memory */
+ ok(VirtualQuery(bits, &info, sizeof(info)) == sizeof(info),
+ "VirtualQuery failed\n");
+ ok(info.BaseAddress == bits, "%p != %p\n", info.BaseAddress, bits);
+ ok(info.AllocationBase == bits, "%p != %p\n", info.AllocationBase, bits);
+ ok(info.AllocationProtect == PAGE_READWRITE, "%lx != PAGE_READWRITE\n", info.AllocationProtect);
+ ok(info.RegionSize == 0x19000, "0x%lx != 0x19000\n", info.RegionSize);
+ ok(info.State == MEM_COMMIT, "%lx != MEM_COMMIT\n", info.State);
+ ok(info.Protect == PAGE_READWRITE, "%lx != PAGE_READWRITE\n", info.Protect);
+ ok(info.Type == MEM_PRIVATE, "%lx != MEM_PRIVATE\n", info.Type);
+
+ DeleteObject(hdib);
+
memset(pbmi, 0, sizeof(bmibuf));
pbmi->bmiHeader.biSize = sizeof(pbmi->bmiHeader);
pbmi->bmiHeader.biHeight = 16;
More information about the wine-cvs
mailing list