Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1c23bf04
Commit
1c23bf04
authored
Jul 30, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 30, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Added some layout tests, simplify debug output for text ranges.
parent
01b2b307
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
120 additions
and
18 deletions
+120
-18
analyzer.c
dlls/dwrite/analyzer.c
+0
-2
dwrite_private.h
dlls/dwrite/dwrite_private.h
+6
-0
font.c
dlls/dwrite/font.c
+0
-2
layout.c
dlls/dwrite/layout.c
+12
-14
layout.c
dlls/dwrite/tests/layout.c
+102
-0
No files found.
dlls/dwrite/analyzer.c
View file @
1c23bf04
...
...
@@ -23,8 +23,6 @@
#include "dwrite.h"
#include "dwrite_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
dwrite
);
enum
scriptcode
{
...
...
dlls/dwrite/dwrite_private.h
View file @
1c23bf04
...
...
@@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "wine/debug.h"
#include "wine/unicode.h"
static
inline
void
*
heap_alloc
(
size_t
len
)
...
...
@@ -71,6 +72,11 @@ static inline LPWSTR heap_strdupnW(const WCHAR *str, UINT32 len)
return
ret
;
}
static
inline
const
char
*
debugstr_range
(
const
DWRITE_TEXT_RANGE
*
range
)
{
return
wine_dbg_sprintf
(
"%u:%u"
,
range
->
startPosition
,
range
->
length
);
}
extern
HRESULT
create_font_from_logfont
(
const
LOGFONTW
*
,
IDWriteFont
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
convert_fontface_to_logfont
(
IDWriteFontFace
*
,
LOGFONTW
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_textformat
(
const
WCHAR
*
,
IDWriteFontCollection
*
,
DWRITE_FONT_WEIGHT
,
DWRITE_FONT_STYLE
,
DWRITE_FONT_STRETCH
,
...
...
dlls/dwrite/font.c
View file @
1c23bf04
...
...
@@ -23,8 +23,6 @@
#include "dwrite.h"
#include "dwrite_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
dwrite
);
/* PANOSE is 10 bytes in size, need to pack the structure properly */
...
...
dlls/dwrite/layout.c
View file @
1c23bf04
...
...
@@ -28,8 +28,6 @@
#include "dwrite.h"
#include "dwrite_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
dwrite
);
struct
dwrite_textformat_data
{
...
...
@@ -354,84 +352,84 @@ static HRESULT WINAPI dwritetextlayout_SetMaxHeight(IDWriteTextLayout *iface, FL
static
HRESULT
WINAPI
dwritetextlayout_SetFontCollection
(
IDWriteTextLayout
*
iface
,
IDWriteFontCollection
*
collection
,
DWRITE_TEXT_RANGE
range
)
{
struct
dwrite_textlayout
*
This
=
impl_from_IDWriteTextLayout
(
iface
);
FIXME
(
"(%p)->(%p %
u:%u): stub
\n
"
,
This
,
collection
,
range
.
startPosition
,
range
.
length
);
FIXME
(
"(%p)->(%p %
s): stub
\n
"
,
This
,
collection
,
debugstr_range
(
&
range
)
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
dwritetextlayout_SetFontFamilyName
(
IDWriteTextLayout
*
iface
,
WCHAR
const
*
name
,
DWRITE_TEXT_RANGE
range
)
{
struct
dwrite_textlayout
*
This
=
impl_from_IDWriteTextLayout
(
iface
);
FIXME
(
"(%p)->(%s %
u:%u): stub
\n
"
,
This
,
debugstr_w
(
name
),
range
.
startPosition
,
range
.
length
);
FIXME
(
"(%p)->(%s %
s): stub
\n
"
,
This
,
debugstr_w
(
name
),
debugstr_range
(
&
range
)
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
dwritetextlayout_SetFontWeight
(
IDWriteTextLayout
*
iface
,
DWRITE_FONT_WEIGHT
weight
,
DWRITE_TEXT_RANGE
range
)
{
struct
dwrite_textlayout
*
This
=
impl_from_IDWriteTextLayout
(
iface
);
FIXME
(
"(%p)->(%d %
u:%u): stub
\n
"
,
This
,
weight
,
range
.
startPosition
,
range
.
length
);
FIXME
(
"(%p)->(%d %
s): stub
\n
"
,
This
,
weight
,
debugstr_range
(
&
range
)
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
dwritetextlayout_SetFontStyle
(
IDWriteTextLayout
*
iface
,
DWRITE_FONT_STYLE
style
,
DWRITE_TEXT_RANGE
range
)
{
struct
dwrite_textlayout
*
This
=
impl_from_IDWriteTextLayout
(
iface
);
FIXME
(
"(%p)->(%d %
u:%u): stub
\n
"
,
This
,
style
,
range
.
startPosition
,
range
.
length
);
FIXME
(
"(%p)->(%d %
s): stub
\n
"
,
This
,
style
,
debugstr_range
(
&
range
)
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
dwritetextlayout_SetFontStretch
(
IDWriteTextLayout
*
iface
,
DWRITE_FONT_STRETCH
stretch
,
DWRITE_TEXT_RANGE
range
)
{
struct
dwrite_textlayout
*
This
=
impl_from_IDWriteTextLayout
(
iface
);
FIXME
(
"(%p)->(%d %
u:%u): stub
\n
"
,
This
,
stretch
,
range
.
startPosition
,
range
.
length
);
FIXME
(
"(%p)->(%d %
s): stub
\n
"
,
This
,
stretch
,
debugstr_range
(
&
range
)
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
dwritetextlayout_SetFontSize
(
IDWriteTextLayout
*
iface
,
FLOAT
size
,
DWRITE_TEXT_RANGE
range
)
{
struct
dwrite_textlayout
*
This
=
impl_from_IDWriteTextLayout
(
iface
);
FIXME
(
"(%p)->(%f %
u:%u): stub
\n
"
,
This
,
size
,
range
.
startPosition
,
range
.
length
);
FIXME
(
"(%p)->(%f %
s): stub
\n
"
,
This
,
size
,
debugstr_range
(
&
range
)
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
dwritetextlayout_SetUnderline
(
IDWriteTextLayout
*
iface
,
BOOL
underline
,
DWRITE_TEXT_RANGE
range
)
{
struct
dwrite_textlayout
*
This
=
impl_from_IDWriteTextLayout
(
iface
);
FIXME
(
"(%p)->(%d %
u:%u): stub
\n
"
,
This
,
underline
,
range
.
startPosition
,
range
.
length
);
FIXME
(
"(%p)->(%d %
s): stub
\n
"
,
This
,
underline
,
debugstr_range
(
&
range
)
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
dwritetextlayout_SetStrikethrough
(
IDWriteTextLayout
*
iface
,
BOOL
strikethrough
,
DWRITE_TEXT_RANGE
range
)
{
struct
dwrite_textlayout
*
This
=
impl_from_IDWriteTextLayout
(
iface
);
FIXME
(
"(%p)->(%d %
u:%u): stub
\n
"
,
This
,
strikethrough
,
range
.
startPosition
,
range
.
length
);
FIXME
(
"(%p)->(%d %
s): stub
\n
"
,
This
,
strikethrough
,
debugstr_range
(
&
range
)
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
dwritetextlayout_SetDrawingEffect
(
IDWriteTextLayout
*
iface
,
IUnknown
*
effect
,
DWRITE_TEXT_RANGE
range
)
{
struct
dwrite_textlayout
*
This
=
impl_from_IDWriteTextLayout
(
iface
);
FIXME
(
"(%p)->(%p %
u:%u): stub
\n
"
,
This
,
effect
,
range
.
startPosition
,
range
.
length
);
FIXME
(
"(%p)->(%p %
s): stub
\n
"
,
This
,
effect
,
debugstr_range
(
&
range
)
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
dwritetextlayout_SetInlineObject
(
IDWriteTextLayout
*
iface
,
IDWriteInlineObject
*
object
,
DWRITE_TEXT_RANGE
range
)
{
struct
dwrite_textlayout
*
This
=
impl_from_IDWriteTextLayout
(
iface
);
FIXME
(
"(%p)->(%p %
u:%u): stub
\n
"
,
This
,
object
,
range
.
startPosition
,
range
.
length
);
FIXME
(
"(%p)->(%p %
s): stub
\n
"
,
This
,
object
,
debugstr_range
(
&
range
)
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
dwritetextlayout_SetTypography
(
IDWriteTextLayout
*
iface
,
IDWriteTypography
*
typography
,
DWRITE_TEXT_RANGE
range
)
{
struct
dwrite_textlayout
*
This
=
impl_from_IDWriteTextLayout
(
iface
);
FIXME
(
"(%p)->(%p %
u:%u): stub
\n
"
,
This
,
typography
,
range
.
startPosition
,
range
.
length
);
FIXME
(
"(%p)->(%p %
s): stub
\n
"
,
This
,
typography
,
debugstr_range
(
&
range
)
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
dwritetextlayout_SetLocaleName
(
IDWriteTextLayout
*
iface
,
WCHAR
const
*
locale
,
DWRITE_TEXT_RANGE
range
)
{
struct
dwrite_textlayout
*
This
=
impl_from_IDWriteTextLayout
(
iface
);
FIXME
(
"(%p)->(%s %
u:%u): stub
\n
"
,
This
,
debugstr_w
(
locale
),
range
.
startPosition
,
range
.
length
);
FIXME
(
"(%p)->(%s %
s): stub
\n
"
,
This
,
debugstr_w
(
locale
),
debugstr_range
(
&
range
)
);
return
E_NOTIMPL
;
}
...
...
dlls/dwrite/tests/layout.c
View file @
1c23bf04
...
...
@@ -262,6 +262,106 @@ if (0) /* crashes on native */
IDWriteTextFormat_Release
(
format
);
}
static
void
test_fontweight
(
void
)
{
static
const
WCHAR
strW
[]
=
{
's'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
static
const
WCHAR
ruW
[]
=
{
'r'
,
'u'
,
0
};
IDWriteTextFormat
*
format
,
*
fmt2
;
IDWriteTextLayout
*
layout
;
DWRITE_FONT_WEIGHT
weight
;
DWRITE_TEXT_RANGE
range
;
HRESULT
hr
;
hr
=
IDWriteFactory_CreateTextFormat
(
factory
,
tahomaW
,
NULL
,
DWRITE_FONT_WEIGHT_BOLD
,
DWRITE_FONT_STYLE_NORMAL
,
DWRITE_FONT_STRETCH_NORMAL
,
10
.
0
,
ruW
,
&
format
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFactory_CreateGdiCompatibleTextLayout
(
factory
,
strW
,
0
,
format
,
100
.
0
,
100
.
0
,
1
.
0
,
NULL
,
FALSE
,
&
layout
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextLayout_QueryInterface
(
layout
,
&
IID_IDWriteTextFormat
,
(
void
**
)
&
fmt2
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
weight
=
IDWriteTextFormat_GetFontWeight
(
fmt2
);
todo_wine
ok
(
weight
==
DWRITE_FONT_WEIGHT_BOLD
,
"got %u
\n
"
,
weight
);
range
.
startPosition
=
0
;
range
.
length
=
6
;
hr
=
IDWriteTextLayout_SetFontWeight
(
layout
,
DWRITE_FONT_WEIGHT_NORMAL
,
range
);
todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
/* IDWriteTextFormat methods output doesn't reflect layout changes */
weight
=
IDWriteTextFormat_GetFontWeight
(
fmt2
);
todo_wine
ok
(
weight
==
DWRITE_FONT_WEIGHT_BOLD
,
"got %u
\n
"
,
weight
);
range
.
length
=
0
;
weight
=
DWRITE_FONT_WEIGHT_BOLD
;
hr
=
layout
->
lpVtbl
->
IDWriteTextLayout_GetFontWeight
(
layout
,
0
,
&
weight
,
&
range
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
weight
==
DWRITE_FONT_WEIGHT_NORMAL
,
"got %d
\n
"
,
weight
);
ok
(
range
.
length
==
6
,
"got %d
\n
"
,
range
.
length
);
}
IDWriteTextLayout_Release
(
layout
);
IDWriteTextFormat_Release
(
fmt2
);
IDWriteTextFormat_Release
(
format
);
}
static
void
test_SetInlineObject
(
void
)
{
static
const
WCHAR
strW
[]
=
{
's'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
static
const
WCHAR
ruW
[]
=
{
'r'
,
'u'
,
0
};
IDWriteInlineObject
*
inlineobj
,
*
inlineobj2
;
IDWriteTextFormat
*
format
;
IDWriteTextLayout
*
layout
;
DWRITE_TEXT_RANGE
range
;
HRESULT
hr
;
hr
=
IDWriteFactory_CreateTextFormat
(
factory
,
tahomaW
,
NULL
,
DWRITE_FONT_WEIGHT_BOLD
,
DWRITE_FONT_STYLE_NORMAL
,
DWRITE_FONT_STRETCH_NORMAL
,
10
.
0
,
ruW
,
&
format
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFactory_CreateGdiCompatibleTextLayout
(
factory
,
strW
,
0
,
format
,
100
.
0
,
100
.
0
,
1
.
0
,
NULL
,
FALSE
,
&
layout
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFactory_CreateEllipsisTrimmingSign
(
factory
,
format
,
&
inlineobj
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFactory_CreateEllipsisTrimmingSign
(
factory
,
format
,
&
inlineobj2
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
range
.
startPosition
=
0
;
range
.
length
=
2
;
hr
=
IDWriteTextLayout_SetInlineObject
(
layout
,
inlineobj
,
range
);
todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
range
.
startPosition
=
1
;
range
.
length
=
1
;
hr
=
IDWriteTextLayout_SetInlineObject
(
layout
,
inlineobj2
,
range
);
todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
range
.
startPosition
=
1
;
range
.
length
=
1
;
hr
=
IDWriteTextLayout_SetInlineObject
(
layout
,
inlineobj
,
range
);
todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
range
.
startPosition
=
1
;
range
.
length
=
2
;
hr
=
IDWriteTextLayout_SetInlineObject
(
layout
,
inlineobj
,
range
);
todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
IDWriteTextLayout_Release
(
layout
);
IDWriteTextFormat_Release
(
format
);
}
START_TEST
(
layout
)
{
HRESULT
hr
;
...
...
@@ -279,6 +379,8 @@ START_TEST(layout)
test_CreateTextFormat
();
test_GetLocaleName
();
test_CreateEllipsisTrimmingSign
();
test_fontweight
();
test_SetInlineObject
();
IDWriteFactory_Release
(
factory
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment