[PATCH 1/3] opcservices/tests: Add some tests.

Nikolay Sivov nsivov at codeweavers.com
Sun Sep 2 23:18:23 CDT 2018


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 configure                            |  1 +
 configure.ac                         |  1 +
 dlls/opcservices/tests/Makefile.in   |  5 ++
 dlls/opcservices/tests/opcservices.c | 85 ++++++++++++++++++++++++++++
 4 files changed, 92 insertions(+)
 create mode 100644 dlls/opcservices/tests/Makefile.in
 create mode 100644 dlls/opcservices/tests/opcservices.c

diff --git a/configure b/configure
index 5d520f045a..b800fd269a 100755
--- a/configure
+++ b/configure
@@ -19715,6 +19715,7 @@ wine_fn_config_makefile dlls/olesvr.dll16 enable_win16
 wine_fn_config_makefile dlls/olesvr32 enable_olesvr32
 wine_fn_config_makefile dlls/olethk32 enable_olethk32
 wine_fn_config_makefile dlls/opcservices enable_opcservices
+wine_fn_config_makefile dlls/opcservices/tests enable_tests
 wine_fn_config_makefile dlls/openal32 enable_openal32
 wine_fn_config_makefile dlls/opencl enable_opencl
 wine_fn_config_makefile dlls/opengl32 enable_opengl32
diff --git a/configure.ac b/configure.ac
index 2b63d6ae50..d7d5e8e6ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3574,6 +3574,7 @@ WINE_CONFIG_MAKEFILE(dlls/olesvr.dll16,enable_win16)
 WINE_CONFIG_MAKEFILE(dlls/olesvr32)
 WINE_CONFIG_MAKEFILE(dlls/olethk32)
 WINE_CONFIG_MAKEFILE(dlls/opcservices)
+WINE_CONFIG_MAKEFILE(dlls/opcservices/tests)
 WINE_CONFIG_MAKEFILE(dlls/openal32)
 WINE_CONFIG_MAKEFILE(dlls/opencl)
 WINE_CONFIG_MAKEFILE(dlls/opengl32)
diff --git a/dlls/opcservices/tests/Makefile.in b/dlls/opcservices/tests/Makefile.in
new file mode 100644
index 0000000000..7c0963cc60
--- /dev/null
+++ b/dlls/opcservices/tests/Makefile.in
@@ -0,0 +1,5 @@
+TESTDLL = opcservices.dll
+IMPORTS = ole32
+
+C_SRCS = \
+	opcservices.c
diff --git a/dlls/opcservices/tests/opcservices.c b/dlls/opcservices/tests/opcservices.c
new file mode 100644
index 0000000000..e257c6ea2c
--- /dev/null
+++ b/dlls/opcservices/tests/opcservices.c
@@ -0,0 +1,85 @@
+/*
+ *    Font related tests
+ *
+ * Copyright 2012, 2014-2017 Nikolay Sivov for CodeWeavers
+ * Copyright 2014 Aric Stewart for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define COBJMACROS
+
+#include "windows.h"
+#include "initguid.h"
+#include "msopc.h"
+
+#include "wine/test.h"
+
+static IOpcFactory *create_factory(void)
+{
+    IOpcFactory *factory = NULL;
+    CoCreateInstance(&CLSID_OpcFactory, NULL, CLSCTX_INPROC_SERVER, &IID_IOpcFactory, (void **)&factory);
+    return factory;
+}
+
+static void test_package(void)
+{
+    IOpcPartSet *partset, *partset2;
+    IOpcFactory *factory;
+    IOpcPackage *package;
+    HRESULT hr;
+
+    factory = create_factory();
+
+    hr = IOpcFactory_CreatePackage(factory, &package);
+    ok(SUCCEEDED(hr) || broken(hr == E_NOTIMPL) /* Vista */, "Failed to create a package, hr %#x.\n", hr);
+    if (FAILED(hr))
+    {
+        IOpcFactory_Release(factory);
+        return;
+    }
+
+    hr = IOpcPackage_GetPartSet(package, &partset);
+    ok(SUCCEEDED(hr), "Failed to create a part set, hr %#x.\n", hr);
+
+    hr = IOpcPackage_GetPartSet(package, &partset2);
+    ok(SUCCEEDED(hr), "Failed to create a part set, hr %#x.\n", hr);
+    ok(partset == partset2, "Expected same part set instance.\n");
+
+    IOpcPackage_Release(package);
+
+    IOpcFactory_Release(factory);
+}
+
+START_TEST(opcservices)
+{
+    IOpcFactory *factory;
+    HRESULT hr;
+
+    hr = CoInitialize(NULL);
+    ok(SUCCEEDED(hr), "Failed to initialize COM, hr %#x.\n", hr);
+
+    if (!(factory = create_factory())) {
+        win_skip("Failed to create IOpcFactory factory.\n");
+        CoUninitialize();
+        return;
+    }
+
+    test_package();
+
+    IOpcFactory_Release(factory);
+
+    CoUninitialize();
+}
-- 
2.18.0




More information about the wine-devel mailing list