From b4959154caa0908b30673841d7b4f48f66f44080 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 28 May 2015 00:11:49 +0300 Subject: [PATCH] riched20: Switch font unit is not allowed. --- dlls/riched20/richole.c | 6 ++++++ dlls/riched20/tests/richole.c | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c index 008c1241b0e..5b0c7fc6898 100644 --- a/dlls/riched20/richole.c +++ b/dlls/riched20/richole.c @@ -2445,6 +2445,9 @@ static HRESULT WINAPI TextFont_Reset(ITextFont *iface, LONG value) This->set_cache_enabled = FALSE; textfont_apply_range_props(This); break; + case tomUsePoints: + case tomUseTwips: + return E_INVALIDARG; default: FIXME("reset mode %d not supported\n", value); } @@ -2467,6 +2470,9 @@ static HRESULT WINAPI TextFont_Reset(ITextFont *iface, LONG value) case tomTrackParms: case tomCacheParms: return S_OK; + case tomUsePoints: + case tomUseTwips: + return E_INVALIDARG; } } diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c index 327b3acf7f1..f2ad6e2b2c0 100644 --- a/dlls/riched20/tests/richole.c +++ b/dlls/riched20/tests/richole.c @@ -2141,6 +2141,12 @@ static void test_ITextFont(void) hr = ITextRange_GetFont(range, &font); ok(hr == S_OK, "got 0x%08x\n", hr); + hr = ITextFont_Reset(font, tomUseTwips); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = ITextFont_Reset(font, tomUsePoints); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + hr = ITextFont_GetName(font, NULL); ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); @@ -2176,6 +2182,23 @@ static void test_ITextFont(void) ok(position == twips_to_points(cf.yOffset), "got yOffset %d, position %.2f\n", cf.yOffset, position); ok(kerning == twips_to_points(cf.wKerning), "got wKerning %d, kerning %.2f\n", cf.wKerning, kerning); + hr = ITextFont_Reset(font, tomUseTwips); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = ITextFont_Reset(font, tomUsePoints); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = ITextFont_GetDuplicate(font, &font2); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = ITextFont_Reset(font2, tomUseTwips); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = ITextFont_Reset(font2, tomUsePoints); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + ITextFont_Release(font2); + /* default font name */ str = NULL; hr = ITextFont_GetName(font, &str);