From 884e7e7b5661a398e0ce36a585f5b6698517ffb5 Mon Sep 17 00:00:00 2001
From: Roy Shea <roy@cs.hmc.edu>
Date: Mon, 11 Feb 2008 11:09:34 -0800
Subject: [PATCH] qmgr: Add some tests.

---
 .gitignore                    |  4 +++
 Makefile.in                   |  2 ++
 configure                     |  3 ++
 configure.ac                  |  1 +
 dlls/Makefile.in              |  1 +
 dlls/qmgr/tests/Makefile.in   | 13 ++++++++
 dlls/qmgr/tests/qmgr.c        | 56 +++++++++++++++++++++++++++++++++++
 programs/winetest/Makefile.in |  3 ++
 programs/winetest/winetest.rc |  1 +
 9 files changed, 84 insertions(+)
 create mode 100644 dlls/qmgr/tests/Makefile.in
 create mode 100644 dlls/qmgr/tests/qmgr.c

diff --git a/.gitignore b/.gitignore
index 9fd3548533e..9702e705abc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -395,6 +395,9 @@ dlls/qedit/tests/testlist.c
 dlls/qmgr/qmgr_local.h
 dlls/qmgr/qmgr_local_i.c
 dlls/qmgr/rsrc.res
+dlls/qmgr/tests/*.ok
+dlls/qmgr/tests/qmgr_crosstest.exe
+dlls/qmgr/tests/testlist.c
 dlls/qmgrprxy/qmgrprxy.h
 dlls/qmgrprxy/qmgrprxy_i.c
 dlls/qmgrprxy/qmgrprxy_p.c
@@ -780,6 +783,7 @@ programs/winetest/opengl32_test.exe
 programs/winetest/pdh_test.exe
 programs/winetest/psapi_test.exe
 programs/winetest/qedit_test.exe
+programs/winetest/qmgr_test.exe
 programs/winetest/quartz_test.exe
 programs/winetest/riched20_test.exe
 programs/winetest/riched32_test.exe
diff --git a/Makefile.in b/Makefile.in
index 6347f93aa0d..e650d0c4078 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -383,6 +383,7 @@ ALL_MAKEFILES = \
 	dlls/qedit/Makefile \
 	dlls/qedit/tests/Makefile \
 	dlls/qmgr/Makefile \
+	dlls/qmgr/tests/Makefile \
 	dlls/qmgrprxy/Makefile \
 	dlls/quartz/Makefile \
 	dlls/quartz/tests/Makefile \
@@ -796,6 +797,7 @@ dlls/qcap/Makefile: dlls/qcap/Makefile.in dlls/Makedll.rules
 dlls/qedit/Makefile: dlls/qedit/Makefile.in dlls/Makedll.rules
 dlls/qedit/tests/Makefile: dlls/qedit/tests/Makefile.in dlls/Maketest.rules
 dlls/qmgr/Makefile: dlls/qmgr/Makefile.in dlls/Makedll.rules
+dlls/qmgr/tests/Makefile: dlls/qmgr/tests/Makefile.in dlls/Maketest.rules
 dlls/qmgrprxy/Makefile: dlls/qmgrprxy/Makefile.in dlls/Makedll.rules
 dlls/quartz/Makefile: dlls/quartz/Makefile.in dlls/Makedll.rules
 dlls/quartz/tests/Makefile: dlls/quartz/tests/Makefile.in dlls/Maketest.rules
diff --git a/configure b/configure
index 3d81b67ad37..66622a1dff2 100755
--- a/configure
+++ b/configure
@@ -21617,6 +21617,8 @@ ac_config_files="$ac_config_files dlls/qedit/tests/Makefile"
 
 ac_config_files="$ac_config_files dlls/qmgr/Makefile"
 
+ac_config_files="$ac_config_files dlls/qmgr/tests/Makefile"
+
 ac_config_files="$ac_config_files dlls/qmgrprxy/Makefile"
 
 ac_config_files="$ac_config_files dlls/quartz/Makefile"
@@ -22754,6 +22756,7 @@ do
     "dlls/qedit/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/qedit/Makefile" ;;
     "dlls/qedit/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/qedit/tests/Makefile" ;;
     "dlls/qmgr/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/qmgr/Makefile" ;;
+    "dlls/qmgr/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/qmgr/tests/Makefile" ;;
     "dlls/qmgrprxy/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/qmgrprxy/Makefile" ;;
     "dlls/quartz/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/quartz/Makefile" ;;
     "dlls/quartz/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/quartz/tests/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index 12720883761..ba0355a53d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1882,6 +1882,7 @@ AC_CONFIG_FILES([dlls/qcap/Makefile])
 AC_CONFIG_FILES([dlls/qedit/Makefile])
 AC_CONFIG_FILES([dlls/qedit/tests/Makefile])
 AC_CONFIG_FILES([dlls/qmgr/Makefile])
+AC_CONFIG_FILES([dlls/qmgr/tests/Makefile])
 AC_CONFIG_FILES([dlls/qmgrprxy/Makefile])
 AC_CONFIG_FILES([dlls/quartz/Makefile])
 AC_CONFIG_FILES([dlls/quartz/tests/Makefile])
diff --git a/dlls/Makefile.in b/dlls/Makefile.in
index 643ab549033..6885d2a5a68 100644
--- a/dlls/Makefile.in
+++ b/dlls/Makefile.in
@@ -327,6 +327,7 @@ TESTSUBDIRS = \
 	pdh/tests \
 	psapi/tests \
 	qedit/tests \
+	qmgr/tests \
 	quartz/tests \
 	riched20/tests \
 	riched32/tests \
diff --git a/dlls/qmgr/tests/Makefile.in b/dlls/qmgr/tests/Makefile.in
new file mode 100644
index 00000000000..e16d5fc8141
--- /dev/null
+++ b/dlls/qmgr/tests/Makefile.in
@@ -0,0 +1,13 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+TESTDLL   = qmgr.dll
+IMPORTS   = ole32 kernel32
+
+CTESTS = \
+	qmgr.c
+
+@MAKE_TEST_RULES@
+
+@DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/qmgr/tests/qmgr.c b/dlls/qmgr/tests/qmgr.c
new file mode 100644
index 00000000000..005175182ac
--- /dev/null
+++ b/dlls/qmgr/tests/qmgr.c
@@ -0,0 +1,56 @@
+/*
+ * Unit test suite for bits functions
+ *
+ * Copyright 2007 Google (Roy Shea)
+ *
+ * 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
+ */
+
+#include <stdio.h>
+
+#define COBJMACROS
+
+#include "wine/test.h"
+#include "initguid.h"
+#include "bits.h"
+
+static void
+test_CreateInstance(void)
+{
+    HRESULT hres;
+    ULONG res;
+    IBackgroundCopyManager *manager = NULL;
+
+    /* Creating BITS instance */
+    hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL, CLSCTX_LOCAL_SERVER,
+                            &IID_IBackgroundCopyManager, (void **) &manager);
+    ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
+    if(hres != S_OK) {
+        skip("Unable to create bits instance.\n");
+        return;
+    }
+
+    /* Releasing bits manager */
+    res = IBackgroundCopyManager_Release(manager);
+    ok(res == 0, "Bad ref count on release: %u\n", res);
+
+}
+
+START_TEST(qmgr)
+{
+    CoInitialize(NULL);
+    test_CreateInstance();
+    CoUninitialize();
+}
diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in
index c3f6715a0d8..75029273695 100644
--- a/programs/winetest/Makefile.in
+++ b/programs/winetest/Makefile.in
@@ -71,6 +71,7 @@ TESTBINS = \
 	pdh_test.exe \
 	psapi_test.exe \
 	qedit_test.exe \
