riched20: add tests for EM_FORMATRANGE

Lei Zhang thestig at google.com
Mon Jun 18 16:17:45 CDT 2007


Hi,

In my last attempt, I submitted Troy Rollo's EM_FORMATRANGE
implementation and with my test cases. I'm not sure what was wrong
with the implementation, but the test cases should be ok.
-------------- next part --------------
From eaf17f5dc6992d08d22bc5e03ac32094bc91de89 Mon Sep 17 00:00:00 2001
From: Lei Zhang <thestig at google.com>
Date: Mon, 18 Jun 2007 14:13:31 -0700
Subject: [PATCH] riched20: add tests for EM_FORMATRANGE
---
 dlls/riched20/tests/editor.c |   46 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 1881005..b20e719 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -1491,6 +1491,51 @@ static void test_WM_PASTE(void)
     DestroyWindow(hwndRichEdit);
 }
 
+static void test_EM_FORMATRANGE(void)
+{
+  int r;
+  FORMATRANGE fr;
+  HDC hdc;
+  HWND hwndRichEdit = new_richedit(NULL);
+
+  SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) haystack);
+
+  hdc = GetDC(hwndRichEdit);
+  ok(hdc != NULL, "Could not get HDC\n");
+
+  fr.hdc = fr.hdcTarget = hdc;
+  fr.rc.top = fr.rcPage.top = fr.rc.left = fr.rcPage.left = 0;
+  fr.rc.right = fr.rcPage.right = GetDeviceCaps(hdc, HORZRES);
+  fr.rc.bottom = fr.rcPage.bottom = GetDeviceCaps(hdc, VERTRES);
+  fr.chrg.cpMin = 0;
+  fr.chrg.cpMax = 20;
+
+  r = SendMessage(hwndRichEdit, EM_FORMATRANGE, TRUE, (LPARAM) NULL);
+  todo_wine {
+    ok(r == 31, "EM_FORMATRANGE expect %d, got %d\n", 31, r);
+  }
+
+  r = SendMessage(hwndRichEdit, EM_FORMATRANGE, TRUE, (LPARAM) &fr);
+  todo_wine {
+    ok(r == 20, "EM_FORMATRANGE expect %d, got %d\n", 20, r);
+  }
+
+  fr.chrg.cpMin = 0;
+  fr.chrg.cpMax = 10;
+
+  r = SendMessage(hwndRichEdit, EM_FORMATRANGE, TRUE, (LPARAM) &fr);
+  todo_wine {
+    ok(r == 10, "EM_FORMATRANGE expect %d, got %d\n", 10, r);
+  }
+
+  r = SendMessage(hwndRichEdit, EM_FORMATRANGE, TRUE, (LPARAM) NULL);
+  todo_wine {
+    ok(r == 31, "EM_FORMATRANGE expect %d, got %d\n", 31, r);
+  }
+
+  DestroyWindow(hwndRichEdit);
+}
+
 static int nCallbackCount = 0;
 
 static DWORD CALLBACK EditStreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff,
@@ -1808,6 +1853,7 @@ START_TEST( editor )
   test_EM_EXSETSEL();
   test_WM_PASTE();
   test_EM_StreamIn_Undo();
+  test_EM_FORMATRANGE();
   test_unicode_conversions();
 
   /* Set the environment variable WINETEST_RICHED20 to keep windows
-- 
1.4.1


More information about the wine-patches mailing list