[PATCH 2/2] slc/tests: Add tests for SLGetWindowsInformationDWORD [try 2]

Detlef Riekenberg wine.dev at web.de
Fri Nov 5 09:22:49 CDT 2010


---
 dlls/slc/slc.c             |    2 +-
 dlls/slc/tests/Makefile.in |    7 +++
 dlls/slc/tests/slc.c       |   88 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 96 insertions(+), 1 deletions(-)
 create mode 100644 dlls/slc/tests/Makefile.in
 create mode 100644 dlls/slc/tests/slc.c

diff --git a/dlls/slc/slc.c b/dlls/slc/slc.c
index 72efaeb..9a51ece 100644
--- a/dlls/slc/slc.c
+++ b/dlls/slc/slc.c
@@ -82,9 +82,9 @@ HRESULT WINAPI SLGetWindowsInformationDWORD(LPCWSTR lpszValueName, LPDWORD pdwVa
             return S_OK;
         }
     }
+
     /* SL_E_VALUE_NOT_FOUND (0xC004F012) fit best as name here, but the value
        0xC004F013 (SL_E_RIGHT_NOT_GRANTED) is returned on Windows */
-        
     return SL_E_RIGHT_NOT_GRANTED;
 
 }
diff --git a/dlls/slc/tests/Makefile.in b/dlls/slc/tests/Makefile.in
new file mode 100644
index 0000000..3b53984
--- /dev/null
+++ b/dlls/slc/tests/Makefile.in
@@ -0,0 +1,7 @@
+TESTDLL   = slc.dll
+IMPORTS   = slc
+
+C_SRCS = \
+	slc.c
+
+ at MAKE_TEST_RULES@
diff --git a/dlls/slc/tests/slc.c b/dlls/slc/tests/slc.c
new file mode 100644
index 0000000..d874a32
--- /dev/null
+++ b/dlls/slc/tests/slc.c
@@ -0,0 +1,88 @@
+/*
+ * Unit test suite for the software license client dll
+ *
+ * Copyright 2010 Detlef Riekenberg
+ *
+ * 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 <stdarg.h>
+#include <stdio.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "winerror.h"
+
+#include "slpublic.h"
+#include "slerror.h"
+#include "wine/test.h"
+
+
+static const WCHAR does_not_exist[] = {'d','o','e','s','_','n','o','t','_','e','x','i','s','t',0};
+static const WCHAR empty[] = {0};
+static const WCHAR freecell[] = {'S','h','e','l','l','-',
+                                 'I','n','B','o','x','G','a','m','e','s','-',
+                                 'F','r','e','e','C','e','l','l','-',
+                                 'E','n','a','b','l','e','G','a','m','e',0};
+static const WCHAR minesweeper[] = {'S','h','e','l','l','-',
+                                    'I','n','B','o','x','G','a','m','e','s','-',
+                                    'M','i','n','e','s','w','e','e','p','e','r','-',
+                                    'E','n','a','b','l','e','G','a','m','e',0};
+
+/* #### */
+
+static void test_SLGetWindowsInformationDWORD(void)
+{
+    HRESULT hr;
+    DWORD value;
+
+    /* expected use */
+    value = 0xdeadbeef;
+    hr = SLGetWindowsInformationDWORD(minesweeper, &value);
+    ok((hr == S_OK) || (hr == SL_E_VALUE_NOT_FOUND),
+        "got 0x%x and 0x%x (expected S_OK or SL_E_VALUE_NOT_FOUND)\n", hr, value);
+
+    value = 0xdeadbeef;
+    hr = SLGetWindowsInformationDWORD(freecell, &value);
+    ok((hr == S_OK) || (hr == SL_E_VALUE_NOT_FOUND),
+        "got 0x%x and 0x%x (expected S_OK or SL_E_VALUE_NOT_FOUND)\n", hr, value);
+
+    /* the application-value string is required */
+    value = 0xdeadbeef;
+    hr = SLGetWindowsInformationDWORD(empty, &value);
+    ok(hr == SL_E_RIGHT_NOT_GRANTED,
+        "got 0x%x and 0x%x (expected SL_E_RIGHT_NOT_GRANTED)\n", hr, value);
+
+    value = 0xdeadbeef;
+    hr = SLGetWindowsInformationDWORD(does_not_exist, &value);
+    ok(hr == SL_E_RIGHT_NOT_GRANTED,
+        "got 0x%x and 0x%x (expected SL_E_RIGHT_NOT_GRANTED)\n", hr, value);
+
+    /* NULL is not allowed */
+    value = 0xdeadbeef;
+    hr = SLGetWindowsInformationDWORD(NULL, &value);
+    ok(hr == E_INVALIDARG, "got 0x%x and 0x%x (expected E_INVALIDARG)\n", hr, value);
+
+    hr = SLGetWindowsInformationDWORD(minesweeper, NULL);
+    ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
+}
+
+/* #### */
+
+START_TEST(slc)
+{
+    test_SLGetWindowsInformationDWORD();
+}
-- 
1.7.1




More information about the wine-patches mailing list