Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
e6e16eb6
Commit
e6e16eb6
authored
May 21, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 21, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Implement GetName() for ITextFont.
parent
0877e4cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
127 additions
and
7 deletions
+127
-7
richole.c
dlls/riched20/richole.c
+38
-3
richole.c
dlls/riched20/tests/richole.c
+89
-4
No files found.
dlls/riched20/richole.c
View file @
e6e16eb6
...
...
@@ -213,7 +213,8 @@ static const DWORD textfont_prop_masks[] = {
typedef
union
{
FLOAT
f
;
LONG
l
;
LONG
l
;
BSTR
str
;
}
textfont_prop_val
;
static
inline
BOOL
is_equal_textfont_prop_value
(
enum
textfont_prop_id
propid
,
textfont_prop_val
*
left
,
...
...
@@ -230,6 +231,8 @@ static inline BOOL is_equal_textfont_prop_value(enum textfont_prop_id propid, te
case
FONT_SUPERSCRIPT
:
case
FONT_UNDERLINE
:
return
left
->
l
==
right
->
l
;
case
FONT_NAME
:
return
!
strcmpW
(
left
->
str
,
right
->
str
);
case
FONT_SIZE
:
return
left
->
f
==
right
->
f
;
default:
...
...
@@ -252,6 +255,9 @@ static inline void init_textfont_prop_value(enum textfont_prop_id propid, textfo
case
FONT_UNDERLINE
:
v
->
l
=
tomUndefined
;
return
;
case
FONT_NAME
:
v
->
str
=
NULL
;
return
;
case
FONT_SIZE
:
v
->
f
=
tomUndefined
;
return
;
...
...
@@ -291,6 +297,12 @@ static HRESULT get_textfont_prop_for_pos(const IRichEditOleImpl *reole, int pos,
case
FONT_LANGID
:
value
->
l
=
fmt
.
lcid
;
break
;
case
FONT_NAME
:
/* this case is used exclusively by GetName() */
value
->
str
=
SysAllocString
(
fmt
.
szFaceName
);
if
(
!
value
->
str
)
return
E_OUTOFMEMORY
;
break
;
case
FONT_SIZE
:
value
->
f
=
fmt
.
yHeight
;
break
;
...
...
@@ -1991,8 +2003,31 @@ static HRESULT WINAPI TextFont_SetLanguageID(ITextFont *iface, LONG value)
static
HRESULT
WINAPI
TextFont_GetName
(
ITextFont
*
iface
,
BSTR
*
value
)
{
ITextFontImpl
*
This
=
impl_from_ITextFont
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
value
);
return
E_NOTIMPL
;
const
IRichEditOleImpl
*
reole
;
textfont_prop_val
v
;
LONG
start
;
HRESULT
hr
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
value
);
if
(
!
value
)
return
E_INVALIDARG
;
*
value
=
NULL
;
ITextRange_QueryInterface
(
This
->
range
,
&
IID_Igetrichole
,
(
void
**
)
&
reole
);
if
(
!
reole
)
return
CO_E_RELEASED
;
init_textfont_prop_value
(
FONT_NAME
,
&
v
);
ITextRange_GetStart
(
This
->
range
,
&
start
);
hr
=
get_textfont_prop_for_pos
(
reole
,
start
,
FONT_NAME
,
&
v
);
if
(
FAILED
(
hr
))
return
hr
;
*
value
=
v
.
str
;
return
S_OK
;
}
static
HRESULT
WINAPI
TextFont_SetName
(
ITextFont
*
iface
,
BSTR
value
)
...
...
dlls/riched20/tests/richole.c
View file @
e6e16eb6
...
...
@@ -130,14 +130,12 @@ static void test_Interfaces(void)
res
=
SendMessageA
(
w
,
EM_GETOLEINTERFACE
,
0
,
(
LPARAM
)
&
reOle
);
ok
(
res
,
"SendMessage
\n
"
);
ok
(
reOle
!=
NULL
,
"EM_GETOLEINTERFACE
\n
"
);
refcount
=
get_refcount
((
IUnknown
*
)
reOle
);
ok
(
refcount
==
2
,
"got wrong ref count: %d
\n
"
,
refcount
);
EXPECT_REF
(
reOle
,
2
);
res
=
SendMessageA
(
w
,
EM_GETOLEINTERFACE
,
0
,
(
LPARAM
)
&
reOle1
);
ok
(
res
==
1
,
"SendMessage
\n
"
);
ok
(
reOle1
==
reOle
,
"Should not return a new IRichEditOle interface
\n
"
);
refcount
=
get_refcount
((
IUnknown
*
)
reOle
);
ok
(
refcount
==
3
,
"got wrong ref count: %d
\n
"
,
refcount
);
EXPECT_REF
(
reOle
,
3
);
hres
=
IRichEditOle_QueryInterface
(
reOle
,
&
IID_ITextDocument
,
(
void
**
)
&
txtDoc
);
...
...
@@ -147,12 +145,21 @@ static void test_Interfaces(void)
hres
=
ITextDocument_GetSelection
(
txtDoc
,
NULL
);
ok
(
hres
==
E_INVALIDARG
,
"ITextDocument_GetSelection: 0x%x
\n
"
,
hres
);
EXPECT_REF
(
txtDoc
,
4
);
hres
=
ITextDocument_GetSelection
(
txtDoc
,
&
txtSel
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
EXPECT_REF
(
txtDoc
,
4
);
EXPECT_REF
(
txtSel
,
2
);
hres
=
ITextDocument_GetSelection
(
txtDoc
,
&
txtSel2
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
ok
(
txtSel2
==
txtSel
,
"got %p, %p
\n
"
,
txtSel
,
txtSel2
);
EXPECT_REF
(
txtDoc
,
4
);
EXPECT_REF
(
txtSel
,
3
);
ITextSelection_Release
(
txtSel2
);
punk
=
NULL
;
...
...
@@ -1415,6 +1422,83 @@ todo_wine {
release_interfaces
(
&
hwnd
,
&
reOle
,
&
doc
,
NULL
);
}
static
void
test_ITextFont
(
void
)
{
static
const
WCHAR
sysW
[]
=
{
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
0
};
static
const
WCHAR
arialW
[]
=
{
'A'
,
'r'
,
'i'
,
'a'
,
'l'
,
0
};
static
const
CHAR
test_text1
[]
=
"TestSomeText"
;
IRichEditOle
*
reOle
=
NULL
;
ITextDocument
*
doc
=
NULL
;
ITextRange
*
range
=
NULL
;
ITextFont
*
font
;
CHARFORMAT2A
cf
;
HRESULT
hr
;
HWND
hwnd
;
BOOL
ret
;
BSTR
str
;
create_interfaces
(
&
hwnd
,
&
reOle
,
&
doc
,
NULL
);
SendMessageA
(
hwnd
,
WM_SETTEXT
,
0
,
(
LPARAM
)
test_text1
);
hr
=
ITextDocument_Range
(
doc
,
0
,
10
,
&
range
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ITextRange_GetFont
(
range
,
&
font
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ITextFont_GetName
(
font
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
/* default font name */
str
=
NULL
;
hr
=
ITextFont_GetName
(
font
,
&
str
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
sysW
),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
/* change font name for an inner subrange */
memset
(
&
cf
,
0
,
sizeof
(
cf
));
cf
.
cbSize
=
sizeof
(
cf
);
cf
.
dwMask
=
CFM_FACE
;
strcpy
(
cf
.
szFaceName
,
"Arial"
);
SendMessageA
(
hwnd
,
EM_SETSEL
,
3
,
4
);
ret
=
SendMessageA
(
hwnd
,
EM_SETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
cf
);
ok
(
ret
,
"got %d
\n
"
,
ret
);
/* still original name */
str
=
NULL
;
hr
=
ITextFont_GetName
(
font
,
&
str
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
sysW
),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
SendMessageA
(
hwnd
,
EM_SETSEL
,
1
,
2
);
ret
=
SendMessageA
(
hwnd
,
EM_SETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
cf
);
ok
(
ret
,
"got %d
\n
"
,
ret
);
str
=
NULL
;
hr
=
ITextFont_GetName
(
font
,
&
str
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
sysW
),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
/* name is returned for first position within a range */
SendMessageA
(
hwnd
,
EM_SETSEL
,
0
,
1
);
ret
=
SendMessageA
(
hwnd
,
EM_SETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
cf
);
ok
(
ret
,
"got %d
\n
"
,
ret
);
str
=
NULL
;
hr
=
ITextFont_GetName
(
font
,
&
str
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
arialW
),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
ITextFont_Release
(
font
);
ITextRange_Release
(
range
);
release_interfaces
(
&
hwnd
,
&
reOle
,
&
doc
,
NULL
);
}
START_TEST
(
richole
)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
...
...
@@ -1439,4 +1523,5 @@ START_TEST(richole)
test_GetFont
();
test_GetPara
();
test_dispatch
();
test_ITextFont
();
}
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