windowscodecs/tests: Test with SHCreateMemStream.
SHCreateMemStream takes less code to inialize and is preferred over CreateStreamOnHGlobal according to documentation. Signed-off-by: Viktor Semykin <thesame.ml@gmail.com> Signed-off-by: Vincent Povirk <vincent@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2d5c861f75
commit
2fcfe35e88
@ -1,5 +1,5 @@
|
|||||||
TESTDLL = windowscodecs.dll
|
TESTDLL = windowscodecs.dll
|
||||||
IMPORTS = windowscodecs oleaut32 ole32 user32 gdi32
|
IMPORTS = windowscodecs oleaut32 ole32 user32 gdi32 shlwapi
|
||||||
|
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
bitmap.c \
|
bitmap.c \
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "wincodec.h"
|
#include "wincodec.h"
|
||||||
#include "wine/test.h"
|
#include "wine/test.h"
|
||||||
|
#include "shlwapi.h"
|
||||||
|
|
||||||
/* 1x1 pixel PNG image */
|
/* 1x1 pixel PNG image */
|
||||||
static const char png_no_color_profile[] = {
|
static const char png_no_color_profile[] = {
|
||||||
@ -277,8 +278,6 @@ static IWICImagingFactory *factory;
|
|||||||
|
|
||||||
static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size)
|
static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size)
|
||||||
{
|
{
|
||||||
HGLOBAL hmem;
|
|
||||||
BYTE *data;
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
IWICBitmapDecoder *decoder = NULL;
|
IWICBitmapDecoder *decoder = NULL;
|
||||||
IStream *stream;
|
IStream *stream;
|
||||||
@ -287,13 +286,8 @@ static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size
|
|||||||
ULARGE_INTEGER pos;
|
ULARGE_INTEGER pos;
|
||||||
LARGE_INTEGER zero;
|
LARGE_INTEGER zero;
|
||||||
|
|
||||||
hmem = GlobalAlloc(0, image_size);
|
stream = SHCreateMemStream (image_data, image_size);
|
||||||
data = GlobalLock(hmem);
|
ok(stream != NULL, "SHCreateMemStream error\n");
|
||||||
memcpy(data, image_data, image_size);
|
|
||||||
GlobalUnlock(hmem);
|
|
||||||
|
|
||||||
hr = CreateStreamOnHGlobal(hmem, TRUE, &stream);
|
|
||||||
ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr);
|
|
||||||
|
|
||||||
hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
|
hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
|
||||||
ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
|
ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user