The msctf:inputprocessor test is not reliable
Francois Gouget
fgouget at free.fr
Sat Sep 10 07:03:45 CDT 2011
This test is not reliable on my Debian desktop.
http://test.winehq.org/data/3b40c03a8f0e3dcbb236d59125b115b2501086f8/linux_fg-deb64-t32/msctf:inputprocessor.html
inputprocessor.c:2117: Test failed: OnSetFocus expected current focus 0x12b070 got 0x12b0d0
inputprocessor.c:538: Test failed: Unexpected ThreadMgrEventSink_OnSetFocus sink
inputprocessor.c:549: Test failed: Sink reports wrong previous focus
If I run it in a loop it fails about once every twelve times:
i=0;while ../../../tools/runtest inputprocessor.c && [ $i -lt 100 ];do i=`expr $i + 1`; echo $i; done
Introducing a single Sleep(50) as shown below makes it totally
reliable here.
ShowWindow(wnd3,SW_SHOWNORMAL);
SetFocus(wnd3);
+ Sleep(50);
processPendingMessages();
test_CurrentFocus = FOCUS_SAVE;
test_PrevFocus = FOCUS_SAVE;
test_OnSetFocus = SINK_SAVE;
SetFocus(wnd1);
processPendingMessages();
sink_check_saved(&test_OnSetFocus,dm2,dm1,"OnSetFocus");
/* ^^^ Line that fails! */
That seems pretty hacky though. I suspect this is all because
processPendingMessages() will exit if there's no pending message right
after we call SetFocus() without giving enough time for the asynchronous
X event to arrive.
But I'm surprised that a single Sleep() fixes the issue, especially
where it's placed. Also I don't know anything about msctf so I'm unsure
how ThreadMgrEventSink_OnSetFocus() figures in all this.
So should I just submit a patch to add that Sleep()?
Or would it be better to change processPendingMessages() to look more
like user32/tests/msg.c's flush_events() function although it looks like
it's overkill for now?
--
Francois Gouget <fgouget at free.fr> http://fgouget.free.fr/
Linux: It is now safe to turn on your computer.
More information about the wine-devel
mailing list