Author: gadamopoulos
Date: Mon Oct 17 16:35:22 2011
New Revision: 54180
URL:
http://svn.reactos.org/svn/reactos?rev=54180&view=rev
Log:
[user32_apitest]
- Add some tests for the messages that are sent when SPI_SETNONCLIENTMETRICS is used
Added:
trunk/rostests/apitests/user32/SystemParametersInfo.c (with props)
Modified:
trunk/rostests/apitests/user32/CMakeLists.txt
trunk/rostests/apitests/user32/helper.c
trunk/rostests/apitests/user32/testlist.c
trunk/rostests/apitests/user32/user32_apitest.rbuild
Modified: trunk/rostests/apitests/user32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/CMakeList…
==============================================================================
--- trunk/rostests/apitests/user32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/user32/CMakeLists.txt [iso-8859-1] Mon Oct 17 16:35:22 2011
@@ -16,6 +16,7 @@
ScrollWindowEx.c
SetCursorPos.c
SetActiveWindow.c
+ SystemParametersInfo.c
TrackMouseEvent.c
WndProc.c
testlist.c
Added: trunk/rostests/apitests/user32/SystemParametersInfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/SystemPar…
==============================================================================
--- trunk/rostests/apitests/user32/SystemParametersInfo.c (added)
+++ trunk/rostests/apitests/user32/SystemParametersInfo.c [iso-8859-1] Mon Oct 17 16:35:22
2011
@@ -1,0 +1,126 @@
+/*
+ * PROJECT: ReactOS API tests
+ * LICENSE: GPL - See COPYING in the top level directory
+ * PURPOSE: Test for SystemParametersInfo function family
+ * PROGRAMMERS: Giannis Adamopoulos
+ */
+
+#include <stdio.h>
+#include <wine/test.h>
+#include <windows.h>
+#include "helper.h"
+#include <undocuser.h>
+
+HWND hWnd1, hWnd2;
+
+/* FIXME: test for HWND_TOP, etc...*/
+static int get_iwnd(HWND hWnd)
+{
+ if(hWnd == hWnd1) return 1;
+ else if(hWnd == hWnd2) return 2;
+ else return 0;
+}
+
+LRESULT CALLBACK SysParamsTestProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
lParam)
+{
+ int iwnd = get_iwnd(hWnd);
+
+ if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
+ return DefWindowProc(hWnd, message, wParam, lParam);
+
+ switch(message)
+ {
+ case WM_GETICON :
+ case WM_SETICON:
+ break;
+ case WM_WINDOWPOSCHANGING:
+ case WM_WINDOWPOSCHANGED:
+ {
+ WINDOWPOS* pwp = (WINDOWPOS*)lParam;
+ ok(wParam==0,"expected wParam=0\n");
+ record_message(iwnd, message, SENT, get_iwnd(pwp->hwndInsertAfter),
pwp->flags);
+ break;
+ }
+ default:
+ record_message(iwnd, message, SENT, 0,0);
+ }
+ return DefWindowProc(hWnd, message, wParam, lParam);
+}
+
+static void FlushMessages()
+{
+ MSG msg;
+
+ while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
+ {
+ int iwnd = get_iwnd(msg.hwnd);
+ if(!(msg.message > WM_USER || !iwnd || IsDWmMsg(msg.message) ||
IseKeyMsg(msg.message)))
+ record_message(iwnd, msg.message, POST,0,0);
+ DispatchMessageA( &msg );
+ }
+}
+
+MSG_ENTRY NcMetricsChange_chain[]={
+ {2,WM_WINDOWPOSCHANGING, SENT, 0,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOZORDER|SWP_NOREDRAW},
+ {2,WM_GETMINMAXINFO},
+ {2,WM_NCCALCSIZE},
+ {2,WM_WINDOWPOSCHANGED, SENT, 0,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOZORDER|SWP_NOREDRAW |
SWP_NOCLIENTSIZE},
+ {1,WM_WINDOWPOSCHANGING, SENT, 0,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOZORDER|SWP_NOREDRAW},
+ {1,WM_GETMINMAXINFO},
+ {1,WM_NCCALCSIZE},
+ {1,WM_WINDOWPOSCHANGED, SENT, 0,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOZORDER|SWP_NOREDRAW |
SWP_NOCLIENTSIZE},
+ {0,0}};
+
+MSG_ENTRY CaptionHeight_chain[]={
+ {2,WM_WINDOWPOSCHANGING, SENT, 0,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOZORDER|SWP_NOREDRAW},
+ {2,WM_GETMINMAXINFO},
+ {2,WM_NCCALCSIZE},
+ {2,WM_WINDOWPOSCHANGED, SENT, 0,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOZORDER|SWP_NOREDRAW |
SWP_NOCLIENTSIZE},
+ {2,WM_MOVE},
+ {1,WM_WINDOWPOSCHANGING, SENT, 0,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOZORDER|SWP_NOREDRAW},
+ {1,WM_GETMINMAXINFO},
+ {1,WM_NCCALCSIZE},
+ {1,WM_WINDOWPOSCHANGED, SENT, 0,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOZORDER|SWP_NOREDRAW |
SWP_NOCLIENTSIZE},
+ {1,WM_MOVE},
+ {0,0}};
+
+static void Test_NonClientMetrics()
+{
+ NONCLIENTMETRICS NonClientMetrics;
+
+ SetCursorPos(0,0);
+
+ NonClientMetrics.cbSize = sizeof(NONCLIENTMETRICS);
+ SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS),
&NonClientMetrics, 0);
+ FlushMessages();
+ COMPARE_CACHE(empty_chain);
+ SystemParametersInfo(SPI_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS),
&NonClientMetrics, 0);
+ FlushMessages();
+ COMPARE_CACHE(NcMetricsChange_chain);
+
+ NonClientMetrics.iCaptionHeight += 1;
+ SystemParametersInfo(SPI_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS),
&NonClientMetrics, 0);
+ FlushMessages();
+ COMPARE_CACHE(CaptionHeight_chain);
+
+ NonClientMetrics.iCaptionHeight -= 1;
+ SystemParametersInfo(SPI_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS),
&NonClientMetrics, 0);
+ FlushMessages();
+ COMPARE_CACHE(CaptionHeight_chain);
+}
+
+START_TEST(SystemParametersInfo)
+{
+ RegisterSimpleClass(SysParamsTestProc, L"sysparamstest");
+ hWnd1 = CreateWindowW(L"sysparamstest", L"sysparamstest",
WS_OVERLAPPEDWINDOW,
+ 20, 20, 300, 300, NULL, NULL, 0, NULL);
+
+ hWnd2 = CreateWindowW(L"sysparamstest", L"sysparamstest",
WS_OVERLAPPEDWINDOW,
+ 200, 200, 300, 300, NULL, NULL, 0, NULL);
+
+ Test_NonClientMetrics();
+
+ DestroyWindow(hWnd1);
+ DestroyWindow(hWnd2);
+ UnregisterClassW(L"sysparamstest", 0);
+}
Propchange: trunk/rostests/apitests/user32/SystemParametersInfo.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/apitests/user32/helper.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/helper.c?…
==============================================================================
--- trunk/rostests/apitests/user32/helper.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/user32/helper.c [iso-8859-1] Mon Oct 17 16:35:22 2011
@@ -45,6 +45,9 @@
case WM_SYSTIMER: return "WM_SYSTIMER";
case WM_GETMINMAXINFO: return "WM_GETMINMAXINFO";
case WM_NCCALCSIZE: return "WM_NCCALCSIZE";
+ case WM_SETTINGCHANGE: return "WM_SETTINGCHANGE";
+ case WM_GETICON: return "WM_GETICON";
+ case WM_SETICON: return "WM_SETICON";
default: return NULL;
}
}
@@ -204,4 +207,4 @@
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszClassName = lpszClassName;
return RegisterClassExW(&wcex);
-}
+}
Modified: trunk/rostests/apitests/user32/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/testlist.…
==============================================================================
--- trunk/rostests/apitests/user32/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/user32/testlist.c [iso-8859-1] Mon Oct 17 16:35:22 2011
@@ -16,6 +16,7 @@
extern void func_GetKeyState(void);
extern void func_SetCursorPos(void);
extern void func_SetActiveWindow(void);
+extern void func_SystemParametersInfo(void);
extern void func_TrackMouseEvent(void);
extern void func_WndProc(void);
@@ -32,6 +33,7 @@
{ "GetKeyState", func_GetKeyState },
{ "SetCursorPos", func_SetCursorPos },
{ "SetActiveWindow", func_SetActiveWindow },
+ { "SystemParametersInfo", func_SystemParametersInfo },
{ "TrackMouseEvent", func_TrackMouseEvent },
{ "WndProc", func_WndProc },
{ 0, 0 }
Modified: trunk/rostests/apitests/user32/user32_apitest.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/user32_ap…
==============================================================================
--- trunk/rostests/apitests/user32/user32_apitest.rbuild [iso-8859-1] (original)
+++ trunk/rostests/apitests/user32/user32_apitest.rbuild [iso-8859-1] Mon Oct 17 16:35:22
2011
@@ -22,6 +22,7 @@
<file>DeferWindowPos.c</file>
<file>SetActiveWindow.c</file>
<file>SetCursorPos.c</file>
+ <file>SystemParametersInfo.c</file>
<file>TrackMouseEvent.c</file>
<file>WndProc.c</file>