Erich E. Hoover : oleaut32: Handle OLEFontImpl_SetRatio case where cyLogical and cyHimetric are both 1.

Alexandre Julliard julliard at winehq.org
Tue Feb 4 13:55:06 CST 2014


Module: wine
Branch: master
Commit: ba2ce9db498a40806d7bca5631ec8c50dd3b8dee
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ba2ce9db498a40806d7bca5631ec8c50dd3b8dee

Author: Erich E. Hoover <erich.e.hoover at gmail.com>
Date:   Fri Jan 17 13:11:58 2014 -0700

oleaut32: Handle OLEFontImpl_SetRatio case where cyLogical and cyHimetric are both 1.

---

 dlls/oleaut32/olefont.c       |    5 +++++
 dlls/oleaut32/tests/olefont.c |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c
index ba873ec..3155fc3 100644
--- a/dlls/oleaut32/olefont.c
+++ b/dlls/oleaut32/olefont.c
@@ -1085,6 +1085,11 @@ static HRESULT WINAPI OLEFontImpl_SetRatio(
   if(cyLogical == 0 || cyHimetric == 0)
     return E_INVALIDARG;
 
+  /* cyLogical and cyHimetric both set to 1 is a special case that
+     does not change the scaling but also does not fail */
+  if(cyLogical == 1 && cyHimetric == 1)
+    return S_OK;
+
   this->cyLogical  = cyLogical;
   this->cyHimetric = cyHimetric;
   this->dirty = TRUE;
diff --git a/dlls/oleaut32/tests/olefont.c b/dlls/oleaut32/tests/olefont.c
index 1af1b6d..5249b54 100644
--- a/dlls/oleaut32/tests/olefont.c
+++ b/dlls/oleaut32/tests/olefont.c
@@ -151,6 +151,41 @@ static void test_ifont_sizes(void)
     test_ifont_size(180000, 0, 144, 2540, -36, "ratio2");  /* another ratio */
     test_ifont_size(180000, 0, 72,  1270, -36, "ratio3");  /* yet another ratio */
     test_ifont_size(186000, 0, 72,  2540, -19, "rounding+ratio"); /* test rounding with ratio */
+
+    /* test various combinations of logical == himetric */
+    test_ifont_size(180000, 0, 10, 10, -635, "identical ratio 1");
+    test_ifont_size(240000, 0, 10, 10, -848, "identical ratio 2");
+    test_ifont_size(300000, 0, 10, 10, -1058, "identical ratio 3");
+
+    /* test various combinations of logical and himetric both set to 1 */
+    test_ifont_size(180000, 0, 1, 1, -24, "1:1 ratio 1");
+    test_ifont_size(240000, 0, 1, 1, -32, "1:1 ratio 2");
+    test_ifont_size(300000, 0, 1, 1, -40, "1:1 ratio 3");
+
+    /* test various combinations of logical set to 1 */
+    test_ifont_size(180000, 0, 1, 0, -24, "1:0 ratio 1");
+    test_ifont_size(240000, 0, 1, 0, -32, "1:0 ratio 2");
+    test_ifont_size(300000, 0, 1, 0, -40, "1:0 ratio 3");
+
+    /* test various combinations of himetric set to 1 */
+    test_ifont_size(180000, 0, 0, 1, -24, "0:1 ratio 1");
+    test_ifont_size(240000, 0, 0, 1, -32, "0:1 ratio 2");
+    test_ifont_size(300000, 0, 0, 1, -40, "0:1 ratio 3");
+
+    /* test various combinations of 2:1 logical:himetric */
+    test_ifont_size(180000, 0, 2, 1, -1270, "2:1 ratio 1");
+    test_ifont_size(240000, 0, 2, 1, -1694, "2:1 ratio 2");
+    test_ifont_size(300000, 0, 2, 1, -2117, "2:1 ratio 3");
+
+    /* test various combinations of 1:2 logical:himetric */
+    test_ifont_size(180000, 0, 1, 2, -318, "1:2 ratio 1");
+    test_ifont_size(240000, 0, 1, 2, -424, "1:2 ratio 2");
+    test_ifont_size(300000, 0, 1, 2, -529, "1:2 ratio 3");
+
+    /* test various combinations of logical and himetric both set to 2 */
+    test_ifont_size(180000, 0, 2, 2, -635, "2:2 ratio 1");
+    test_ifont_size(240000, 0, 2, 2, -848, "2:2 ratio 2");
+    test_ifont_size(300000, 0, 2, 2, -1058, "2:2 ratio 3");
 }
 
 static void test_QueryInterface(void)




More information about the wine-cvs mailing list