Alex Villacís Lasso : richedit: Tests for WM_SIZE/ scrollbar recursion bug, with todo_wine.
Alexandre Julliard
julliard at winehq.org
Wed Jul 23 07:10:08 CDT 2008
Module: wine
Branch: master
Commit: 9d39754e93f4490291d839b463dc4577bad9501f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9d39754e93f4490291d839b463dc4577bad9501f
Author: Alex Villacís Lasso <a_villacis at palosanto.com>
Date: Sun Jul 20 10:57:18 2008 -0500
richedit: Tests for WM_SIZE/scrollbar recursion bug, with todo_wine.
This is a minimal model of what happens in Corman Lisp 3.0 -
subclassed window class that unconditionally calls ShowScrollBar() to
force scrollbar visibility.
---
dlls/riched20/tests/editor.c | 71 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 71 insertions(+), 0 deletions(-)
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index a4d0369..d8abdc0 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -2229,11 +2229,45 @@ static void test_EM_SCROLL(void)
DestroyWindow(hwndRichEdit);
}
+unsigned int recursionLevel = 0;
+unsigned int WM_SIZE_recursionLevel = 0;
+BOOL bailedOutOfRecursion = FALSE;
+LRESULT WINAPI (*richeditProc)(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
+
+static LRESULT WINAPI RicheditStupidOverrideProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ LRESULT r;
+
+ if (bailedOutOfRecursion) return 0;
+ if (recursionLevel >= 32) {
+ bailedOutOfRecursion = TRUE;
+ return 0;
+ }
+
+ recursionLevel++;
+ switch (message) {
+ case WM_SIZE:
+ WM_SIZE_recursionLevel++;
+ r = richeditProc(hwnd, message, wParam, lParam);
+ /* Because, uhhhh... I never heard of ES_DISABLENOSCROLL */
+ ShowScrollBar(hwnd, SB_VERT, TRUE);
+ WM_SIZE_recursionLevel--;
+ break;
+ default:
+ r = richeditProc(hwnd, message, wParam, lParam);
+ break;
+ }
+ recursionLevel--;
+ return r;
+}
+
static void test_scrollbar_visibility(void)
{
HWND hwndRichEdit;
const char * text="a\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\n";
SCROLLINFO si;
+ WNDCLASSA cls;
+ BOOL r;
/* These tests show that richedit should temporarily refrain from automatically
hiding or showing its scrollbars (vertical at least) when an explicit request
@@ -2929,6 +2963,43 @@ static void test_scrollbar_visibility(void)
si.nPage, si.nMin, si.nMax);
DestroyWindow(hwndRichEdit);
+
+ /* This window proc models what is going on with Corman Lisp 3.0.
+ At WM_SIZE, this proc unconditionally calls ShowScrollBar() to
+ force the scrollbar into visibility. Recursion should NOT happen
+ as a result of this action.
+ */
+ r = GetClassInfoA(NULL, RICHEDIT_CLASS, &cls);
+ if (r) {
+ richeditProc = cls.lpfnWndProc;
+ cls.lpfnWndProc = RicheditStupidOverrideProcA;
+ cls.lpszClassName = "RicheditStupidOverride";
+ if(!RegisterClassA(&cls)) assert(0);
+
+ recursionLevel = 0;
+ WM_SIZE_recursionLevel = 0;
+ bailedOutOfRecursion = FALSE;
+ hwndRichEdit = new_window(cls.lpszClassName, ES_MULTILINE, NULL);
+ todo_wine {
+ ok(!bailedOutOfRecursion,
+ "WM_SIZE/scrollbar mutual recursion detected, expected none!\n");
+ }
+
+ recursionLevel = 0;
+ WM_SIZE_recursionLevel = 0;
+ bailedOutOfRecursion = FALSE;
+ MoveWindow(hwndRichEdit, 0, 0, 250, 100, TRUE);
+ todo_wine {
+ ok(!bailedOutOfRecursion,
+ "WM_SIZE/scrollbar mutual recursion detected, expected none!\n");
+ }
+
+ /* Unblock window in order to process WM_DESTROY */
+ recursionLevel = 0;
+ bailedOutOfRecursion = FALSE;
+ WM_SIZE_recursionLevel = 0;
+ DestroyWindow(hwndRichEdit);
+ }
}
static void test_EM_SETUNDOLIMIT(void)
More information about the wine-cvs
mailing list