riched20/tests: Added tests for ITextFont getters on detached font.

This commit is contained in:
Nikolay Sivov 2015-05-21 12:13:42 +03:00 committed by Alexandre Julliard
parent 6fcb092f0f
commit fd806a65a5
2 changed files with 76 additions and 3 deletions

View File

@ -3163,9 +3163,11 @@ static HRESULT WINAPI ITextSelection_fnGetText(ITextSelection *me, BSTR *pbstr)
int nChars, endOfs; int nChars, endOfs;
BOOL bEOP; BOOL bEOP;
TRACE("(%p)->(%p)\n", This, pbstr);
if (!This->reOle) if (!This->reOle)
return CO_E_RELEASED; return CO_E_RELEASED;
TRACE("%p\n", pbstr);
if (!pbstr) if (!pbstr)
return E_INVALIDARG; return E_INVALIDARG;

View File

@ -520,7 +520,15 @@ static void test_ITextSelection_GetText(void)
ok(hres == S_OK, "ITextSelection_GetText\n"); ok(hres == S_OK, "ITextSelection_GetText\n");
ok(!bstr, "got wrong text: %s\n", wine_dbgstr_w(bstr)); ok(!bstr, "got wrong text: %s\n", wine_dbgstr_w(bstr));
release_interfaces(&w, &reOle, &txtDoc, &txtSel); release_interfaces(&w, &reOle, &txtDoc, NULL);
hres = ITextSelection_GetText(txtSel, &bstr);
ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
hres = ITextSelection_GetText(txtSel, NULL);
ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
ITextSelection_Release(txtSel);
} }
static void test_ITextDocument_Range(void) static void test_ITextDocument_Range(void)
@ -1432,6 +1440,8 @@ static void test_ITextFont(void)
ITextRange *range = NULL; ITextRange *range = NULL;
ITextFont *font; ITextFont *font;
CHARFORMAT2A cf; CHARFORMAT2A cf;
LONG value;
float size;
HRESULT hr; HRESULT hr;
HWND hwnd; HWND hwnd;
BOOL ret; BOOL ret;
@ -1494,9 +1504,70 @@ static void test_ITextFont(void)
ok(!lstrcmpW(str, arialW), "got %s\n", wine_dbgstr_w(str)); ok(!lstrcmpW(str, arialW), "got %s\n", wine_dbgstr_w(str));
SysFreeString(str); SysFreeString(str);
ITextFont_Release(font);
ITextRange_Release(range); ITextRange_Release(range);
release_interfaces(&hwnd, &reOle, &doc, NULL); release_interfaces(&hwnd, &reOle, &doc, NULL);
hr = ITextFont_GetBold(font, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = ITextFont_GetBold(font, &value);
ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
hr = ITextFont_GetForeColor(font, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = ITextFont_GetForeColor(font, &value);
ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
hr = ITextFont_GetItalic(font, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = ITextFont_GetItalic(font, &value);
ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
hr = ITextFont_GetLanguageID(font, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = ITextFont_GetLanguageID(font, &value);
ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
hr = ITextFont_GetName(font, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = ITextFont_GetName(font, &str);
ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
hr = ITextFont_GetSize(font, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = ITextFont_GetSize(font, &size);
ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
hr = ITextFont_GetStrikeThrough(font, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = ITextFont_GetStrikeThrough(font, &value);
ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
hr = ITextFont_GetSubscript(font, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = ITextFont_GetSubscript(font, &value);
ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
hr = ITextFont_GetSuperscript(font, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = ITextFont_GetSuperscript(font, &value);
ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
hr = ITextFont_GetUnderline(font, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = ITextFont_GetUnderline(font, &value);
ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
ITextFont_Release(font);
} }
START_TEST(richole) START_TEST(richole)