Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
-- v2: opcservice: Fix iteration with MovePrevious(). opcservices/tests: Add more tests for MovePrevious(). opcservices: Fix MoveNext() at the collection end. opcservices/tests: Add some more tests for MoveNext(). opcservices/tests: Use stricter return values checks. opcservices/tests: Remove Vista workarounds. opcservices/tests: Use wide-char strings. opcservices/tests: Add tests for ReadPackageFromStream.
From: Vibhav Pant vibhavp@gmail.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/opcservices/tests/opcservices.c | 123 +++++++++++++++++++++++++++ 1 file changed, 123 insertions(+)
diff --git a/dlls/opcservices/tests/opcservices.c b/dlls/opcservices/tests/opcservices.c index 3fa9c732e42..dee2b57534c 100644 --- a/dlls/opcservices/tests/opcservices.c +++ b/dlls/opcservices/tests/opcservices.c @@ -1242,6 +1242,128 @@ static void test_write_package(void) IOpcPackage_Release(package); }
+static void test_read_package(void) +{ + static const struct + { + const WCHAR *type; + const WCHAR *uri; + OPC_COMPRESSION_OPTIONS options; + } + parts[] = + { + { L"type1/subtype1", L"/entry1.11", OPC_COMPRESSION_NONE }, + { L"type1/subtype2", L"/entry2.12", OPC_COMPRESSION_NORMAL }, + { L"type2/subtype1", L"/entry3.21", OPC_COMPRESSION_MAXIMUM }, + { L"type2/subtype2", L"/entry4.22", OPC_COMPRESSION_FAST }, + { L"type1/subtype1", L"/entry5.11", OPC_COMPRESSION_SUPERFAST }, + { L"type1/subtype2", L"/entry6.12", OPC_COMPRESSION_NONE }, + { L"type2/subtype1", L"/entry7.21", OPC_COMPRESSION_NORMAL }, + { L"type2/subtype2", L"/entry8.22", OPC_COMPRESSION_MAXIMUM }, + { L"type1/subtype1", L"/dir1/entry1.11", OPC_COMPRESSION_FAST }, + }; + const LARGE_INTEGER start = {0}; + IOpcFactory *factory; + IOpcPackage *package; + IOpcPartSet *partset; + IOpcPartUri *uri; + IStream *stream; + IOpcPart *part; + BYTE buf[256]; + HRESULT hr; + int i; + + factory = create_factory(); + + hr = IOpcFactory_CreatePackage(factory, &package); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IOpcPackage_GetPartSet(package, &partset); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + for (i = 0; i < ARRAY_SIZE(parts); ++i) + { + hr = IOpcFactory_CreatePartUri(factory, parts[i].uri, &uri); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IOpcPartSet_CreatePart(partset, uri, parts[i].type, parts[i].options, &part); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IOpcPart_GetContentStream(part, &stream); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + memset(buf, i, sizeof(buf)); + hr = IStream_Write(stream, buf, sizeof(buf), NULL); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IStream_Release(stream); + + IOpcPartUri_Release(uri); + IOpcPart_Release(part); + } + IOpcPartSet_Release(partset); + + hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IOpcFactory_WritePackageToStream(factory, package, OPC_WRITE_FORCE_ZIP32, stream); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IOpcPackage_Release(package); + hr = IStream_Seek(stream, start, STREAM_SEEK_SET, NULL); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IOpcFactory_ReadPackageFromStream(factory, stream, OPC_READ_DEFAULT, &package); + todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IStream_Release(stream); + if (FAILED(hr)) goto done; + + hr = IOpcPackage_GetPartSet(package, &partset); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + for (i = 0; i < ARRAY_SIZE(parts); ++i) + { + OPC_COMPRESSION_OPTIONS options; + WCHAR *type = NULL; + BYTE exp_buf[256]; + ULONG read = 0; + + winetest_push_context("parts[%d]", i); + + hr = IOpcFactory_CreatePartUri(factory, parts[i].uri, &uri); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IOpcPartSet_GetPart(partset, uri, &part); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IOpcPart_GetContentType(part, &type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine ok(!wcscmp(type, parts[i].type), "Unexpected type %s != %s.\n", debugstr_w(type), debugstr_w(parts[i].type)); + CoTaskMemFree(type); + + options = ~0u; + hr = IOpcPart_GetCompressionOptions(part, &options); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(options == parts[i].options, "Unexpected options %d != %d.\n", options, parts[i].options); + + hr = IOpcPart_GetContentStream(part, &stream); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + memset(buf, 0, sizeof(buf)); + memset(exp_buf, i, sizeof(exp_buf)); + hr = IStream_Read(stream, buf, sizeof(buf), &read); + ok(hr == S_OK, "Failed to read from stream, hr %#lx.\n", hr); + ok(read == sizeof(buf), "Got read %lu != %Iu.\n", read, sizeof(buf)); + ok(!memcmp(buf, exp_buf, read), "Got mismatching data.\n"); + IStream_Release(stream); + + IOpcPart_Release(part); + IOpcPartUri_Release(uri); + + winetest_pop_context(); + } + + IOpcPartSet_Release(partset); + IOpcPackage_Release(package); +done: + IOpcFactory_Release(factory); +} + START_TEST(opcservices) { IOpcFactory *factory; @@ -1266,6 +1388,7 @@ START_TEST(opcservices) test_combine_uri(); test_create_part_uri(); test_write_package(); + test_read_package();
IOpcFactory_Release(factory);
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/opcservices/tests/opcservices.c | 44 ++++++++++------------------ 1 file changed, 16 insertions(+), 28 deletions(-)
diff --git a/dlls/opcservices/tests/opcservices.c b/dlls/opcservices/tests/opcservices.c index dee2b57534c..37f2637ae11 100644 --- a/dlls/opcservices/tests/opcservices.c +++ b/dlls/opcservices/tests/opcservices.c @@ -36,10 +36,7 @@ static IOpcFactory *create_factory(void)
static void test_package(void) { - static const WCHAR typeW[] = {'t','y','p','e','/','s','u','b','t','y','p','e',0}; - static const WCHAR targetW[] = {'t','a','r','g','e','t',0}; - static const WCHAR uriW[] = {'/','u','r','i',0}; - static const WCHAR rootW[] = {'/',0}; + static const WCHAR typeW[] = L"type/subtype"; IOpcRelationshipSet *relset, *relset2; IOpcPartUri *part_uri, *part_uri2; IOpcPartSet *partset, *partset2; @@ -77,10 +74,10 @@ static void test_package(void) IOpcPartSet_Release(partset2);
/* CreatePart */ - hr = IOpcFactory_CreatePartUri(factory, uriW, &part_uri); + hr = IOpcFactory_CreatePartUri(factory, L"/uri", &part_uri); ok(SUCCEEDED(hr), "Failed to create part uri, hr %#lx.\n", hr);
- hr = IOpcFactory_CreatePartUri(factory, uriW, &part_uri2); + hr = IOpcFactory_CreatePartUri(factory, L"/uri", &part_uri2); ok(SUCCEEDED(hr), "Failed to create part uri, hr %#lx.\n", hr);
part = (void *)0xdeadbeef; @@ -123,7 +120,7 @@ static void test_package(void) ok(SUCCEEDED(hr), "Failed to get part, hr %#lx.\n", hr); IOpcPart_Release(part2);
- hr = IOpcFactory_CreatePartUri(factory, targetW, &part_uri2); + hr = IOpcFactory_CreatePartUri(factory, L"target", &part_uri2); ok(SUCCEEDED(hr), "Failed to create part uri, hr %#lx.\n", hr);
hr = IOpcPartSet_GetPart(partset, part_uri2, &part2); @@ -173,7 +170,7 @@ static void test_package(void) ok(SUCCEEDED(hr), "Failed to get relationship set, hr %#lx.\n", hr); ok(relset == relset2, "Expected same part set instance.\n");
- hr = CreateUri(targetW, Uri_CREATE_ALLOW_RELATIVE, 0, &target_uri); + hr = CreateUri(L"target", Uri_CREATE_ALLOW_RELATIVE, 0, &target_uri); ok(SUCCEEDED(hr), "Failed to create target uri, hr %#lx.\n", hr);
hr = IOpcRelationshipSet_CreateRelationship(relset, NULL, typeW, target_uri, OPC_URI_TARGET_MODE_INTERNAL, &rel); @@ -227,7 +224,7 @@ static void test_package(void) ok(SUCCEEDED(hr), "Failed to create root uri, hr %#lx.\n", hr); hr = IOpcUri_GetRawUri(uri, &str); ok(SUCCEEDED(hr), "Failed to get raw uri, hr %#lx.\n", hr); - ok(!lstrcmpW(str, rootW), "Unexpected uri %s.\n", wine_dbgstr_w(str)); + ok(!lstrcmpW(str, L"/"), "Unexpected uri %s.\n", wine_dbgstr_w(str)); SysFreeString(str); IOpcUri_Release(uri);
@@ -258,7 +255,6 @@ static void test_stream_stat_(unsigned int line, IStream *stream, ULONG size)
static void test_file_stream(void) { - static const WCHAR filereadW[] = {'o','p','c','f','i','l','e','r','e','a','d','.','e','x','t',0}; WCHAR temppathW[MAX_PATH], pathW[MAX_PATH]; IOpcFactory *factory; LARGE_INTEGER move; @@ -274,7 +270,7 @@ static void test_file_stream(void)
GetTempPathW(ARRAY_SIZE(temppathW), temppathW); lstrcpyW(pathW, temppathW); - lstrcatW(pathW, filereadW); + lstrcatW(pathW, L"opcfileread.ext"); DeleteFileW(pathW);
hr = IOpcFactory_CreateStreamOnFile(factory, pathW, OPC_STREAM_IO_READ, NULL, 0, NULL); @@ -333,10 +329,7 @@ static void test_file_stream(void)
static void test_relationship(void) { - static const WCHAR absoluteW[] = {'f','i','l','e',':','/','/','h','o','s','t','/','f','i','l','e','.','t','x','t',0}; - static const WCHAR targetW[] = {'t','a','r','g','e','t',0}; - static const WCHAR typeW[] = {'t','y','p','e',0}; - static const WCHAR rootW[] = {'/',0}; + static const WCHAR typeW[] = L"type"; IUri *target_uri, *target_uri2, *uri; IOpcRelationship *rel, *rel2, *rel3; IOpcUri *source_uri, *source_uri2; @@ -360,10 +353,10 @@ static void test_relationship(void) return; }
- hr = CreateUri(targetW, Uri_CREATE_ALLOW_RELATIVE, 0, &target_uri); + hr = CreateUri(L"target", Uri_CREATE_ALLOW_RELATIVE, 0, &target_uri); ok(SUCCEEDED(hr), "Failed to create target uri, hr %#lx.\n", hr);
- hr = CreateUri(absoluteW, 0, 0, &target_uri2); + hr = CreateUri(L"file://host/file.txt", 0, 0, &target_uri2); ok(SUCCEEDED(hr), "Failed to create target uri, hr %#lx.\n", hr);
hr = IOpcPackage_GetRelationshipSet(package, &rels); @@ -472,7 +465,7 @@ static void test_relationship(void) str = NULL; hr = IOpcUri_GetRawUri(source_uri, &str); ok(SUCCEEDED(hr), "Failed to get raw uri, hr %#lx.\n", hr); - ok(!lstrcmpW(rootW, str), "Unexpected uri %s.\n", wine_dbgstr_w(str)); + ok(!lstrcmpW(L"/", str), "Unexpected uri %s.\n", wine_dbgstr_w(str)); SysFreeString(str);
hr = IOpcRelationship_GetSourceUri(rel2, &source_uri2); @@ -529,7 +522,6 @@ static void test_rel_part_uri(void) { L"/uri/_rels/uri.rels", TRUE }, { L"/_rels/.rels", TRUE }, }; - static const WCHAR testuriW[] = {'/','u','r','i',0}; IOpcPartUri *part_uri; IOpcFactory *factory; IOpcUri *source_uri; @@ -538,7 +530,7 @@ static void test_rel_part_uri(void)
factory = create_factory();
- hr = IOpcFactory_CreatePartUri(factory, testuriW, &part_uri); + hr = IOpcFactory_CreatePartUri(factory, L"/uri", &part_uri); ok(SUCCEEDED(hr), "Failed to create part uri, hr %#lx.\n", hr);
hr = IOpcPartUri_GetRelationshipsPartUri(part_uri, NULL); @@ -653,8 +645,6 @@ static void test_rel_part_uri(void)
static void test_part_enumerator(void) { - static const WCHAR typeW[] = {'t','y','p','e','/','s','u','b','t','y','p','e',0}; - static const WCHAR uriW[] = {'/','u','r','i',0}; IOpcPartEnumerator *partenum, *partenum2; IOpcPart *part, *part2; IOpcPartUri *part_uri; @@ -707,10 +697,10 @@ static void test_part_enumerator(void) ok(hr == S_OK, "Failed to move, hr %#lx.\n", hr); ok(!ret, "Unexpected result %d.\n", ret);
- hr = IOpcFactory_CreatePartUri(factory, uriW, &part_uri); + hr = IOpcFactory_CreatePartUri(factory, L"/uri", &part_uri); ok(SUCCEEDED(hr), "Failed to create part uri, hr %#lx.\n", hr);
- hr = IOpcPartSet_CreatePart(parts, part_uri, typeW, OPC_COMPRESSION_NONE, &part); + hr = IOpcPartSet_CreatePart(parts, part_uri, L"type/subtype", OPC_COMPRESSION_NONE, &part); ok(SUCCEEDED(hr), "Failed to create a part, hr %#lx.\n", hr); IOpcPartUri_Release(part_uri);
@@ -815,8 +805,6 @@ static void test_part_enumerator(void)
static void test_rels_enumerator(void) { - static const WCHAR typeW[] = {'t','y','p','e','/','s','u','b','t','y','p','e',0}; - static const WCHAR targetW[] = {'t','a','r','g','e','t',0}; IOpcRelationshipEnumerator *relsenum, *relsenum2; IOpcRelationship *rel, *rel2; IOpcPackage *package; @@ -869,10 +857,10 @@ static void test_rels_enumerator(void) ok(hr == S_OK, "Failed to move, hr %#lx.\n", hr); ok(!ret, "Unexpected result %d.\n", ret);
- hr = CreateUri(targetW, Uri_CREATE_ALLOW_RELATIVE, 0, &target_uri); + hr = CreateUri(L"target", Uri_CREATE_ALLOW_RELATIVE, 0, &target_uri); ok(SUCCEEDED(hr), "Failed to create target uri, hr %#lx.\n", hr);
- hr = IOpcRelationshipSet_CreateRelationship(rels, NULL, typeW, target_uri, OPC_URI_TARGET_MODE_INTERNAL, &rel); + hr = IOpcRelationshipSet_CreateRelationship(rels, NULL, L"type/subtype", target_uri, OPC_URI_TARGET_MODE_INTERNAL, &rel); ok(SUCCEEDED(hr), "Failed to create relationship, hr %#lx.\n", hr);
IUri_Release(target_uri);
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/opcservices/tests/opcservices.c | 35 ++++------------------------ 1 file changed, 5 insertions(+), 30 deletions(-)
diff --git a/dlls/opcservices/tests/opcservices.c b/dlls/opcservices/tests/opcservices.c index 37f2637ae11..5b9e551ee71 100644 --- a/dlls/opcservices/tests/opcservices.c +++ b/dlls/opcservices/tests/opcservices.c @@ -58,12 +58,7 @@ static void test_package(void) factory = create_factory();
hr = IOpcFactory_CreatePackage(factory, &package); - ok(SUCCEEDED(hr) || broken(hr == E_NOTIMPL) /* Vista */, "Failed to create a package, hr %#lx.\n", hr); - if (FAILED(hr)) - { - IOpcFactory_Release(factory); - return; - } + ok(hr == S_OK, "Failed to create a package, hr %#lx.\n", hr);
hr = IOpcPackage_GetPartSet(package, &partset); ok(SUCCEEDED(hr), "Failed to create a part set, hr %#lx.\n", hr); @@ -346,12 +341,7 @@ static void test_relationship(void) factory = create_factory();
hr = IOpcFactory_CreatePackage(factory, &package); - ok(SUCCEEDED(hr) || broken(hr == E_NOTIMPL) /* Vista */, "Failed to create a package, hr %#lx.\n", hr); - if (FAILED(hr)) - { - IOpcFactory_Release(factory); - return; - } + ok(hr == S_OK, "Failed to create a package, hr %#lx.\n", hr);
hr = CreateUri(L"target", Uri_CREATE_ALLOW_RELATIVE, 0, &target_uri); ok(SUCCEEDED(hr), "Failed to create target uri, hr %#lx.\n", hr); @@ -657,12 +647,7 @@ static void test_part_enumerator(void) factory = create_factory();
hr = IOpcFactory_CreatePackage(factory, &package); - ok(SUCCEEDED(hr) || broken(hr == E_NOTIMPL) /* Vista */, "Failed to create a package, hr %#lx.\n", hr); - if (FAILED(hr)) - { - IOpcFactory_Release(factory); - return; - } + ok(hr == S_OK, "Failed to create a package, hr %#lx.\n", hr);
hr = IOpcPackage_GetPartSet(package, &parts); ok(SUCCEEDED(hr), "Failed to get part set, hr %#lx.\n", hr); @@ -817,12 +802,7 @@ static void test_rels_enumerator(void) factory = create_factory();
hr = IOpcFactory_CreatePackage(factory, &package); - ok(SUCCEEDED(hr) || broken(hr == E_NOTIMPL) /* Vista */, "Failed to create a package, hr %#lx.\n", hr); - if (FAILED(hr)) - { - IOpcFactory_Release(factory); - return; - } + ok(hr == S_OK, "Failed to create a package, hr %#lx.\n", hr);
hr = IOpcPackage_GetRelationshipSet(package, &rels); ok(SUCCEEDED(hr), "Failed to get part set, hr %#lx.\n", hr); @@ -1205,12 +1185,7 @@ static void test_write_package(void) factory = create_factory();
hr = IOpcFactory_CreatePackage(factory, &package); - ok(SUCCEEDED(hr) || broken(hr == E_NOTIMPL) /* Vista */, "Failed to create a package, hr %#lx.\n", hr); - if (FAILED(hr)) - { - IOpcFactory_Release(factory); - return; - } + ok(hr == S_OK, "Failed to create a package, hr %#lx.\n", hr);
hr = IOpcFactory_WritePackageToStream(factory, NULL, OPC_WRITE_FORCE_ZIP32, NULL); ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/opcservices/tests/opcservices.c | 166 +++++++++++++-------------- 1 file changed, 83 insertions(+), 83 deletions(-)
diff --git a/dlls/opcservices/tests/opcservices.c b/dlls/opcservices/tests/opcservices.c index 5b9e551ee71..802837c19cf 100644 --- a/dlls/opcservices/tests/opcservices.c +++ b/dlls/opcservices/tests/opcservices.c @@ -61,19 +61,19 @@ static void test_package(void) ok(hr == S_OK, "Failed to create a package, hr %#lx.\n", hr);
hr = IOpcPackage_GetPartSet(package, &partset); - ok(SUCCEEDED(hr), "Failed to create a part set, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create a part set, hr %#lx.\n", hr);
hr = IOpcPackage_GetPartSet(package, &partset2); - ok(SUCCEEDED(hr), "Failed to create a part set, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create a part set, hr %#lx.\n", hr); ok(partset == partset2, "Expected same part set instance.\n"); IOpcPartSet_Release(partset2);
/* CreatePart */ hr = IOpcFactory_CreatePartUri(factory, L"/uri", &part_uri); - ok(SUCCEEDED(hr), "Failed to create part uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create part uri, hr %#lx.\n", hr);
hr = IOpcFactory_CreatePartUri(factory, L"/uri", &part_uri2); - ok(SUCCEEDED(hr), "Failed to create part uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create part uri, hr %#lx.\n", hr);
part = (void *)0xdeadbeef; hr = IOpcPartSet_CreatePart(partset, NULL, typeW, OPC_COMPRESSION_NONE, &part); @@ -84,9 +84,9 @@ static void test_package(void) ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
hr = IOpcPartSet_CreatePart(partset, part_uri, typeW, 0xdeadbeef, &part); - ok(SUCCEEDED(hr), "Failed to create a part, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create a part, hr %#lx.\n", hr); hr = IOpcPart_GetCompressionOptions(part, &options); - ok(SUCCEEDED(hr), "Failed to get compression options, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get compression options, hr %#lx.\n", hr); ok(options == 0xdeadbeef, "Unexpected compression options %#x.\n", options);
part2 = (void *)0xdeadbeef; @@ -112,11 +112,11 @@ static void test_package(void) ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
hr = IOpcPartSet_GetPart(partset, part_uri, &part2); - ok(SUCCEEDED(hr), "Failed to get part, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get part, hr %#lx.\n", hr); IOpcPart_Release(part2);
hr = IOpcFactory_CreatePartUri(factory, L"target", &part_uri2); - ok(SUCCEEDED(hr), "Failed to create part uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create part uri, hr %#lx.\n", hr);
hr = IOpcPartSet_GetPart(partset, part_uri2, &part2); ok(hr == OPC_E_NO_SUCH_PART, "Unexpected hr %#lx.\n", hr); @@ -126,23 +126,23 @@ static void test_package(void) ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
hr = IOpcPart_GetContentStream(part, &stream); - ok(SUCCEEDED(hr), "Failed to get content stream, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get content stream, hr %#lx.\n", hr);
hr = IStream_Write(stream, "abc", 3, NULL); ok(hr == S_OK, "Failed to write content, hr %#lx.\n", hr);
move.QuadPart = 0; hr = IStream_Seek(stream, move, STREAM_SEEK_CUR, &pos); - ok(SUCCEEDED(hr), "Seek failed, hr %#lx.\n", hr); + ok(hr == S_OK, "Seek failed, hr %#lx.\n", hr); ok(pos.QuadPart == 3, "Unexpected position.\n");
hr = IOpcPart_GetContentStream(part, &stream2); - ok(SUCCEEDED(hr), "Failed to get content stream, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get content stream, hr %#lx.\n", hr); ok(stream != stream2, "Unexpected instance.\n");
move.QuadPart = 0; hr = IStream_Seek(stream2, move, STREAM_SEEK_CUR, &pos); - ok(SUCCEEDED(hr), "Seek failed, hr %#lx.\n", hr); + ok(hr == S_OK, "Seek failed, hr %#lx.\n", hr); ok(pos.QuadPart == 0, "Unexpected position.\n");
memset(buff, 0, sizeof(buff)); @@ -152,27 +152,27 @@ static void test_package(void)
move.QuadPart = 0; hr = IStream_Seek(stream2, move, STREAM_SEEK_CUR, &pos); - ok(SUCCEEDED(hr), "Seek failed, hr %#lx.\n", hr); + ok(hr == S_OK, "Seek failed, hr %#lx.\n", hr); ok(pos.QuadPart == 3, "Unexpected position.\n");
IStream_Release(stream); IStream_Release(stream2);
hr = IOpcPart_GetRelationshipSet(part, &relset); - ok(SUCCEEDED(hr), "Failed to get relationship set, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get relationship set, hr %#lx.\n", hr);
hr = IOpcPart_GetRelationshipSet(part, &relset2); - ok(SUCCEEDED(hr), "Failed to get relationship set, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get relationship set, hr %#lx.\n", hr); ok(relset == relset2, "Expected same part set instance.\n");
hr = CreateUri(L"target", Uri_CREATE_ALLOW_RELATIVE, 0, &target_uri); - ok(SUCCEEDED(hr), "Failed to create target uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create target uri, hr %#lx.\n", hr);
hr = IOpcRelationshipSet_CreateRelationship(relset, NULL, typeW, target_uri, OPC_URI_TARGET_MODE_INTERNAL, &rel); - ok(SUCCEEDED(hr), "Failed to create relationship, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create relationship, hr %#lx.\n", hr);
hr = IOpcRelationship_GetSourceUri(rel, &uri); - ok(SUCCEEDED(hr), "Failed to get source uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get source uri, hr %#lx.\n", hr); ok(uri == (IOpcUri *)part_uri, "Unexpected source uri.\n");
IOpcUri_Release(uri); @@ -193,7 +193,7 @@ static void test_package(void)
ret = FALSE; hr = IOpcPartSet_PartExists(partset, part_uri, &ret); - ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(ret, "Expected part to exist.\n");
IOpcPartUri_Release(part_uri); @@ -201,10 +201,10 @@ static void test_package(void)
/* Relationships */ hr = IOpcPackage_GetRelationshipSet(package, &relset); - ok(SUCCEEDED(hr), "Failed to get relationship set, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get relationship set, hr %#lx.\n", hr);
hr = IOpcPackage_GetRelationshipSet(package, &relset2); - ok(SUCCEEDED(hr), "Failed to get relationship set, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get relationship set, hr %#lx.\n", hr); ok(relset == relset2, "Expected same part set instance.\n"); IOpcRelationshipSet_Release(relset); IOpcRelationshipSet_Release(relset2); @@ -216,9 +216,9 @@ static void test_package(void) hr = IOpcFactory_CreatePackageRootUri(factory, NULL); ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); hr = IOpcFactory_CreatePackageRootUri(factory, &uri); - ok(SUCCEEDED(hr), "Failed to create root uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create root uri, hr %#lx.\n", hr); hr = IOpcUri_GetRawUri(uri, &str); - ok(SUCCEEDED(hr), "Failed to get raw uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get raw uri, hr %#lx.\n", hr); ok(!lstrcmpW(str, L"/"), "Unexpected uri %s.\n", wine_dbgstr_w(str)); SysFreeString(str); IOpcUri_Release(uri); @@ -237,7 +237,7 @@ static void test_stream_stat_(unsigned int line, IStream *stream, ULONG size)
memset(&statstg, 0xff, sizeof(statstg)); hr = IStream_Stat(stream, &statstg, 0); - ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to get stat info, hr %#lx.\n", hr); + ok_(__FILE__, line)(hr == S_OK, "Failed to get stat info, hr %#lx.\n", hr);
ok_(__FILE__, line)(statstg.pwcsName == NULL, "Unexpected name %s.\n", wine_dbgstr_w(statstg.pwcsName)); ok_(__FILE__, line)(statstg.type == STGTY_STREAM, "Unexpected type.\n"); @@ -276,7 +276,7 @@ static void test_file_stream(void) ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
hr = IOpcFactory_CreateStreamOnFile(factory, pathW, OPC_STREAM_IO_WRITE, NULL, 0, &stream); - ok(SUCCEEDED(hr), "Failed to create a write stream, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create a write stream, hr %#lx.\n", hr);
test_stream_stat(stream, 0);
@@ -293,7 +293,7 @@ static void test_file_stream(void)
/* Write to read-only stream. */ hr = IOpcFactory_CreateStreamOnFile(factory, pathW, OPC_STREAM_IO_READ, NULL, 0, &stream); - ok(SUCCEEDED(hr), "Failed to create a read stream, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create a read stream, hr %#lx.\n", hr);
test_stream_stat(stream, size); hr = IStream_Write(stream, pathW, size, NULL); @@ -302,7 +302,7 @@ static void test_file_stream(void)
/* Read from write-only stream. */ hr = IOpcFactory_CreateStreamOnFile(factory, pathW, OPC_STREAM_IO_WRITE, NULL, 0, &stream); - ok(SUCCEEDED(hr), "Failed to create a read stream, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create a read stream, hr %#lx.\n", hr);
test_stream_stat(stream, 0); hr = IStream_Write(stream, pathW, size, NULL); @@ -311,7 +311,7 @@ static void test_file_stream(void)
move.QuadPart = 0; hr = IStream_Seek(stream, move, STREAM_SEEK_SET, NULL); - ok(SUCCEEDED(hr), "Seek failed, hr %#lx.\n", hr); + ok(hr == S_OK, "Seek failed, hr %#lx.\n", hr);
hr = IStream_Read(stream, buff, sizeof(buff), NULL); ok(hr == HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED), "Stream read failed, hr %#lx.\n", hr); @@ -344,13 +344,13 @@ static void test_relationship(void) ok(hr == S_OK, "Failed to create a package, hr %#lx.\n", hr);
hr = CreateUri(L"target", Uri_CREATE_ALLOW_RELATIVE, 0, &target_uri); - ok(SUCCEEDED(hr), "Failed to create target uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create target uri, hr %#lx.\n", hr);
hr = CreateUri(L"file://host/file.txt", 0, 0, &target_uri2); - ok(SUCCEEDED(hr), "Failed to create target uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create target uri, hr %#lx.\n", hr);
hr = IOpcPackage_GetRelationshipSet(package, &rels); - ok(SUCCEEDED(hr), "Failed to get part set, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get part set, hr %#lx.\n", hr);
rel = (void *)0xdeadbeef; hr = IOpcRelationshipSet_CreateRelationship(rels, NULL, NULL, NULL, OPC_URI_TARGET_MODE_INTERNAL, &rel); @@ -372,11 +372,11 @@ static void test_relationship(void) ok(rel == NULL, "Unexpected instance %p.\n", rel);
hr = IOpcRelationshipSet_CreateRelationship(rels, NULL, typeW, target_uri, OPC_URI_TARGET_MODE_INTERNAL, &rel); - ok(SUCCEEDED(hr), "Failed to create relationship, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create relationship, hr %#lx.\n", hr);
/* Autogenerated relationship id */ hr = IOpcRelationship_GetId(rel, &id); - ok(SUCCEEDED(hr), "Failed to get id, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get id, hr %#lx.\n", hr); ok(lstrlenW(id) == 9 && *id == 'R', "Unexpected relationship id %s.\n", wine_dbgstr_w(id));
hr = IOpcRelationshipSet_CreateRelationship(rels, id, typeW, target_uri, OPC_URI_TARGET_MODE_INTERNAL, &rel2); @@ -386,7 +386,7 @@ static void test_relationship(void) ok(hr == OPC_E_DUPLICATE_RELATIONSHIP, "Failed to create relationship, hr %#lx.\n", hr);
hr = IOpcRelationshipSet_CreateRelationship(rels, NULL, typeW, target_uri, OPC_URI_TARGET_MODE_INTERNAL, &rel2); - ok(SUCCEEDED(hr), "Failed to create relationship, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create relationship, hr %#lx.\n", hr);
ret = 123; hr = IOpcRelationshipSet_RelationshipExists(rels, NULL, &ret); @@ -398,11 +398,11 @@ static void test_relationship(void)
ret = FALSE; hr = IOpcRelationshipSet_RelationshipExists(rels, id, &ret); - ok(SUCCEEDED(hr), "Failed to get relationship, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get relationship, hr %#lx.\n", hr); ok(ret, "Unexpected result %d.\n", ret);
hr = IOpcRelationshipSet_GetRelationship(rels, id, &rel3); - ok(SUCCEEDED(hr), "Failed to get relationship, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get relationship, hr %#lx.\n", hr); IOpcRelationship_Release(rel3);
hr = IOpcRelationshipSet_GetRelationship(rels, id, NULL); @@ -421,45 +421,45 @@ static void test_relationship(void)
ret = TRUE; hr = IOpcRelationshipSet_RelationshipExists(rels, id, &ret); - ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(!ret, "Unexpected result %d.\n", ret);
CoTaskMemFree(id);
hr = IOpcRelationship_GetTargetUri(rel, &uri); - ok(SUCCEEDED(hr), "Failed to get target uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get target uri, hr %#lx.\n", hr); ok(uri == target_uri, "Unexpected uri.\n"); IUri_Release(uri);
hr = IOpcRelationship_GetTargetMode(rel, &mode); - ok(SUCCEEDED(hr), "Failed to get target mode, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get target mode, hr %#lx.\n", hr); ok(mode == OPC_URI_TARGET_MODE_INTERNAL, "Unexpected mode %d.\n", mode);
/* Source uri */ hr = IOpcFactory_CreatePackageRootUri(factory, &source_uri); - ok(SUCCEEDED(hr), "Failed to create root uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create root uri, hr %#lx.\n", hr);
hr = IOpcFactory_CreatePackageRootUri(factory, &source_uri2); - ok(SUCCEEDED(hr), "Failed to create root uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create root uri, hr %#lx.\n", hr); ok(source_uri != source_uri2, "Unexpected uri instance.\n");
IOpcUri_Release(source_uri); IOpcUri_Release(source_uri2);
hr = IOpcRelationship_GetSourceUri(rel, &source_uri); - ok(SUCCEEDED(hr), "Failed to get source uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get source uri, hr %#lx.\n", hr);
hr = IOpcUri_QueryInterface(source_uri, &IID_IOpcPartUri, (void **)&unk); ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
str = NULL; hr = IOpcUri_GetRawUri(source_uri, &str); - ok(SUCCEEDED(hr), "Failed to get raw uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get raw uri, hr %#lx.\n", hr); ok(!lstrcmpW(L"/", str), "Unexpected uri %s.\n", wine_dbgstr_w(str)); SysFreeString(str);
hr = IOpcRelationship_GetSourceUri(rel2, &source_uri2); - ok(SUCCEEDED(hr), "Failed to get source uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get source uri, hr %#lx.\n", hr); ok(source_uri2 == source_uri, "Unexpected source uri.\n");
IOpcUri_Release(source_uri2); @@ -521,7 +521,7 @@ static void test_rel_part_uri(void) factory = create_factory();
hr = IOpcFactory_CreatePartUri(factory, L"/uri", &part_uri); - ok(SUCCEEDED(hr), "Failed to create part uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create part uri, hr %#lx.\n", hr);
hr = IOpcPartUri_GetRelationshipsPartUri(part_uri, NULL); ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); @@ -552,11 +552,11 @@ static void test_rel_part_uri(void) } else hr = IOpcFactory_CreatePartUri(factory, rel_part_uri_tests[i].uri, (IOpcPartUri **)&part_uri); - ok(SUCCEEDED(hr), "Failed to create part uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create part uri, hr %#lx.\n", hr);
rel_uri = (void *)0xdeadbeef; hr = IOpcUri_GetRelationshipsPartUri(part_uri, &rel_uri); - if (SUCCEEDED(hr)) + if (hr == S_OK) { IOpcPartUri *rel_uri2; IOpcUri *source_uri2; @@ -565,9 +565,9 @@ static void test_rel_part_uri(void) BSTR str;
hr = IOpcPartUri_GetSourceUri(rel_uri, &source_uri); - ok(SUCCEEDED(hr), "Failed to get source uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get source uri, hr %#lx.\n", hr); hr = IOpcPartUri_GetSourceUri(rel_uri, &source_uri2); - ok(SUCCEEDED(hr), "Failed to get source uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get source uri, hr %#lx.\n", hr); ok(source_uri != source_uri2, "Unexpected instance.\n");
hr = IOpcUri_IsEqual(source_uri, NULL, NULL); @@ -580,7 +580,7 @@ static void test_rel_part_uri(void)
ret = FALSE; hr = IOpcUri_IsEqual(source_uri, (IUri *)source_uri2, &ret); - ok(SUCCEEDED(hr), "IsEqual failed, hr %#lx.\n", hr); + ok(hr == S_OK, "IsEqual failed, hr %#lx.\n", hr); ok(ret, "Expected equal uris.\n");
hr = IOpcUri_QueryInterface(source_uri, &IID_IOpcPartUri, (void **)&unk); @@ -592,12 +592,12 @@ static void test_rel_part_uri(void) IOpcUri_Release(source_uri);
hr = IOpcUri_GetRelationshipsPartUri(part_uri, &rel_uri2); - ok(SUCCEEDED(hr), "Failed to get rels part uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get rels part uri, hr %#lx.\n", hr); ok(rel_uri2 != rel_uri, "Unexpected instance.\n"); IOpcPartUri_Release(rel_uri2);
hr = IOpcPartUri_GetRawUri(rel_uri, &str); - ok(SUCCEEDED(hr), "Failed to get rel uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get rel uri, hr %#lx.\n", hr); todo_wine_if(i == 3 || i == 4 || i == 8 || i == 9) ok(!lstrcmpW(str, rel_part_uri_tests[i].rel_uri), "%u: unexpected rel uri %s, expected %s.\n", i, wine_dbgstr_w(str), wine_dbgstr_w(rel_part_uri_tests[i].rel_uri)); @@ -620,11 +620,11 @@ static void test_rel_part_uri(void) BOOL ret;
hr = IOpcFactory_CreatePartUri(factory, is_rel_part_tests[i].uri, &part_uri); - ok(SUCCEEDED(hr), "Failed to create part uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create part uri, hr %#lx.\n", hr);
ret = 123; hr = IOpcPartUri_IsRelationshipsPartUri(part_uri, &ret); - ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(ret == is_rel_part_tests[i].ret, "%u: unexpected result %d.\n", i, ret);
IOpcPartUri_Release(part_uri); @@ -650,16 +650,16 @@ static void test_part_enumerator(void) ok(hr == S_OK, "Failed to create a package, hr %#lx.\n", hr);
hr = IOpcPackage_GetPartSet(package, &parts); - ok(SUCCEEDED(hr), "Failed to get part set, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get part set, hr %#lx.\n", hr);
hr = IOpcPartSet_GetEnumerator(parts, NULL); ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
hr = IOpcPartSet_GetEnumerator(parts, &partenum); - ok(SUCCEEDED(hr), "Failed to get enumerator, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get enumerator, hr %#lx.\n", hr);
hr = IOpcPartSet_GetEnumerator(parts, &partenum2); - ok(SUCCEEDED(hr), "Failed to get enumerator, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get enumerator, hr %#lx.\n", hr); ok(partenum != partenum2, "Unexpected instance.\n"); IOpcPartEnumerator_Release(partenum2);
@@ -683,10 +683,10 @@ static void test_part_enumerator(void) ok(!ret, "Unexpected result %d.\n", ret);
hr = IOpcFactory_CreatePartUri(factory, L"/uri", &part_uri); - ok(SUCCEEDED(hr), "Failed to create part uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create part uri, hr %#lx.\n", hr);
hr = IOpcPartSet_CreatePart(parts, part_uri, L"type/subtype", OPC_COMPRESSION_NONE, &part); - ok(SUCCEEDED(hr), "Failed to create a part, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create a part, hr %#lx.\n", hr); IOpcPartUri_Release(part_uri);
part2 = (void *)0xdeadbeef; @@ -721,7 +721,7 @@ static void test_part_enumerator(void) IOpcPartEnumerator_Release(partenum);
hr = IOpcPartSet_GetEnumerator(parts, &partenum); - ok(SUCCEEDED(hr), "Failed to get enumerator, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get enumerator, hr %#lx.\n", hr);
part2 = (void *)0xdeadbeef; hr = IOpcPartEnumerator_GetCurrent(partenum, &part2); @@ -763,7 +763,7 @@ static void test_part_enumerator(void) ok(hr == OPC_E_ENUM_INVALID_POSITION, "Unexpected hr %#lx.\n", hr);
hr = IOpcPartEnumerator_Clone(partenum, &partenum2); - ok(SUCCEEDED(hr), "Clone failed, hr %#lx.\n", hr); + ok(hr == S_OK, "Clone failed, hr %#lx.\n", hr);
hr = IOpcPartEnumerator_MoveNext(partenum2, &ret); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -805,16 +805,16 @@ static void test_rels_enumerator(void) ok(hr == S_OK, "Failed to create a package, hr %#lx.\n", hr);
hr = IOpcPackage_GetRelationshipSet(package, &rels); - ok(SUCCEEDED(hr), "Failed to get part set, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get part set, hr %#lx.\n", hr);
hr = IOpcRelationshipSet_GetEnumerator(rels, NULL); ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
hr = IOpcRelationshipSet_GetEnumerator(rels, &relsenum); - ok(SUCCEEDED(hr), "Failed to get enumerator, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get enumerator, hr %#lx.\n", hr);
hr = IOpcRelationshipSet_GetEnumerator(rels, &relsenum2); - ok(SUCCEEDED(hr), "Failed to get enumerator, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get enumerator, hr %#lx.\n", hr); ok(relsenum != relsenum2, "Unexpected instance.\n"); IOpcRelationshipEnumerator_Release(relsenum2);
@@ -838,10 +838,10 @@ static void test_rels_enumerator(void) ok(!ret, "Unexpected result %d.\n", ret);
hr = CreateUri(L"target", Uri_CREATE_ALLOW_RELATIVE, 0, &target_uri); - ok(SUCCEEDED(hr), "Failed to create target uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create target uri, hr %#lx.\n", hr);
hr = IOpcRelationshipSet_CreateRelationship(rels, NULL, L"type/subtype", target_uri, OPC_URI_TARGET_MODE_INTERNAL, &rel); - ok(SUCCEEDED(hr), "Failed to create relationship, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create relationship, hr %#lx.\n", hr);
IUri_Release(target_uri);
@@ -877,7 +877,7 @@ static void test_rels_enumerator(void) IOpcRelationshipEnumerator_Release(relsenum);
hr = IOpcRelationshipSet_GetEnumerator(rels, &relsenum); - ok(SUCCEEDED(hr), "Failed to get enumerator, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get enumerator, hr %#lx.\n", hr);
rel2 = (void *)0xdeadbeef; hr = IOpcRelationshipEnumerator_GetCurrent(relsenum, &rel2); @@ -919,7 +919,7 @@ static void test_rels_enumerator(void) ok(hr == OPC_E_ENUM_INVALID_POSITION, "Unexpected hr %#lx.\n", hr);
hr = IOpcRelationshipEnumerator_Clone(relsenum, &relsenum2); - ok(SUCCEEDED(hr), "Clone failed, hr %#lx.\n", hr); + ok(hr == S_OK, "Clone failed, hr %#lx.\n", hr);
hr = IOpcRelationshipEnumerator_MoveNext(relsenum2, &ret); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -986,22 +986,22 @@ static void test_relative_uri(void) hr = IOpcFactory_CreatePackageRootUri(factory, &part_uri); else hr = IOpcFactory_CreatePartUri(factory, relative_uri_tests[i].part, (IOpcPartUri **)&part_uri); - ok(SUCCEEDED(hr), "%u: failed to create part uri, hr %#lx.\n", i, hr); + ok(hr == S_OK, "%u: failed to create part uri, hr %#lx.\n", i, hr);
hr = IOpcFactory_CreatePartUri(factory, relative_uri_tests[i].combined, &combined_uri); - ok(SUCCEEDED(hr), "%u: failed to create part uri, hr %#lx.\n", i, hr); + ok(hr == S_OK, "%u: failed to create part uri, hr %#lx.\n", i, hr);
hr = IOpcUri_GetRelativeUri(part_uri, combined_uri, &relative_uri); todo_wine - ok(SUCCEEDED(hr), "%u: failed t oget relative uri, hr %#lx.\n", i, hr); + ok(hr == S_OK, "%u: failed t oget relative uri, hr %#lx.\n", i, hr);
- if (SUCCEEDED(hr)) + if (hr == S_OK) { hr = IUri_QueryInterface(relative_uri, &IID_IOpcUri, (void **)&unk); ok(hr == E_NOINTERFACE, "%u: unexpected hr %#lx.\n", i, hr);
hr = IUri_GetRawUri(relative_uri, &str); - ok(SUCCEEDED(hr), "%u: failed to get raw uri, hr %#lx.\n", i, hr); + ok(hr == S_OK, "%u: failed to get raw uri, hr %#lx.\n", i, hr); ok(!lstrcmpW(str, relative_uri_tests[i].relative) || broken(relative_broken && !lstrcmpW(str, relative_broken)), "%u: unexpected relative uri %s.\n", i, wine_dbgstr_w(str)); SysFreeString(str); @@ -1047,10 +1047,10 @@ static void test_combine_uri(void) hr = IOpcFactory_CreatePackageRootUri(factory, &uri); else hr = IOpcFactory_CreatePartUri(factory, combine_tests[i].uri, (IOpcPartUri **)&uri); - ok(SUCCEEDED(hr), "%u: failed to create uri, hr %#lx.\n", i, hr); + ok(hr == S_OK, "%u: failed to create uri, hr %#lx.\n", i, hr);
hr = CreateUri(combine_tests[i].relative, Uri_CREATE_ALLOW_RELATIVE, 0, &relative_uri); - ok(SUCCEEDED(hr), "%u: failed to create relative uri, hr %#lx.\n", i, hr); + ok(hr == S_OK, "%u: failed to create relative uri, hr %#lx.\n", i, hr);
combined_uri = (void *)0xdeadbeef; hr = IOpcUri_CombinePartUri(uri, NULL, &combined_uri); @@ -1061,10 +1061,10 @@ static void test_combine_uri(void) ok(hr == E_POINTER, "%u: failed to combine uris, hr %#lx.\n", i, hr);
hr = IOpcUri_CombinePartUri(uri, relative_uri, &combined_uri); - ok(SUCCEEDED(hr), "%u: failed to combine uris, hr %#lx.\n", i, hr); + ok(hr == S_OK, "%u: failed to combine uris, hr %#lx.\n", i, hr);
hr = IOpcPartUri_GetRawUri(combined_uri, &str); - ok(SUCCEEDED(hr), "%u: failed to get raw uri, hr %#lx.\n", i, hr); + ok(hr == S_OK, "%u: failed to get raw uri, hr %#lx.\n", i, hr); todo_wine_if(i == 2 || i == 3) ok(!lstrcmpW(str, combine_tests[i].combined), "%u: unexpected uri %s.\n", i, wine_dbgstr_w(str)); SysFreeString(str); @@ -1108,20 +1108,20 @@ static void test_create_part_uri(void) BOOL ret;
hr = IOpcFactory_CreatePartUri(factory, create_part_uri_tests[i].input, &part_uri); - ok(SUCCEEDED(hr), "%u: failed to create part uri, hr %#lx.\n", i, hr); + ok(hr == S_OK, "%u: failed to create part uri, hr %#lx.\n", i, hr);
hr = IOpcPartUri_GetRawUri(part_uri, &str); - ok(SUCCEEDED(hr), "Failed to get raw uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to get raw uri, hr %#lx.\n", hr); todo_wine_if(i == 1 || i == 2 || i == 4) ok(!lstrcmpW(str, raw_uri), "%u: unexpected raw uri %s.\n", i, wine_dbgstr_w(str)); SysFreeString(str);
hr = CreateUri(raw_uri, Uri_CREATE_ALLOW_RELATIVE, 0, &uri); - ok(SUCCEEDED(hr), "Failed to create uri, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create uri, hr %#lx.\n", hr);
ret = FALSE; hr = IOpcPartUri_IsEqual(part_uri, uri, &ret); - ok(SUCCEEDED(hr), "IsEqual failed, hr %#lx.\n", hr); + ok(hr == S_OK, "IsEqual failed, hr %#lx.\n", hr); todo_wine_if(i == 1 || i == 2 || i == 4) ok(!!ret, "%u: unexpected result %d.\n", i, ret);
@@ -1191,7 +1191,7 @@ static void test_write_package(void) ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); - ok(SUCCEEDED(hr), "Failed to create a stream, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to create a stream, hr %#lx.\n", hr);
hr = IOpcFactory_WritePackageToStream(factory, NULL, OPC_WRITE_FORCE_ZIP32, stream); ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); @@ -1333,7 +1333,7 @@ START_TEST(opcservices) HRESULT hr;
hr = CoInitialize(NULL); - ok(SUCCEEDED(hr), "Failed to initialize COM, hr %#lx.\n", hr); + ok(hr == S_OK, "Failed to initialize COM, hr %#lx.\n", hr);
if (!(factory = create_factory())) { win_skip("Failed to create IOpcFactory factory.\n");
From: Vibhav Pant vibhavp@gmail.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/opcservices/tests/opcservices.c | 14 ++++++++++++++ include/opcbase.idl | 1 + 2 files changed, 15 insertions(+)
diff --git a/dlls/opcservices/tests/opcservices.c b/dlls/opcservices/tests/opcservices.c index 802837c19cf..b4569cd8302 100644 --- a/dlls/opcservices/tests/opcservices.c +++ b/dlls/opcservices/tests/opcservices.c @@ -677,6 +677,13 @@ static void test_part_enumerator(void) ok(hr == S_OK, "Failed to move, hr %#lx.\n", hr); ok(!ret, "Unexpected result %d.\n", ret);
+ ret = 123; + hr = IOpcPartEnumerator_MoveNext(partenum, &ret); + todo_wine + ok(hr == OPC_E_ENUM_CANNOT_MOVE_NEXT, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(ret == 123, "Unexpected result %d.\n", ret); + ret = TRUE; hr = IOpcPartEnumerator_MovePrevious(partenum, &ret); ok(hr == S_OK, "Failed to move, hr %#lx.\n", hr); @@ -741,6 +748,13 @@ static void test_part_enumerator(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(!ret, "Unexpected result %d.\n", ret);
+ ret = 123; + hr = IOpcPartEnumerator_MoveNext(partenum, &ret); + todo_wine + ok(hr == OPC_E_ENUM_CANNOT_MOVE_NEXT, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(ret == 123, "Unexpected result %d.\n", ret); + part2 = (void *)0xdeadbeef; hr = IOpcPartEnumerator_GetCurrent(partenum, &part2); ok(hr == OPC_E_ENUM_INVALID_POSITION, "Unexpected hr %#lx.\n", hr); diff --git a/include/opcbase.idl b/include/opcbase.idl index 3df2df80635..fcf641481e2 100644 --- a/include/opcbase.idl +++ b/include/opcbase.idl @@ -49,4 +49,5 @@ cpp_quote("#define OPC_E_DUPLICATE_RELATIONSHIP MAKE_HRESULT(SEVERITY_ERROR, FAC cpp_quote("#define OPC_E_NO_SUCH_PART MAKE_HRESULT(SEVERITY_ERROR, FACILITY_OPC, 0x18)") cpp_quote("#define OPC_E_NO_SUCH_RELATIONSHIP MAKE_HRESULT(SEVERITY_ERROR, FACILITY_OPC, 0x48)") cpp_quote("#define OPC_E_ENUM_COLLECTION_CHANGED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_OPC, 0x50)") +cpp_quote("#define OPC_E_ENUM_CANNOT_MOVE_NEXT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_OPC, 0x51)") cpp_quote("#define OPC_E_ENUM_INVALID_POSITION MAKE_HRESULT(SEVERITY_ERROR, FACILITY_OPC, 0x53)")
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/opcservices/package.c | 5 ++++- dlls/opcservices/tests/opcservices.c | 4 ---- 2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/dlls/opcservices/package.c b/dlls/opcservices/package.c index e080b386c61..bdd06ded69d 100644 --- a/dlls/opcservices/package.c +++ b/dlls/opcservices/package.c @@ -237,7 +237,10 @@ static HRESULT WINAPI opc_part_enum_MoveNext(IOpcPartEnumerator *iface, BOOL *ha if (has_part_collection_changed(part_enum)) return OPC_E_ENUM_COLLECTION_CHANGED;
- if (part_enum->part_set->count && (part_enum->pos == ~(size_t)0 || part_enum->pos < part_enum->part_set->count)) + if (part_enum->pos == part_enum->part_set->count) + return OPC_E_ENUM_CANNOT_MOVE_NEXT; + + if (part_enum->pos == ~(size_t)0 || part_enum->pos < part_enum->part_set->count) part_enum->pos++;
*has_next = part_enum->pos < part_enum->part_set->count; diff --git a/dlls/opcservices/tests/opcservices.c b/dlls/opcservices/tests/opcservices.c index b4569cd8302..3359fc9c4dc 100644 --- a/dlls/opcservices/tests/opcservices.c +++ b/dlls/opcservices/tests/opcservices.c @@ -679,9 +679,7 @@ static void test_part_enumerator(void)
ret = 123; hr = IOpcPartEnumerator_MoveNext(partenum, &ret); - todo_wine ok(hr == OPC_E_ENUM_CANNOT_MOVE_NEXT, "Unexpected hr %#lx.\n", hr); - todo_wine ok(ret == 123, "Unexpected result %d.\n", ret);
ret = TRUE; @@ -750,9 +748,7 @@ static void test_part_enumerator(void)
ret = 123; hr = IOpcPartEnumerator_MoveNext(partenum, &ret); - todo_wine ok(hr == OPC_E_ENUM_CANNOT_MOVE_NEXT, "Unexpected hr %#lx.\n", hr); - todo_wine ok(ret == 123, "Unexpected result %d.\n", ret);
part2 = (void *)0xdeadbeef;
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/opcservices/tests/opcservices.c | 21 +++++++++++++++++++++ include/opcbase.idl | 1 + 2 files changed, 22 insertions(+)
diff --git a/dlls/opcservices/tests/opcservices.c b/dlls/opcservices/tests/opcservices.c index 3359fc9c4dc..94f977f8228 100644 --- a/dlls/opcservices/tests/opcservices.c +++ b/dlls/opcservices/tests/opcservices.c @@ -672,6 +672,13 @@ static void test_part_enumerator(void) hr = IOpcPartEnumerator_MoveNext(partenum, NULL); ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
+ ret = 123; + hr = IOpcPartEnumerator_MovePrevious(partenum, &ret); + todo_wine + ok(hr == OPC_E_ENUM_CANNOT_MOVE_PREVIOUS, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(ret == 123, "Unexpected result %d.\n", ret); + ret = TRUE; hr = IOpcPartEnumerator_MoveNext(partenum, &ret); ok(hr == S_OK, "Failed to move, hr %#lx.\n", hr); @@ -687,6 +694,13 @@ static void test_part_enumerator(void) ok(hr == S_OK, "Failed to move, hr %#lx.\n", hr); ok(!ret, "Unexpected result %d.\n", ret);
+ ret = 123; + hr = IOpcPartEnumerator_MovePrevious(partenum, &ret); + todo_wine + ok(hr == OPC_E_ENUM_CANNOT_MOVE_PREVIOUS, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(ret == 123, "Unexpected result %d.\n", ret); + hr = IOpcFactory_CreatePartUri(factory, L"/uri", &part_uri); ok(hr == S_OK, "Failed to create part uri, hr %#lx.\n", hr);
@@ -772,6 +786,13 @@ static void test_part_enumerator(void) hr = IOpcPartEnumerator_GetCurrent(partenum, &part2); ok(hr == OPC_E_ENUM_INVALID_POSITION, "Unexpected hr %#lx.\n", hr);
+ ret = 123; + hr = IOpcPartEnumerator_MovePrevious(partenum, &ret); + todo_wine + ok(hr == OPC_E_ENUM_CANNOT_MOVE_PREVIOUS, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(ret == 123, "Unexpected result %d.\n", ret); + hr = IOpcPartEnumerator_Clone(partenum, &partenum2); ok(hr == S_OK, "Clone failed, hr %#lx.\n", hr);
diff --git a/include/opcbase.idl b/include/opcbase.idl index fcf641481e2..1d4aa253aa5 100644 --- a/include/opcbase.idl +++ b/include/opcbase.idl @@ -50,4 +50,5 @@ cpp_quote("#define OPC_E_NO_SUCH_PART MAKE_HRESULT(SEVERITY_ERROR, FACILITY_OPC, cpp_quote("#define OPC_E_NO_SUCH_RELATIONSHIP MAKE_HRESULT(SEVERITY_ERROR, FACILITY_OPC, 0x48)") cpp_quote("#define OPC_E_ENUM_COLLECTION_CHANGED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_OPC, 0x50)") cpp_quote("#define OPC_E_ENUM_CANNOT_MOVE_NEXT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_OPC, 0x51)") +cpp_quote("#define OPC_E_ENUM_CANNOT_MOVE_PREVIOUS MAKE_HRESULT(SEVERITY_ERROR, FACILITY_OPC, 0x52)") cpp_quote("#define OPC_E_ENUM_INVALID_POSITION MAKE_HRESULT(SEVERITY_ERROR, FACILITY_OPC, 0x53)")
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/opcservices/package.c | 6 +++--- dlls/opcservices/tests/opcservices.c | 6 ------ 2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/dlls/opcservices/package.c b/dlls/opcservices/package.c index bdd06ded69d..17175006433 100644 --- a/dlls/opcservices/package.c +++ b/dlls/opcservices/package.c @@ -260,10 +260,10 @@ static HRESULT WINAPI opc_part_enum_MovePrevious(IOpcPartEnumerator *iface, BOOL if (has_part_collection_changed(part_enum)) return OPC_E_ENUM_COLLECTION_CHANGED;
- if (part_enum->pos != ~(size_t)0) - part_enum->pos--; + if (part_enum->pos == ~(size_t)0) + return OPC_E_ENUM_CANNOT_MOVE_PREVIOUS;
- *has_previous = part_enum->pos != ~(size_t)0; + *has_previous = --part_enum->pos != ~(size_t)0;
return S_OK; } diff --git a/dlls/opcservices/tests/opcservices.c b/dlls/opcservices/tests/opcservices.c index 94f977f8228..396364037b8 100644 --- a/dlls/opcservices/tests/opcservices.c +++ b/dlls/opcservices/tests/opcservices.c @@ -674,9 +674,7 @@ static void test_part_enumerator(void)
ret = 123; hr = IOpcPartEnumerator_MovePrevious(partenum, &ret); - todo_wine ok(hr == OPC_E_ENUM_CANNOT_MOVE_PREVIOUS, "Unexpected hr %#lx.\n", hr); - todo_wine ok(ret == 123, "Unexpected result %d.\n", ret);
ret = TRUE; @@ -696,9 +694,7 @@ static void test_part_enumerator(void)
ret = 123; hr = IOpcPartEnumerator_MovePrevious(partenum, &ret); - todo_wine ok(hr == OPC_E_ENUM_CANNOT_MOVE_PREVIOUS, "Unexpected hr %#lx.\n", hr); - todo_wine ok(ret == 123, "Unexpected result %d.\n", ret);
hr = IOpcFactory_CreatePartUri(factory, L"/uri", &part_uri); @@ -788,9 +784,7 @@ static void test_part_enumerator(void)
ret = 123; hr = IOpcPartEnumerator_MovePrevious(partenum, &ret); - todo_wine ok(hr == OPC_E_ENUM_CANNOT_MOVE_PREVIOUS, "Unexpected hr %#lx.\n", hr); - todo_wine ok(ret == 123, "Unexpected result %d.\n", ret);
hr = IOpcPartEnumerator_Clone(partenum, &partenum2);