From: Dmitry Timoshkov dmitry@baikal.ru
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/windowscodecs/tests/bitmap.c | 65 +++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+)
diff --git a/dlls/windowscodecs/tests/bitmap.c b/dlls/windowscodecs/tests/bitmap.c index f070eaeb47f..85e4ebaa04d 100644 --- a/dlls/windowscodecs/tests/bitmap.c +++ b/dlls/windowscodecs/tests/bitmap.c @@ -1476,6 +1476,70 @@ static void test_IMILBitmap(void) IWICBitmap_Release(bitmap); }
+static void test_FlipRotator(void) +{ + static BYTE data[] = { 1,2,3, 4,5,6 }; + static BYTE data_rotate90[] = { 4,1, 5,2, 6,3 }; + HRESULT hr; + IWICBitmap *bitmap; + IWICPalette *palette; + IWICBitmapFlipRotator *fr; + WICColor colors[256]; + WICRect rc; + UINT width, height; + BYTE buf[sizeof(data)]; + int i, ret; + + hr = IWICImagingFactory_CreateBitmapFromMemory(factory, 3, 2, &GUID_WICPixelFormat8bppIndexed, + 3, sizeof(data), data, &bitmap); + ok(hr == S_OK, "got %#lx\n", hr); + + hr = IWICImagingFactory_CreatePalette(factory, &palette); + ok(hr == S_OK, "got %#lx\n", hr); + + for (i = 0; i < 256; i++) + colors[i] = i; + hr = IWICPalette_InitializeCustom(palette, colors, 256); + ok(hr == S_OK, "got %#lx\n", hr); + + hr = IWICBitmap_SetPalette(bitmap, palette); + ok(hr == S_OK, "got %#lx\n", hr); + + hr = IWICImagingFactory_CreateBitmapFlipRotator(factory, &fr); + ok(hr == S_OK, "got %#lx\n", hr); + + hr = IWICBitmapFlipRotator_Initialize(fr, (IWICBitmapSource *)bitmap, WICBitmapTransformRotate90); + ok(hr == S_OK, "got %#lx\n", hr); + + hr = IWICBitmapFlipRotator_GetSize(fr, &width, &height); + ok(hr == S_OK, "got %#lx\n", hr); + ok(width == 2, "got %u\n", width); + ok(height == 3, "got %u\n", height); + + rc.X = 0; + rc.Y = 0; + rc.Width = width; + rc.Height = height; + memset(buf, 0, sizeof(buf)); + hr = IWICBitmapFlipRotator_CopyPixels(fr, &rc, 2, sizeof(buf), buf); + todo_wine + ok(hr == S_OK, "got %#lx\n", hr); + ret = !memcmp(buf, data_rotate90, sizeof(data_rotate90)); + todo_wine + ok(ret, "data mismatch\n"); + if (!ret && winetest_debug > 1) + { + printf("got data:\n"); + for (i = 0; i < sizeof(buf); i++) + printf(" %u", buf[i]); + printf("\n"); + } + + IWICBitmapFlipRotator_Release(fr); + IWICPalette_Release(palette); + IWICBitmap_Release(bitmap); +} + START_TEST(bitmap) { HRESULT hr; @@ -1494,6 +1558,7 @@ START_TEST(bitmap) test_CreateBitmapFromHBITMAP(); test_clipper(); test_bitmap_scaler(); + test_FlipRotator();
IWICImagingFactory_Release(factory);