+	qmgr_test.exe \
 	quartz_test.exe \
 	riched20_test.exe \
 	riched32_test.exe \
@@ -199,6 +200,8 @@ psapi_test.exe: $(DLLDIR)/psapi/tests/psapi_test.exe$(DLLEXT)
 	cp $(DLLDIR)/psapi/tests/psapi_test.exe$(DLLEXT) $@ && $(STRIP) $@
 qedit_test.exe: $(DLLDIR)/qedit/tests/qedit_test.exe$(DLLEXT)
 	cp $(DLLDIR)/qedit/tests/qedit_test.exe$(DLLEXT) $@ && $(STRIP) $@
+qmgr_test.exe: $(DLLDIR)/qmgr/tests/qmgr_test.exe$(DLLEXT)
+	cp $(DLLDIR)/qmgr/tests/qmgr_test.exe$(DLLEXT) $@ && $(STRIP) $@
 quartz_test.exe: $(DLLDIR)/quartz/tests/quartz_test.exe$(DLLEXT)
 	cp $(DLLDIR)/quartz/tests/quartz_test.exe$(DLLEXT) $@ && $(STRIP) $@
 riched20_test.exe: $(DLLDIR)/riched20/tests/riched20_test.exe$(DLLEXT)
diff --git a/programs/winetest/winetest.rc b/programs/winetest/winetest.rc
index 0bcb21433ad..def64a01860 100644
--- a/programs/winetest/winetest.rc
+++ b/programs/winetest/winetest.rc
@@ -129,6 +129,7 @@ opengl32_test.exe TESTRES "opengl32_test.exe"
 pdh_test.exe TESTRES "pdh_test.exe"
 psapi_test.exe TESTRES "psapi_test.exe"
 qedit_test.exe TESTRES "qedit_test.exe"
+qmgr_test.exe TESTRES "qmgr_test.exe"
 quartz_test.exe TESTRES "quartz_test.exe"
 riched20_test.exe TESTRES "riched20_test.exe"
 riched32_test.exe TESTRES "riched32_test.exe"
-- 
GitLab