Dylan Smith : richedit: Added some extra tests for EM_FORMATRANGE.
Alexandre Julliard
julliard at winehq.org
Mon Feb 22 08:46:51 CST 2010
Module: wine
Branch: master
Commit: fe9933ae4d4d84910032b3ed393cbb8c66dc3eae
URL: http://source.winehq.org/git/wine.git/?a=commit;h=fe9933ae4d4d84910032b3ed393cbb8c66dc3eae
Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date: Mon Feb 22 03:17:49 2010 -0500
richedit: Added some extra tests for EM_FORMATRANGE.
The existing tests were not properly testing the return value for the case
where all the text fits in the page rect, so this patch adds a couple of
simple tests for this case.
---
dlls/riched20/tests/editor.c | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 8aa1c39..1fbdaa5 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -4812,9 +4812,10 @@ static void test_WM_PASTE(void)
static void test_EM_FORMATRANGE(void)
{
- int i, tpp_x, tpp_y;
+ int r, i, tpp_x, tpp_y;
HDC hdc;
HWND hwndRichEdit = new_richedit(NULL);
+ FORMATRANGE fr;
static const struct {
const char *string; /* The string */
int first; /* First 'pagebreak', 0 for don't care */
@@ -4834,14 +4835,29 @@ static void test_EM_FORMATRANGE(void)
tpp_x = 1440 / GetDeviceCaps(hdc, LOGPIXELSX);
tpp_y = 1440 / GetDeviceCaps(hdc, LOGPIXELSY);
+ /* Test the simple case where all the text fits in the page rect. */
+ SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"a");
+ fr.hdc = fr.hdcTarget = hdc;
+ fr.rc.top = fr.rcPage.top = fr.rc.left = fr.rcPage.left = 0;
+ fr.rc.right = fr.rcPage.right = 500 * tpp_x;
+ fr.rc.bottom = fr.rcPage.bottom = 500 * tpp_y;
+ fr.chrg.cpMin = 0;
+ fr.chrg.cpMax = -1;
+ r = SendMessage(hwndRichEdit, EM_FORMATRANGE, FALSE, (LPARAM)&fr);
+ todo_wine ok(r == 2, "r=%d expected r=2\n", r);
+
+ SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"ab");
+ fr.rc.bottom = fr.rcPage.bottom;
+ r = SendMessage(hwndRichEdit, EM_FORMATRANGE, FALSE, (LPARAM)&fr);
+ todo_wine ok(r == 3, "r=%d expected r=3\n", r);
+
SendMessage(hwndRichEdit, EM_FORMATRANGE, FALSE, 0);
for (i = 0; i < sizeof(fmtstrings)/sizeof(fmtstrings[0]); i++)
{
- FORMATRANGE fr;
GETTEXTLENGTHEX gtl;
SIZE stringsize;
- int r, len;
+ int len;
SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) fmtstrings[i].string);
More information about the wine-cvs
mailing list