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
07154f7f
Commit
07154f7f
authored
Sep 17, 2014
by
Jactry Zeng
Committed by
Alexandre Julliard
Sep 17, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Implement ITextRange::Collapse.
parent
da40589e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
2 deletions
+97
-2
richole.c
dlls/riched20/richole.c
+13
-2
richole.c
dlls/riched20/tests/richole.c
+84
-0
No files found.
dlls/riched20/richole.c
View file @
07154f7f
...
...
@@ -743,14 +743,25 @@ static HRESULT WINAPI ITextRange_fnGetStoryType(ITextRange *me, LONG *pValue)
return
E_NOTIMPL
;
}
static
HRESULT
range_Collapse
(
LONG
bStart
,
LONG
*
start
,
LONG
*
end
)
{
if
(
*
end
==
*
start
)
return
S_FALSE
;
if
(
bStart
==
tomEnd
||
bStart
==
tomFalse
)
*
start
=
*
end
;
else
*
end
=
*
start
;
return
S_OK
;
}
static
HRESULT
WINAPI
ITextRange_fnCollapse
(
ITextRange
*
me
,
LONG
bStart
)
{
ITextRangeImpl
*
This
=
impl_from_ITextRange
(
me
);
if
(
!
This
->
reOle
)
return
CO_E_RELEASED
;
FIXME
(
"not implemented %p
\n
"
,
This
);
return
E_NOTIMPL
;
return
range_Collapse
(
bStart
,
&
This
->
start
,
&
This
->
end
);
}
static
HRESULT
WINAPI
ITextRange_fnExpand
(
ITextRange
*
me
,
LONG
Unit
,
LONG
*
pDelta
)
...
...
dlls/riched20/tests/richole.c
View file @
07154f7f
...
...
@@ -789,6 +789,89 @@ static void test_ITextRange_GetDuplicate(void)
release_interfaces
(
&
w
,
&
reOle
,
&
txtDoc
,
NULL
);
}
static
void
test_ITextRange_Collapse
(
void
)
{
HWND
w
;
IRichEditOle
*
reOle
=
NULL
;
ITextDocument
*
txtDoc
=
NULL
;
ITextRange
*
txtRge
=
NULL
;
HRESULT
hres
;
LONG
first
,
lim
,
start
,
end
;
static
const
CHAR
test_text1
[]
=
"TestSomeText"
;
create_interfaces
(
&
w
,
&
reOle
,
&
txtDoc
,
NULL
);
SendMessageA
(
w
,
WM_SETTEXT
,
0
,
(
LPARAM
)
test_text1
);
first
=
4
,
lim
=
8
;
ITextDocument_Range
(
txtDoc
,
first
,
lim
,
&
txtRge
);
hres
=
ITextRange_Collapse
(
txtRge
,
tomTrue
);
ok
(
hres
==
S_OK
,
"ITextRange_Collapse
\n
"
);
ITextRange_GetStart
(
txtRge
,
&
start
);
ok
(
start
==
4
,
"got wrong start value: %d
\n
"
,
start
);
ITextRange_GetEnd
(
txtRge
,
&
end
);
ok
(
end
==
4
,
"got wrong end value: %d
\n
"
,
end
);
ITextRange_Release
(
txtRge
);
ITextDocument_Range
(
txtDoc
,
first
,
lim
,
&
txtRge
);
hres
=
ITextRange_Collapse
(
txtRge
,
tomStart
);
ok
(
hres
==
S_OK
,
"ITextRange_Collapse
\n
"
);
ITextRange_GetStart
(
txtRge
,
&
start
);
ok
(
start
==
4
,
"got wrong start value: %d
\n
"
,
start
);
ITextRange_GetEnd
(
txtRge
,
&
end
);
ok
(
end
==
4
,
"got wrong end value: %d
\n
"
,
end
);
ITextRange_Release
(
txtRge
);
ITextDocument_Range
(
txtDoc
,
first
,
lim
,
&
txtRge
);
hres
=
ITextRange_Collapse
(
txtRge
,
tomFalse
);
ok
(
hres
==
S_OK
,
"ITextRange_Collapse
\n
"
);
ITextRange_GetStart
(
txtRge
,
&
start
);
ok
(
start
==
8
,
"got wrong start value: %d
\n
"
,
start
);
ITextRange_GetEnd
(
txtRge
,
&
end
);
ok
(
end
==
8
,
"got wrong end value: %d
\n
"
,
end
);
ITextRange_Release
(
txtRge
);
ITextDocument_Range
(
txtDoc
,
first
,
lim
,
&
txtRge
);
hres
=
ITextRange_Collapse
(
txtRge
,
tomEnd
);
ok
(
hres
==
S_OK
,
"ITextRange_Collapse
\n
"
);
ITextRange_GetStart
(
txtRge
,
&
start
);
ok
(
start
==
8
,
"got wrong start value: %d
\n
"
,
start
);
ITextRange_GetEnd
(
txtRge
,
&
end
);
ok
(
end
==
8
,
"got wrong end value: %d
\n
"
,
end
);
ITextRange_Release
(
txtRge
);
/* tomStart is the default */
ITextDocument_Range
(
txtDoc
,
first
,
lim
,
&
txtRge
);
hres
=
ITextRange_Collapse
(
txtRge
,
256
);
ok
(
hres
==
S_OK
,
"ITextRange_Collapse
\n
"
);
ITextRange_GetStart
(
txtRge
,
&
start
);
ok
(
start
==
4
,
"got wrong start value: %d
\n
"
,
start
);
ITextRange_GetEnd
(
txtRge
,
&
end
);
ok
(
end
==
4
,
"got wrong end value: %d
\n
"
,
end
);
ITextRange_Release
(
txtRge
);
first
=
6
,
lim
=
6
;
ITextDocument_Range
(
txtDoc
,
first
,
lim
,
&
txtRge
);
hres
=
ITextRange_Collapse
(
txtRge
,
tomEnd
);
ok
(
hres
==
S_FALSE
,
"ITextRange_Collapse
\n
"
);
ITextRange_GetStart
(
txtRge
,
&
start
);
ok
(
start
==
6
,
"got wrong start value: %d
\n
"
,
start
);
ITextRange_GetEnd
(
txtRge
,
&
end
);
ok
(
end
==
6
,
"got wrong end value: %d
\n
"
,
end
);
ITextRange_Release
(
txtRge
);
first
=
8
,
lim
=
8
;
ITextDocument_Range
(
txtDoc
,
first
,
lim
,
&
txtRge
);
hres
=
ITextRange_Collapse
(
txtRge
,
tomStart
);
ok
(
hres
==
S_FALSE
,
"ITextRange_Collapse
\n
"
);
ITextRange_GetStart
(
txtRge
,
&
start
);
ok
(
start
==
8
,
"got wrong start value: %d
\n
"
,
start
);
ITextRange_GetEnd
(
txtRge
,
&
end
);
ok
(
end
==
8
,
"got wrong end value: %d
\n
"
,
end
);
ITextRange_Release
(
txtRge
);
release_interfaces
(
&
w
,
&
reOle
,
&
txtDoc
,
NULL
);
}
START_TEST
(
richole
)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
...
...
@@ -805,4 +888,5 @@ START_TEST(richole)
test_ITextRange_GetChar
();
test_ITextRange_GetStart_GetEnd
();
test_ITextRange_GetDuplicate
();
test_ITextRange_Collapse
();
}
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