More simple tests for TxGetNaturalSize in riched20/tests/txtsrv.c
Austin Lund
austin.lund at gmail.com
Wed Jun 3 00:11:26 CDT 2009
-------------- next part --------------
From 7493cb2149d5d7087b8b7d8a7b468f5c57c751e4 Mon Sep 17 00:00:00 2001
From: Austin Lund <austin.lund at gmail.com>
Date: Wed, 3 Jun 2009 14:56:30 +1000
Subject: [PATCH] riched20/tests: Test TxGetNaturalSize measurement of two 'A' characters.
---
dlls/riched20/tests/txtsrv.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/dlls/riched20/tests/txtsrv.c b/dlls/riched20/tests/txtsrv.c
index e4d6ae4..ebc813d 100644
--- a/dlls/riched20/tests/txtsrv.c
+++ b/dlls/riched20/tests/txtsrv.c
@@ -683,6 +683,7 @@ static void test_TxGetNaturalSize(void) {
const SIZEL psizelExtent = {INT_MAX,INT_MAX};
static const WCHAR oneA[] = {'A',0};
+ static const WCHAR twoA[] = {'A','A',0};
/* Results of measurements */
LONG xdim, ydim;
@@ -732,6 +733,24 @@ static void test_TxGetNaturalSize(void) {
"Width calculated incorrectly (expected %d {+1}, got %d)\n",
charwidth_caps_text[0], xdim);
+ xdim = 0; ydim = 0;
+
+ result = ITextServices_TxSetText(txtserv, twoA);
+ ok(result == S_OK, "ITextServices_TxSetText failed\n");
+
+ result = ITextServices_TxGetNaturalSize(txtserv, DVASPECT_CONTENT,
+ hdcDraw, NULL, NULL,
+ TXTNS_FITTOCONTENT, &psizelExtent,
+ &xdim, &ydim);
+ todo_wine ok(result == S_OK, "TxGetNaturalSize failed\n");
+ todo_wine ok(ydim == tmInfo_text.tmHeight,
+ "Height calculated incorrectly (expected %d, got %d)\n",
+ tmInfo_text.tmHeight, ydim);
+ /* The native DLL adds one pixel extra when calculating widths. */
+ todo_wine ok(xdim >= 2*charwidth_caps_text[0] && xdim <= 2*charwidth_caps_text[0] + 1,
+ "Width calculated incorrectly (expected %d {+1}, got %d)\n",
+ 2*charwidth_caps_text[0], xdim);
+
RestoreDC(hdcDraw,1);
ReleaseDC(NULL,hdcDraw);
--
1.6.0.4
-------------- next part --------------
From 1ca0b4f9b451117b2337e1292a4747258bb0f837 Mon Sep 17 00:00:00 2001
From: Austin Lund <austin.lund at gmail.com>
Date: Wed, 3 Jun 2009 15:02:37 +1000
Subject: [PATCH] riched20/tests: Test TxGetNaturalSize measurement of one 'I' character.
---
dlls/riched20/tests/txtsrv.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/dlls/riched20/tests/txtsrv.c b/dlls/riched20/tests/txtsrv.c
index ebc813d..fd88095 100644
--- a/dlls/riched20/tests/txtsrv.c
+++ b/dlls/riched20/tests/txtsrv.c
@@ -684,6 +684,7 @@ static void test_TxGetNaturalSize(void) {
static const WCHAR oneA[] = {'A',0};
static const WCHAR twoA[] = {'A','A',0};
+ static const WCHAR oneI[] = {'I',0};
/* Results of measurements */
LONG xdim, ydim;
@@ -751,6 +752,23 @@ static void test_TxGetNaturalSize(void) {
"Width calculated incorrectly (expected %d {+1}, got %d)\n",
2*charwidth_caps_text[0], xdim);
+ xdim = 0; ydim = 0;
+
+ result = ITextServices_TxSetText(txtserv, oneI);
+ ok(result == S_OK, "ITextServices_TxSetText failed\n");
+
+ result = ITextServices_TxGetNaturalSize(txtserv, DVASPECT_CONTENT,
+ hdcDraw, NULL, NULL,
+ TXTNS_FITTOCONTENT, &psizelExtent,
+ &xdim, &ydim);
+ todo_wine ok(result == S_OK, "TxGetNaturalSize failed\n");
+ todo_wine ok(ydim == tmInfo_text.tmHeight,
+ "Height calculated incorrectly (expected %d, got %d)\n",
+ tmInfo_text.tmHeight, ydim);
+ todo_wine ok(xdim >= charwidth_caps_text[8] && xdim <= charwidth_caps_text[8] + 1,
+ "Width calculated incorrectly (expected %d {+1}, got %d)\n",
+ charwidth_caps_text[8], xdim);
+
RestoreDC(hdcDraw,1);
ReleaseDC(NULL,hdcDraw);
--
1.6.0.4
More information about the wine-patches
mailing list