[PATCH 08/12] windowscodecs: Add tests for IWICStream_Seek with memory streams
Tony Wasserka
tony.wasserka at freenet.de
Tue Aug 18 08:58:48 CDT 2009
---
dlls/windowscodecs/tests/stream.c | 40 +++++++++++++++++++++++++++++++++++++
1 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/dlls/windowscodecs/tests/stream.c b/dlls/windowscodecs/tests/stream.c
index efb9b15..95d87ab 100644
--- a/dlls/windowscodecs/tests/stream.c
+++ b/dlls/windowscodecs/tests/stream.c
@@ -32,8 +32,12 @@ static void test_StreamOnMemory()
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
};
BYTE Memory[64];
+ LARGE_INTEGER LargeNull, LargeInt;
+ ULARGE_INTEGER uNewPos;
HRESULT hr;
+ LargeNull.QuadPart = 0;
+
memcpy(Memory, CmpMem, sizeof(CmpMem));
CoInitialize(NULL);
@@ -70,6 +74,42 @@ static void test_StreamOnMemory()
ok(hr == S_OK, "InitializeFromMemory returned with %#x, expected %#x\n", hr, S_OK);
+ /* Seek */
+ hr = IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_SET, &uNewPos);
+ ok(hr == S_OK, "Seek returned with %#x, expected %#x\n", hr, S_OK);
+ ok(uNewPos.HighPart == 0 && uNewPos.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.HighPart, uNewPos.LowPart, 0, 0);
+
+ hr = IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_SET, NULL);
+ ok(hr == S_OK, "Seek returned with %#x, expected %#x\n", hr, S_OK);
+
+ LargeInt.HighPart = 1;
+ LargeInt.LowPart = 0;
+ hr = IWICStream_Seek(pStream, LargeInt, STREAM_SEEK_SET, &uNewPos);
+ ok(hr == HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW), "Seek returned with %#x, expected %#x\n", hr, HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW));
+ ok(uNewPos.HighPart == 0 && uNewPos.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.HighPart, uNewPos.LowPart, 0, 0);
+
+ LargeInt.QuadPart = sizeof(Memory) + 10;
+ hr = IWICStream_Seek(pStream, LargeInt, STREAM_SEEK_SET, &uNewPos);
+ ok(hr == E_INVALIDARG, "Seek returned with %#x, expected %#x\n", hr, E_INVALIDARG);
+ ok(uNewPos.HighPart == 0 && uNewPos.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.HighPart, uNewPos.LowPart, 0, 0);
+
+ LargeInt.QuadPart = 1;
+ hr = IWICStream_Seek(pStream, LargeInt, STREAM_SEEK_END, &uNewPos);
+ ok(hr == E_INVALIDARG, "Seek returned with %#x, expected %#x\n", hr, E_INVALIDARG);
+ ok(uNewPos.HighPart == 0 && uNewPos.LowPart == 0, "Seek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.HighPart, uNewPos.LowPart, 0, 0);
+
+ LargeInt.QuadPart = -1;
+ hr = IWICStream_Seek(pStream, LargeInt, STREAM_SEEK_END, &uNewPos);
+ ok(hr == S_OK, "Seek returned with %#x, expected %#x\n", hr, S_OK);
+ ok(uNewPos.HighPart == 0 && uNewPos.LowPart == sizeof(Memory) - 1, "bSeek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.HighPart, uNewPos.LowPart, 0, sizeof(Memory) - 1);
+
+ IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_SET, &uNewPos); /* reset seek pointer */
+ LargeInt.QuadPart = -sizeof(Memory) - 5;
+ hr = IWICStream_Seek(pStream, LargeInt, STREAM_SEEK_END, &uNewPos);
+ ok(hr == E_INVALIDARG, "Seek returned with %#x, expected %#x\n", hr, E_INVALIDARG);
+ ok(uNewPos.HighPart == 0 && uNewPos.LowPart == 0, "bSeek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.HighPart, uNewPos.LowPart, 0, 0); /* remains unchanged */
+
+
IWICStream_Release(pStream);
IWICStream_Release(pFactory);
CoUninitialize();
--
1.6.3.3
--------------090908060005000306090105--
More information about the wine-patches
mailing list