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
cebee9bd
Commit
cebee9bd
authored
May 27, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 28, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Implement InRange().
parent
c1ce95dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
156 additions
and
6 deletions
+156
-6
richole.c
dlls/riched20/richole.c
+45
-6
richole.c
dlls/riched20/tests/richole.c
+111
-0
No files found.
dlls/riched20/richole.c
View file @
cebee9bd
...
...
@@ -1748,14 +1748,36 @@ static HRESULT WINAPI ITextRange_fnSetRange(ITextRange *me, LONG cpActive, LONG
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
ITextRange_fnInRange
(
ITextRange
*
me
,
ITextRange
*
pRange
,
LONG
*
pb
)
static
HRESULT
textrange_inrange
(
LONG
start
,
LONG
end
,
ITextRange
*
range
,
LONG
*
ret
)
{
LONG
from
,
to
,
v
;
if
(
!
ret
)
ret
=
&
v
;
ITextRange_GetStart
(
range
,
&
from
);
ITextRange_GetEnd
(
range
,
&
to
);
*
ret
=
(
start
>=
from
&&
end
<=
to
)
?
tomTrue
:
tomFalse
;
return
*
ret
==
tomTrue
?
S_OK
:
S_FALSE
;
}
static
HRESULT
WINAPI
ITextRange_fnInRange
(
ITextRange
*
me
,
ITextRange
*
range
,
LONG
*
ret
)
{
ITextRangeImpl
*
This
=
impl_from_ITextRange
(
me
);
TRACE
(
"(%p)->(%p %p)
\n
"
,
This
,
range
,
ret
);
if
(
ret
)
*
ret
=
tomFalse
;
if
(
!
This
->
reOle
)
return
CO_E_RELEASED
;
FIXME
(
"not implemented %p
\n
"
,
This
);
return
E_NOTIMPL
;
if
(
!
range
)
return
S_FALSE
;
return
textrange_inrange
(
This
->
start
,
This
->
end
,
range
,
ret
);
}
static
HRESULT
WINAPI
ITextRange_fnInStory
(
ITextRange
*
me
,
ITextRange
*
pRange
,
LONG
*
pb
)
...
...
@@ -4129,14 +4151,31 @@ static HRESULT WINAPI ITextSelection_fnSetRange(ITextSelection *me, LONG cpActiv
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
ITextSelection_fnInRange
(
ITextSelection
*
me
,
ITextRange
*
pRange
,
LONG
*
pb
)
static
HRESULT
WINAPI
ITextSelection_fnInRange
(
ITextSelection
*
me
,
ITextRange
*
range
,
LONG
*
ret
)
{
ITextSelectionImpl
*
This
=
impl_from_ITextSelection
(
me
);
ITextSelection
*
selection
=
NULL
;
LONG
start
,
end
;
TRACE
(
"(%p)->(%p %p)
\n
"
,
This
,
range
,
ret
);
if
(
ret
)
*
ret
=
tomFalse
;
if
(
!
This
->
reOle
)
return
CO_E_RELEASED
;
FIXME
(
"not implemented
\n
"
);
return
E_NOTIMPL
;
if
(
!
range
)
return
S_FALSE
;
ITextRange_QueryInterface
(
range
,
&
IID_ITextSelection
,
(
void
**
)
&
selection
);
if
(
!
selection
)
return
S_FALSE
;
ITextSelection_Release
(
selection
);
ITextSelection_GetStart
(
me
,
&
start
);
ITextSelection_GetEnd
(
me
,
&
end
);
return
textrange_inrange
(
start
,
end
,
range
,
ret
);
}
static
HRESULT
WINAPI
ITextSelection_fnInStory
(
ITextSelection
*
me
,
ITextRange
*
pRange
,
LONG
*
pb
)
...
...
dlls/riched20/tests/richole.c
View file @
cebee9bd
...
...
@@ -2521,6 +2521,116 @@ static void test_SetText(void)
ITextRange_Release
(
range
);
}
static
void
test_InRange
(
void
)
{
static
const
CHAR
test_text1
[]
=
"TestSomeText"
;
ITextRange
*
range
,
*
range2
,
*
range3
;
IRichEditOle
*
reOle
=
NULL
;
ITextDocument
*
doc
=
NULL
;
ITextSelection
*
selection
;
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
=
ITextDocument_Range
(
doc
,
0
,
4
,
&
range2
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
/* matches selection */
hr
=
ITextDocument_Range
(
doc
,
1
,
2
,
&
range3
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ITextRange_InRange
(
range
,
NULL
,
NULL
);
ok
(
hr
==
S_FALSE
,
"got 0x%08x
\n
"
,
hr
);
value
=
tomTrue
;
hr
=
ITextRange_InRange
(
range
,
NULL
,
&
value
);
ok
(
hr
==
S_FALSE
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
tomFalse
,
"got %d
\n
"
,
value
);
hr
=
ITextRange_InRange
(
range
,
range2
,
NULL
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
value
=
tomFalse
;
hr
=
ITextRange_InRange
(
range
,
range2
,
&
value
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
tomTrue
,
"got %d
\n
"
,
value
);
/* selection */
hr
=
ITextSelection_InRange
(
selection
,
NULL
,
NULL
);
ok
(
hr
==
S_FALSE
,
"got 0x%08x
\n
"
,
hr
);
value
=
tomTrue
;
hr
=
ITextSelection_InRange
(
selection
,
NULL
,
&
value
);
ok
(
hr
==
S_FALSE
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
tomFalse
,
"got %d
\n
"
,
value
);
hr
=
ITextSelection_InRange
(
selection
,
range2
,
NULL
);
ok
(
hr
==
S_FALSE
,
"got 0x%08x
\n
"
,
hr
);
value
=
tomTrue
;
hr
=
ITextSelection_InRange
(
selection
,
range2
,
&
value
);
ok
(
hr
==
S_FALSE
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
tomFalse
,
"got %d
\n
"
,
value
);
value
=
tomTrue
;
hr
=
ITextSelection_InRange
(
selection
,
range3
,
&
value
);
ok
(
hr
==
S_FALSE
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
tomFalse
,
"got %d
\n
"
,
value
);
/* seems to work on ITextSelection ranges only */
value
=
tomFalse
;
hr
=
ITextSelection_InRange
(
selection
,
(
ITextRange
*
)
selection
,
&
value
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
tomTrue
,
"got %d
\n
"
,
value
);
release_interfaces
(
&
hwnd
,
&
reOle
,
&
doc
,
NULL
);
hr
=
ITextRange_InRange
(
range
,
NULL
,
NULL
);
ok
(
hr
==
CO_E_RELEASED
,
"got 0x%08x
\n
"
,
hr
);
value
=
tomTrue
;
hr
=
ITextRange_InRange
(
range
,
NULL
,
&
value
);
ok
(
hr
==
CO_E_RELEASED
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
tomFalse
,
"got %d
\n
"
,
value
);
hr
=
ITextRange_InRange
(
range
,
range2
,
NULL
);
ok
(
hr
==
CO_E_RELEASED
,
"got 0x%08x
\n
"
,
hr
);
value
=
tomTrue
;
hr
=
ITextRange_InRange
(
range
,
range2
,
&
value
);
ok
(
hr
==
CO_E_RELEASED
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
tomFalse
,
"got %d
\n
"
,
value
);
/* selection */
hr
=
ITextSelection_InRange
(
selection
,
NULL
,
NULL
);
ok
(
hr
==
CO_E_RELEASED
,
"got 0x%08x
\n
"
,
hr
);
value
=
tomTrue
;
hr
=
ITextSelection_InRange
(
selection
,
NULL
,
&
value
);
ok
(
hr
==
CO_E_RELEASED
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
tomFalse
,
"got %d
\n
"
,
value
);
hr
=
ITextSelection_InRange
(
selection
,
range2
,
NULL
);
ok
(
hr
==
CO_E_RELEASED
,
"got 0x%08x
\n
"
,
hr
);
value
=
tomTrue
;
hr
=
ITextSelection_InRange
(
selection
,
range2
,
&
value
);
ok
(
hr
==
CO_E_RELEASED
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
tomFalse
,
"got %d
\n
"
,
value
);
ITextRange_Release
(
range
);
ITextRange_Release
(
range2
);
ITextRange_Release
(
range3
);
ITextSelection_Release
(
selection
);
}
START_TEST
(
richole
)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
...
...
@@ -2548,4 +2658,5 @@ START_TEST(richole)
test_ITextFont
();
test_Delete
();
test_SetText
();
test_InRange
();
}
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