riched20: Implement superscript/subscript shortcut key.

Jactry Zeng jactry92 at gmail.com
Tue Nov 3 22:45:08 CST 2015


2015-11-03 22:39 GMT+08:00 Huw Davies <huw at codeweavers.com>:
>
> Again, it shouldn't be too hard to add a test for this.  We do similar
tests
> by sending WM_KEYDOWN/UP messages to the control.

For this patch, I also had some tests local. But I found the way we did
in send_ctrl_key()
can't simulate a three-keys shortcut key in Windows(though it works for
Wine).

I ran it on testbot: https://testbot.winehq.org/JobDetails.pl?Key=17961
(dwEffects was expected as 0x44020001)

Thanks again!
-- 
Regards,
Jactry Zeng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20151104/e29422bb/attachment.html>
-------------- next part --------------
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 4705dd6..e56c2de 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -7951,6 +7951,34 @@ static void test_EM_SETFONTSIZE(void)
     DestroyWindow(richedit);
 }
 
+static void send_ctrl_shift_key(HWND hwnd, UINT key)
+{
+    hold_key(VK_CONTROL);
+    hold_key(VK_SHIFT);
+    SendMessageA(hwnd, WM_KEYDOWN, key, 1);
+    release_key(VK_CONTROL);
+    release_key(VK_SHIFT);
+}
+
+static void test_superscript_subscript_shortcut_key(void)
+{
+    HWND richedit = new_richedit(NULL);
+    char sometext[] = "Wine Text";
+    CHARFORMAT2A cf2;
+
+    ZeroMemory(&cf2, sizeof(cf2));
+    cf2.cbSize = sizeof(CHARFORMAT2A);
+
+    SendMessageA(richedit, WM_SETTEXT, 0, (LPARAM)sometext);
+
+    send_ctrl_shift_key(richedit, VK_OEM_PLUS);
+
+    SendMessageA(richedit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
+    ok(cf2.dwEffects & CFE_SUPERSCRIPT, "got wrong dwEffects: 0x%08x\n", cf2.dwEffects);
+
+    DestroyWindow(richedit);
+}
+
 START_TEST( editor )
 {
   BOOL ret;
@@ -8017,6 +8045,7 @@ START_TEST( editor )
   test_reset_default_para_fmt();
   test_EM_SETREADONLY();
   test_EM_SETFONTSIZE();
+  test_superscript_subscript_shortcut_key();
 
   /* Set the environment variable WINETEST_RICHED20 to keep windows
    * responsive and open for 30 seconds. This is useful for debugging.


More information about the wine-devel mailing list