2012-07-31 06:18:02 +02:00
|
|
|
/*
|
|
|
|
* Font related tests
|
|
|
|
*
|
|
|
|
* Copyright 2012 Nikolay Sivov for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "windows.h"
|
|
|
|
|
|
|
|
#include "initguid.h"
|
|
|
|
#include "dwrite.h"
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
|
|
|
#define EXPECT_HR(hr,hr_exp) \
|
|
|
|
ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp)
|
|
|
|
|
|
|
|
IDWriteFactory *factory;
|
|
|
|
|
|
|
|
static void test_CreateFontFromLOGFONT(void)
|
|
|
|
{
|
|
|
|
static const WCHAR arialW[] = {'A','r','i','a','l',0};
|
|
|
|
IDWriteGdiInterop *interop;
|
|
|
|
DWRITE_FONT_WEIGHT weight;
|
|
|
|
DWRITE_FONT_STYLE style;
|
|
|
|
IDWriteFont *font;
|
|
|
|
LOGFONTW logfont;
|
|
|
|
HRESULT hr;
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
hr = IDWriteFactory_GetGdiInterop(factory, &interop);
|
|
|
|
EXPECT_HR(hr, S_OK);
|
|
|
|
|
|
|
|
if (0)
|
|
|
|
/* null out parameter crashes this call */
|
|
|
|
hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, NULL, NULL);
|
|
|
|
|
|
|
|
hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, NULL, &font);
|
|
|
|
EXPECT_HR(hr, E_INVALIDARG);
|
|
|
|
|
|
|
|
memset(&logfont, 0, sizeof(logfont));
|
|
|
|
logfont.lfHeight = 12;
|
|
|
|
logfont.lfWidth = 12;
|
|
|
|
logfont.lfWeight = FW_NORMAL;
|
|
|
|
logfont.lfItalic = 1;
|
|
|
|
lstrcpyW(logfont.lfFaceName, arialW);
|
|
|
|
|
|
|
|
hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, &logfont, &font);
|
|
|
|
EXPECT_HR(hr, S_OK);
|
|
|
|
|
|
|
|
/* now check properties */
|
|
|
|
weight = IDWriteFont_GetWeight(font);
|
|
|
|
ok(weight == DWRITE_FONT_WEIGHT_NORMAL, "got %d\n", weight);
|
|
|
|
|
|
|
|
style = IDWriteFont_GetStyle(font);
|
2012-08-13 05:44:19 +02:00
|
|
|
todo_wine
|
2012-07-31 06:18:02 +02:00
|
|
|
ok(style == DWRITE_FONT_STYLE_ITALIC, "got %d\n", style);
|
|
|
|
|
|
|
|
ret = IDWriteFont_IsSymbolFont(font);
|
|
|
|
ok(!ret, "got %d\n", ret);
|
|
|
|
|
|
|
|
IDWriteFont_Release(font);
|
|
|
|
|
|
|
|
IDWriteGdiInterop_Release(interop);
|
|
|
|
}
|
|
|
|
|
|
|
|
START_TEST(font)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = DWriteCreateFactory(DWRITE_FACTORY_TYPE_ISOLATED, &IID_IDWriteFactory, (IUnknown**)&factory);
|
|
|
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
|
|
|
if (hr != S_OK)
|
|
|
|
{
|
|
|
|
win_skip("failed to create factory\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
test_CreateFontFromLOGFONT();
|
|
|
|
|
|
|
|
IDWriteFactory_Release(factory);
|
|
|
|
}
|