Author: mjansen
Date: Thu Jun 16 21:00:08 2016
New Revision: 71649
URL:
http://svn.reactos.org/svn/reactos?rev=71649&view=rev
Log:
[MSGINA_APITEST] Add a test for ShellDimScreen, used to fade out the background of the
logoff dialog. Thanks to Jared for finding the api, and Hermès for his help! CORE-11422
Added:
trunk/rostests/apitests/msgina/
trunk/rostests/apitests/msgina/CMakeLists.txt (with props)
trunk/rostests/apitests/msgina/ShellDimScreen.cpp (with props)
trunk/rostests/apitests/msgina/testlist.c (with props)
Modified:
trunk/rostests/apitests/CMakeLists.txt
Modified: trunk/rostests/apitests/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/CMakeLists.txt?r…
==============================================================================
--- trunk/rostests/apitests/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/CMakeLists.txt [iso-8859-1] Thu Jun 16 21:00:08 2016
@@ -14,6 +14,7 @@
if(NOT ARCH STREQUAL "amd64")
add_subdirectory(kernel32)
endif()
+add_subdirectory(msgina)
add_subdirectory(msvcrt)
add_subdirectory(ntdll)
add_subdirectory(ole32)
Added: trunk/rostests/apitests/msgina/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/msgina/CMakeList…
==============================================================================
--- trunk/rostests/apitests/msgina/CMakeLists.txt (added)
+++ trunk/rostests/apitests/msgina/CMakeLists.txt [iso-8859-1] Thu Jun 16 21:00:08 2016
@@ -0,0 +1,13 @@
+
+set_cpp(WITH_RUNTIME)
+
+include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl)
+
+add_executable(msgina_apitest
+ ShellDimScreen.cpp
+ testlist.c)
+
+target_link_libraries(msgina_apitest wine uuid)
+set_module_type(msgina_apitest win32cui)
+add_importlibs(msgina_apitest msvcrt user32 kernel32)
+add_cd_file(TARGET msgina_apitest DESTINATION reactos/bin FOR all)
Propchange: trunk/rostests/apitests/msgina/CMakeLists.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/apitests/msgina/ShellDimScreen.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/msgina/ShellDimS…
==============================================================================
--- trunk/rostests/apitests/msgina/ShellDimScreen.cpp (added)
+++ trunk/rostests/apitests/msgina/ShellDimScreen.cpp [iso-8859-1] Thu Jun 16 21:00:08
2016
@@ -0,0 +1,114 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
+ * PURPOSE: Test for ShellDimScreen
+ * PROGRAMMER: Mark Jansen
+ */
+
+#include <apitest.h>
+#include <atlbase.h>
+#include <atlcom.h>
+
+#define INITGUID
+#include <guiddef.h>
+// stolen from com_apitest.h
+DEFINE_GUID(CLSID_FadeTask, 0x7EB5FBE4, 0x2100, 0x49E6, 0x85, 0x93, 0x17,
0xE1, 0x30, 0x12, 0x2F, 0x91);
+
+
+typedef HRESULT (__stdcall *tShellDimScreen) (IUnknown** Unknown, HWND* hWindow);
+
+tShellDimScreen ShellDimScreen;
+
+static void Test_Dim()
+{
+ IUnknown* unk = (IUnknown*)0xdeadbeef;
+ HWND wnd = (HWND)0xdeadbeef;
+ ULONG count;
+
+ HRESULT hr = ShellDimScreen(NULL, NULL);
+ ok_hex(hr, E_INVALIDARG);
+
+ hr = ShellDimScreen(&unk, &wnd);
+ ok_hex(hr, S_OK);
+ ok(unk != ((IUnknown*)0xdeadbeef), "Expected a valid object\n");
+ ok(wnd != ((HWND)0xdeadbeef), "Expected a valid window ptr\n");
+ ok(IsWindow(wnd), "Expected a valid window\n");
+ ok(IsWindowVisible(wnd), "Expected the window to be visible\n");
+
+ if (unk != ((IUnknown*)0xdeadbeef) && unk)
+ {
+ count = unk->Release();
+ ok(count == 0, "Expected count to be 0, was: %lu\n", count);
+ ok(!IsWindow(wnd), "Expected the window to be destroyed\n");
+ }
+
+ unk = (IUnknown*)0xdeadbeef;
+ wnd = (HWND)0xdeadbeef;
+ hr = ShellDimScreen(&unk, &wnd);
+ ok_hex(hr, S_OK);
+ ok(unk != ((IUnknown*)0xdeadbeef), "Expected a valid object\n");
+ ok(wnd != ((HWND)0xdeadbeef), "Expected a valid window ptr\n");
+ ok(IsWindow(wnd), "Expected a valid window\n");
+ ok(IsWindowVisible(wnd), "Expected the window to be visible\n");
+ char classname[100] = {0};;
+ int nRet = GetClassNameA(wnd, classname, 100);
+ ok(nRet == 17, "Expected GetClassName to return 3 was %i\n", nRet);
+ ok(!strcmp(classname, "DimmedWindowClass"), "Expected classname to be
DimmedWindowClass, was %s\n", classname);
+ LONG style = GetWindowLong(wnd, GWL_STYLE);
+ LONG expectedstyle = WS_POPUP | WS_VISIBLE | WS_DISABLED | WS_CLIPSIBLINGS;
+ ok(style == expectedstyle, "Expected style to be %lx, was %lx\n",
expectedstyle, style);
+ style = GetWindowLong(wnd, GWL_EXSTYLE);
+ ok(style == WS_EX_TOPMOST, "Expected exstyle to be %x, was %lx\n",
WS_EX_TOPMOST, style);
+
+ if (unk != ((IUnknown*)0xdeadbeef) && unk)
+ {
+ count = unk->AddRef();
+ ok(count == 2, "Expected count to be 2, was: %lu\n", count);
+ count = unk->Release();
+ ok(count == 1, "Expected count to be 1, was: %lu\n", count);
+
+ IUnknown* unk2;
+ hr = unk->QueryInterface(IID_IUnknown, (void**)&unk2);
+ ok_hex(hr, S_OK);
+ if (SUCCEEDED(hr))
+ {
+ ok(unk2 == unk, "Expected the object to be the same, was: %p,
%p\n", unk, unk2);
+ unk2->Release();
+ }
+ hr = unk->QueryInterface(CLSID_FadeTask, (void**)&unk2);
+ ok_hex(hr, E_NOINTERFACE);
+ if (SUCCEEDED(hr))
+ {
+ ok(unk2 == unk, "Expected the object to be the same, was: %p,
%p\n", unk, unk2);
+ unk2->Release();
+ }
+ }
+
+ RECT rc;
+ GetWindowRect(wnd, &rc);
+
+ ok(rc.left == GetSystemMetrics(SM_XVIRTUALSCREEN), "Expected rc.left to be %u,
was %lu\n", GetSystemMetrics(SM_XVIRTUALSCREEN), rc.left);
+ ok(rc.top == GetSystemMetrics(SM_YVIRTUALSCREEN), "Expected rc.top to be %u, was
%lu\n", GetSystemMetrics(SM_YVIRTUALSCREEN), rc.top);
+ ok((rc.right - rc.left) == GetSystemMetrics(SM_CXVIRTUALSCREEN), "Expected
rc.left to be %u, was %lu\n", GetSystemMetrics(SM_CXVIRTUALSCREEN), (rc.right -
rc.left));
+ ok((rc.bottom - rc.top) == GetSystemMetrics(SM_CYVIRTUALSCREEN), "Expected
rc.top to be %u, was %lu\n", GetSystemMetrics(SM_CYVIRTUALSCREEN), (rc.bottom -
rc.top));
+
+ if (unk != ((IUnknown*)0xdeadbeef) && unk)
+ {
+ count = unk->Release();
+ ok(count == 0, "Expected count to be 0, was: %lu\n", count);
+ ok(!IsWindow(wnd), "Expected the window to be destroyed\n");
+ }
+}
+
+
+START_TEST(ShellDimScreen)
+{
+ HMODULE dll = LoadLibraryA("msgina.dll");
+ ShellDimScreen = (tShellDimScreen)GetProcAddress(dll, MAKEINTRESOURCEA(16));
+ if (!dll || !ShellDimScreen)
+ {
+ skip("msgina!#16 not found, skipping tests\n");
+ return;
+ }
+ Test_Dim();
+}
Propchange: trunk/rostests/apitests/msgina/ShellDimScreen.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/apitests/msgina/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/msgina/testlist.…
==============================================================================
--- trunk/rostests/apitests/msgina/testlist.c (added)
+++ trunk/rostests/apitests/msgina/testlist.c [iso-8859-1] Thu Jun 16 21:00:08 2016
@@ -0,0 +1,10 @@
+#define STANDALONE
+#include <apitest.h>
+
+extern void func_ShellDimScreen(void);
+
+const struct test winetest_testlist[] =
+{
+ { "ShellDimScreen", func_ShellDimScreen },
+ { 0, 0 }
+};
Propchange: trunk/rostests/apitests/msgina/testlist.c
------------------------------------------------------------------------------
svn:eol-style = native