Cleanup of riched20 tests - request for help on test_WM_PASTE

Alex Villací­s Lasso a_villacis at
Mon Oct 29 15:22:50 CDT 2007

I am currently trying to clean up the riched20 tests that are failing in 
WinXP. While doing this, I have encountered the following problem: on 
the function test_WM_PASTE() (at line 1959 of 
dlls/riched20/tests/editor.c in current git), the test is supposed to 
feed simulated keystrokes corresponding to Ctrl-C, Ctrl-V, and so on, 
supposedly to test copy and paste features via the keyboard. The problem 
is that the verification at line 1989 fails on WinXP, because the text 
on the control has not been modified - the control seems to disregard 
simulated WM_CHAR messages of the Ctrl-<keystroke> variety. The test at 
line 1977 succeeds accidentally, because the sequence of Ctrl-C, Ctrl-V, 
Ctrl-Z that is being tested is equivalent to not modifying the control 
text at all.

A more through test would be to send WM_GETTEXT messages after each step 
to ensure that the text is actually being modified, but the bigger 
problem is how to make the control obey the keystrokes in the first 
place. If I place a message loop right before the DestroyWindow() call, 
I can send keystrokes manually and they work as expected. Only simulated 
WM_CHAR messages are being discarded.

I have tried changing the SendMessage() calls into PostMessage() calls 
(since Visual Studio's Spy++ shows that WM_CHAR messages were posted, 
not sent), but to no avail. I have also tried placing message loops 
between messages, with no luck. I have even tried to simulate the 
WM_KEYDOWN and WM_KEYUP messages with parameters exactly as seen by 
Spy++, but this does not work either. So I am asking for help. What 
could be going wrong with this test? How can I feed the expected 
keystrokes so that the test works as expected? Has this test ever worked 
before? It fails in both WinXP (real machine) and inside a QEMU session 
running Win98.

(All tests on WinXP were compiled with CygWin)

perl -e '$x=2.4;print sprintf("%.0f + %.0f = %.0f\n",$x,$x,$x+$x);'

More information about the wine-devel mailing list