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
3357fdd7
Commit
3357fdd7
authored
Jun 16, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 17, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Implement Expand for tomStory case.
parent
dedbd188
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
123 additions
and
5 deletions
+123
-5
richole.c
dlls/riched20/richole.c
+36
-5
richole.c
dlls/riched20/tests/richole.c
+87
-0
No files found.
dlls/riched20/richole.c
View file @
3357fdd7
...
...
@@ -909,6 +909,35 @@ static void textfont_cache_range_props(ITextFontImpl *font)
}
}
static
HRESULT
textrange_expand
(
ITextRange
*
range
,
LONG
unit
,
LONG
*
delta
)
{
LONG
expand_start
,
expand_end
;
switch
(
unit
)
{
case
tomStory
:
expand_start
=
0
;
ITextRange_GetStoryLength
(
range
,
&
expand_end
);
break
;
default:
FIXME
(
"unit %d is not supported
\n
"
,
unit
);
return
E_NOTIMPL
;
}
if
(
delta
)
{
LONG
start
,
end
;
ITextRange_GetStart
(
range
,
&
start
);
ITextRange_GetEnd
(
range
,
&
end
);
*
delta
=
expand_end
-
expand_start
-
(
end
-
start
);
}
ITextRange_SetStart
(
range
,
expand_start
);
ITextRange_SetEnd
(
range
,
expand_end
);
return
S_OK
;
}
static
HRESULT
WINAPI
IRichEditOleImpl_inner_fnQueryInterface
(
IUnknown
*
iface
,
REFIID
riid
,
LPVOID
*
ppvObj
)
{
IRichEditOleImpl
*
This
=
impl_from_IUnknown
(
iface
);
...
...
@@ -1970,12 +1999,12 @@ static HRESULT WINAPI ITextRange_fnExpand(ITextRange *me, LONG unit, LONG *delta
{
ITextRangeImpl
*
This
=
impl_from_ITextRange
(
me
);
FIXME
(
"(%p)->(%d %p): stub
\n
"
,
This
,
unit
,
delta
);
TRACE
(
"(%p)->(%d %p)
\n
"
,
This
,
unit
,
delta
);
if
(
!
This
->
child
.
reole
)
return
CO_E_RELEASED
;
return
E_NOTIMPL
;
return
textrange_expand
(
me
,
unit
,
delta
)
;
}
static
HRESULT
WINAPI
ITextRange_fnGetIndex
(
ITextRange
*
me
,
LONG
unit
,
LONG
*
index
)
...
...
@@ -4494,14 +4523,16 @@ static HRESULT WINAPI ITextSelection_fnCollapse(ITextSelection *me, LONG bStart)
return
hres
;
}
static
HRESULT
WINAPI
ITextSelection_fnExpand
(
ITextSelection
*
me
,
LONG
Unit
,
LONG
*
pD
elta
)
static
HRESULT
WINAPI
ITextSelection_fnExpand
(
ITextSelection
*
me
,
LONG
unit
,
LONG
*
d
elta
)
{
ITextSelectionImpl
*
This
=
impl_from_ITextSelection
(
me
);
TRACE
(
"(%p)->(%d %p)
\n
"
,
This
,
unit
,
delta
);
if
(
!
This
->
reOle
)
return
CO_E_RELEASED
;
FIXME
(
"not implemented
\n
"
);
return
E_NOTIMPL
;
return
textrange_expand
((
ITextRange
*
)
me
,
unit
,
delta
);
}
static
HRESULT
WINAPI
ITextSelection_fnGetIndex
(
ITextSelection
*
me
,
LONG
Unit
,
LONG
*
pIndex
)
...
...
dlls/riched20/tests/richole.c
View file @
3357fdd7
...
...
@@ -3251,6 +3251,92 @@ static void test_ITextSelection_GetDuplicate(void)
ITextRange_Release
(
range
);
}
static
void
test_Expand
(
void
)
{
static
const
char
test_text1
[]
=
"TestSomeText"
;
IRichEditOle
*
reole
=
NULL
;
ITextDocument
*
doc
=
NULL
;
ITextSelection
*
selection
;
ITextRange
*
range
;
LONG
value
;
HRESULT
hr
;
HWND
hwnd
;
create_interfaces
(
&
hwnd
,
&
reole
,
&
doc
,
&
selection
);
SendMessageA
(
hwnd
,
WM_SETTEXT
,
0
,
(
LPARAM
)
test_text1
);
SendMessageA
(
hwnd
,
EM_SETSEL
,
1
,
2
);
hr
=
ITextDocument_Range
(
doc
,
0
,
4
,
&
range
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ITextRange_Expand
(
range
,
tomStory
,
NULL
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ITextRange_GetStart
(
range
,
&
value
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
0
,
"got %d
\n
"
,
value
);
hr
=
ITextRange_GetEnd
(
range
,
&
value
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
13
,
"got %d
\n
"
,
value
);
hr
=
ITextSelection_Expand
(
selection
,
tomStory
,
NULL
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ITextSelection_GetStart
(
selection
,
&
value
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
0
,
"got %d
\n
"
,
value
);
hr
=
ITextSelection_GetEnd
(
selection
,
&
value
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
13
,
"got %d
\n
"
,
value
);
hr
=
ITextRange_SetStart
(
range
,
1
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ITextRange_SetEnd
(
range
,
2
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ITextSelection_SetStart
(
selection
,
1
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ITextSelection_SetEnd
(
selection
,
2
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
value
=
0
;
hr
=
ITextRange_Expand
(
range
,
tomStory
,
&
value
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
12
,
"got %d
\n
"
,
value
);
hr
=
ITextRange_GetStart
(
range
,
&
value
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
0
,
"got %d
\n
"
,
value
);
hr
=
ITextRange_GetEnd
(
range
,
&
value
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
13
,
"got %d
\n
"
,
value
);
value
=
0
;
hr
=
ITextSelection_Expand
(
selection
,
tomStory
,
&
value
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
12
,
"got %d
\n
"
,
value
);
hr
=
ITextSelection_GetStart
(
selection
,
&
value
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
0
,
"got %d
\n
"
,
value
);
hr
=
ITextSelection_GetEnd
(
selection
,
&
value
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
13
,
"got %d
\n
"
,
value
);
release_interfaces
(
&
hwnd
,
&
reole
,
&
doc
,
NULL
);
hr
=
ITextRange_Expand
(
range
,
tomStory
,
NULL
);
ok
(
hr
==
CO_E_RELEASED
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ITextRange_Expand
(
range
,
tomStory
,
&
value
);
ok
(
hr
==
CO_E_RELEASED
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ITextSelection_Expand
(
selection
,
tomStory
,
NULL
);
ok
(
hr
==
CO_E_RELEASED
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ITextSelection_Expand
(
selection
,
tomStory
,
&
value
);
ok
(
hr
==
CO_E_RELEASED
,
"got 0x%08x
\n
"
,
hr
);
ITextSelection_Release
(
selection
);
ITextRange_Release
(
range
);
}
START_TEST
(
richole
)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
...
...
@@ -3286,4 +3372,5 @@ START_TEST(richole)
test_InsertObject
();
test_GetStoryLength
();
test_ITextSelection_GetDuplicate
();
test_Expand
();
}
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