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

This commit is contained in:
Erich E. Hoover 2014-01-17 13:11:58 -07:00 committed by Alexandre Julliard
parent 1ffeb42284
commit ba2ce9db49
2 changed files with 40 additions and 0 deletions

View File

@ -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;

View File

@ -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)