Commit 8d75d949 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

windowscodecs: Fix return values for scaler's CopyPalette().

parent a05ce6ac
......@@ -163,7 +163,7 @@ static HRESULT WINAPI BitmapScaler_CopyPalette(IWICBitmapScaler *iface,
return E_INVALIDARG;
if (!This->source)
return WINCODEC_ERR_WRONGSTATE;
return WINCODEC_ERR_PALETTEUNAVAILABLE;
return IWICBitmapSource_CopyPalette(This->source, pIPalette);
}
......
......@@ -1084,6 +1084,7 @@ static void test_bitmap_scaler(void)
{
WICPixelFormatGUID pixel_format;
IWICBitmapScaler *scaler;
IWICPalette *palette;
double res_x, res_y;
IWICBitmap *bitmap;
UINT width, height;
......@@ -1148,6 +1149,15 @@ static void test_bitmap_scaler(void)
ok(width == 123, "Unexpected width %u.\n", width);
ok(height == 321, "Unexpected height %u.\n", height);
hr = IWICBitmapScaler_CopyPalette(scaler, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "Failed to create a palette, hr %#x.\n", hr);
hr = IWICBitmapScaler_CopyPalette(scaler, palette);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "Unexpected hr %#x.\n", hr);
IWICPalette_Release(palette);
hr = IWICBitmapScaler_Initialize(scaler, (IWICBitmapSource *)bitmap, 4, 0,
WICBitmapInterpolationModeNearestNeighbor);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
......@@ -1224,6 +1234,12 @@ static void test_bitmap_scaler(void)
ok(hr == S_OK, "Failed to get scaler resolution, hr %#x.\n", hr);
ok(res_x == 0.0 && res_y == 0.0, "Unexpected resolution %f x %f.\n", res_x, res_y);
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "Failed to create a palette, hr %#x.\n", hr);
hr = IWICBitmapScaler_CopyPalette(scaler, palette);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "Unexpected hr %#x.\n", hr);
IWICPalette_Release(palette);
IWICBitmapScaler_Release(scaler);
IWICBitmap_Release(bitmap);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment