Vincent Povirk : windowscodecs: Add test showing CreateBitmapFromMemory copies the data.

Alexandre Julliard julliard at winehq.org
Thu Jan 3 13:31:12 CST 2013


Module: wine
Branch: master
Commit: 5e3e7304a1bf28e692f6b0b3b7010dc15aee4f12
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5e3e7304a1bf28e692f6b0b3b7010dc15aee4f12

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Wed Jan  2 13:25:18 2013 -0600

windowscodecs: Add test showing CreateBitmapFromMemory copies the data.

---

 dlls/windowscodecs/tests/bitmap.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/windowscodecs/tests/bitmap.c b/dlls/windowscodecs/tests/bitmap.c
index cec714b..af0446c 100644
--- a/dlls/windowscodecs/tests/bitmap.c
+++ b/dlls/windowscodecs/tests/bitmap.c
@@ -421,10 +421,11 @@ static void test_createbitmapfromsource(void)
 
 static void test_CreateBitmapFromMemory(void)
 {
-    BYTE data3x3[27] = {
+    BYTE orig_data3x3[27] = {
         128,128,255, 128,128,128, 128,255,128,
         128,128,128, 128,128,128, 255,255,255,
         255,128,128, 255,255,255, 255,255,255 };
+    BYTE data3x3[27];
     BYTE data3x2[27] = {
         128,128,255, 128,128,128, 128,255,128,
         0,0,0, 0,128,128, 255,255,255,
@@ -434,6 +435,8 @@ static void test_CreateBitmapFromMemory(void)
     IWICBitmap *bitmap;
     UINT width, height, i;
 
+    memcpy(data3x3, orig_data3x3, sizeof(data3x3));
+
     hr = IWICImagingFactory_CreateBitmapFromMemory(factory, 3, 3, &GUID_WICPixelFormat24bppBGR,
                                                    0, 0, NULL, &bitmap);
 todo_wine
@@ -470,16 +473,18 @@ todo_wine
     ok(width == 3, "expected 3, got %u\n", width);
     ok(height == 3, "expected 3, got %u\n", height);
 
+    data3x3[2] = 192;
+
     memset(data, 0, sizeof(data));
     hr = IWICBitmap_CopyPixels(bitmap, NULL, 9, sizeof(data), data);
     ok(hr == S_OK, "IWICBitmap_CopyPixels error %#x\n", hr);
     for (i = 0; i < sizeof(data); i++)
-        ok(data[i] == data3x3[i], "%u: expected %u, got %u\n", i, data[i], data3x3[i]);
+        ok(data[i] == orig_data3x3[i], "%u: expected %u, got %u\n", i, data[i], data3x3[i]);
 
     IWICBitmap_Release(bitmap);
 
     hr = IWICImagingFactory_CreateBitmapFromMemory(factory, 3, 2, &GUID_WICPixelFormat24bppBGR,
-                                                   13, sizeof(data3x3), data3x3, &bitmap);
+                                                   13, sizeof(orig_data3x3), orig_data3x3, &bitmap);
     ok(hr == S_OK, "IWICImagingFactory_CreateBitmapFromMemory error %#x\n", hr);
     if (hr != S_OK) return;
 




More information about the wine-cvs mailing list