Commit b2de6948 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

oleaut32/tests: Add some tests for IPicture::SaveAsFile.

parent 0636a700
......@@ -1052,7 +1052,9 @@ static void test_load_save_bmp(void)
DWORD *mem;
IPersistStream *src_stream;
IStream *dst_stream;
LARGE_INTEGER offset;
HRESULT hr;
LONG size;
desc.cbSizeofstruct = sizeof(desc);
desc.picType = PICTYPE_BITMAP;
......@@ -1074,6 +1076,27 @@ static void test_load_save_bmp(void)
hr = CreateStreamOnHGlobal(hmem, FALSE, &dst_stream);
ok(hr == S_OK, "createstreamonhglobal error %#x\n", hr);
size = -1;
hr = IPicture_SaveAsFile(pic, dst_stream, TRUE, &size);
ok(hr == S_OK, "IPicture_SaveasFile error %#x\n", hr);
todo_wine
ok(size == 66, "expected 66, got %d\n", size);
mem = GlobalLock(hmem);
todo_wine
ok(!memcmp(&mem[0], "BM", 2), "got wrong bmp header %04x\n", mem[0]);
GlobalUnlock(hmem);
size = -1;
hr = IPicture_SaveAsFile(pic, dst_stream, FALSE, &size);
todo_wine
ok(hr == E_FAIL, "expected E_FAIL, got %#x\n", hr);
todo_wine
ok(size == -1, "expected -1, got %d\n", size);
offset.QuadPart = 0;
hr = IStream_Seek(dst_stream, offset, SEEK_SET, NULL);
ok(hr == S_OK, "IStream_Seek %#x\n", hr);
hr = IPicture_QueryInterface(pic, &IID_IPersistStream, (void **)&src_stream);
ok(hr == S_OK, "QueryInterface error %#x\n", hr);
......@@ -1105,7 +1128,9 @@ static void test_load_save_icon(void)
DWORD *mem;
IPersistStream *src_stream;
IStream *dst_stream;
LARGE_INTEGER offset;
HRESULT hr;
LONG size;
desc.cbSizeofstruct = sizeof(desc);
desc.picType = PICTYPE_ICON;
......@@ -1126,6 +1151,27 @@ static void test_load_save_icon(void)
hr = CreateStreamOnHGlobal(hmem, FALSE, &dst_stream);
ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr);
size = -1;
hr = IPicture_SaveAsFile(pic, dst_stream, TRUE, &size);
ok(hr == S_OK, "IPicture_SaveasFile error %#x\n", hr);
todo_wine
ok(size == 766, "expected 766, got %d\n", size);
mem = GlobalLock(hmem);
todo_wine
ok(mem[0] == 0x00010000, "got wrong icon header %04x\n", mem[0]);
GlobalUnlock(hmem);
size = -1;
hr = IPicture_SaveAsFile(pic, dst_stream, FALSE, &size);
todo_wine
ok(hr == E_FAIL, "expected E_FAIL, got %#x\n", hr);
todo_wine
ok(size == -1, "expected -1, got %d\n", size);
offset.QuadPart = 0;
hr = IStream_Seek(dst_stream, offset, SEEK_SET, NULL);
ok(hr == S_OK, "IStream_Seek %#x\n", hr);
hr = IPicture_QueryInterface(pic, &IID_IPersistStream, (void **)&src_stream);
ok(hr == S_OK, "QueryInterface error %#x\n", hr);
......@@ -1160,6 +1206,7 @@ static void test_load_save_empty_picture(void)
IStream *dst_stream, *stream;
LARGE_INTEGER offset;
HRESULT hr;
LONG size;
memset(&pic, 0, sizeof(pic));
desc.cbSizeofstruct = sizeof(desc);
......@@ -1169,7 +1216,7 @@ static void test_load_save_empty_picture(void)
type = -1;
hr = IPicture_get_Type(pic, &type);
ok(hr == S_OK,"get_Type error %#8x\n", hr);
ok(hr == S_OK, "get_Type error %#x\n", hr);
ok(type == PICTYPE_NONE,"expected picture type PICTYPE_NONE, got %d\n", type);
handle = (OLE_HANDLE)0xdeadbeef;
......@@ -1181,6 +1228,18 @@ static void test_load_save_empty_picture(void)
hr = CreateStreamOnHGlobal(hmem, FALSE, &dst_stream);
ok(hr == S_OK, "createstreamonhglobal error %#x\n", hr);
size = -1;
hr = IPicture_SaveAsFile(pic, dst_stream, TRUE, &size);
ok(hr == S_OK, "IPicture_SaveasFile error %#x\n", hr);
todo_wine
ok(size == -1, "expected -1, got %d\n", size);
size = -1;
hr = IPicture_SaveAsFile(pic, dst_stream, FALSE, &size);
ok(hr == S_OK, "IPicture_SaveasFile error %#x\n", hr);
todo_wine
ok(size == -1, "expected -1, got %d\n", size);
hr = IPicture_QueryInterface(pic, &IID_IPersistStream, (void **)&src_stream);
ok(hr == S_OK, "QueryInterface error %#x\n", hr);
......
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