2009-10-19 23:46:46 -04:00
|
|
|
USING: accessors ui.gadgets.editors ui.gadgets.editors.private
|
|
|
|
tools.test kernel io io.streams.plain definitions namespaces
|
|
|
|
ui.gadgets ui.gadgets.grids prettyprint documents ui.gestures
|
|
|
|
ui.gadgets.debug models documents.elements ui.gadgets.scrollers
|
|
|
|
ui.gadgets.line-support sequences ;
|
2008-09-02 02:52:22 -04:00
|
|
|
IN: ui.gadgets.editors.tests
|
2007-09-20 18:09:08 -04:00
|
|
|
|
|
|
|
[ "foo bar" ] [
|
|
|
|
<editor> "editor" set
|
2007-11-16 03:01:45 -05:00
|
|
|
"editor" get [
|
|
|
|
"foo bar" "editor" get set-editor-string
|
2008-12-24 23:38:02 -05:00
|
|
|
"editor" get one-line-elt select-elt
|
2007-11-16 03:01:45 -05:00
|
|
|
"editor" get gadget-selection
|
|
|
|
] with-grafted-gadget
|
2007-09-20 18:09:08 -04:00
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ "baz quux" ] [
|
|
|
|
<editor> "editor" set
|
2007-11-16 03:01:45 -05:00
|
|
|
"editor" get [
|
|
|
|
"foo bar\nbaz quux" "editor" get set-editor-string
|
2008-12-24 23:38:02 -05:00
|
|
|
"editor" get one-line-elt select-elt
|
2007-11-16 03:01:45 -05:00
|
|
|
"editor" get gadget-selection
|
|
|
|
] with-grafted-gadget
|
2007-09-20 18:09:08 -04:00
|
|
|
] unit-test
|
2007-10-10 01:53:41 -04:00
|
|
|
|
|
|
|
[ ] [
|
|
|
|
<editor> "editor" set
|
2007-11-16 03:01:45 -05:00
|
|
|
"editor" get [
|
|
|
|
"foo bar\nbaz quux" "editor" get set-editor-string
|
|
|
|
4 hand-click# set
|
|
|
|
"editor" get position-caret
|
|
|
|
] with-grafted-gadget
|
2007-10-10 01:53:41 -04:00
|
|
|
] unit-test
|
2007-11-16 01:19:13 -05:00
|
|
|
|
2007-12-13 16:34:36 -05:00
|
|
|
[ "bar" ] [
|
|
|
|
<editor> "editor" set
|
|
|
|
"editor" get [
|
|
|
|
"bar\nbaz quux" "editor" get set-editor-string
|
2008-09-02 02:52:22 -04:00
|
|
|
{ 0 3 } "editor" get caret>> set-model
|
2007-12-13 16:34:36 -05:00
|
|
|
"editor" get select-word
|
|
|
|
"editor" get gadget-selection
|
|
|
|
] with-grafted-gadget
|
|
|
|
] unit-test
|
|
|
|
|
2008-12-11 17:47:38 -05:00
|
|
|
"hello" <model> <model-field> "field" set
|
2007-11-21 03:20:32 -05:00
|
|
|
|
|
|
|
"field" get [
|
2008-09-02 02:52:22 -04:00
|
|
|
[ "hello" ] [ "field" get field-model>> value>> ] unit-test
|
2007-11-21 03:20:32 -05:00
|
|
|
] with-grafted-gadget
|
2009-01-25 23:56:35 -05:00
|
|
|
|
|
|
|
[ "Hello world." ] [ "Hello \n world." join-lines ] unit-test
|
|
|
|
[ " Hello world. " ] [ " Hello \n world. " join-lines ] unit-test
|
|
|
|
[ " Hello world. Goodbye." ] [ " Hello \n world. \n Goodbye." join-lines ] unit-test
|
|
|
|
|
|
|
|
[ ] [ <editor> com-join-lines ] unit-test
|
|
|
|
[ ] [ <editor> "A" over set-editor-string com-join-lines ] unit-test
|
2009-02-15 05:01:57 -05:00
|
|
|
[ "A B" ] [ <editor> "A\nB" over set-editor-string [ com-join-lines ] [ editor-string ] bi ] unit-test
|
2009-10-19 23:46:46 -04:00
|
|
|
[ "A B\nC\nD" ] [ <editor> "A\nB\nC\nD" over set-editor-string { 0 0 } over set-caret dup mark>caret [ com-join-lines ] [ editor-string ] bi ] unit-test
|
|
|
|
[ "A\nB C\nD" ] [ <editor> "A\nB\nC\nD" over set-editor-string { 1 0 } over set-caret dup mark>caret [ com-join-lines ] [ editor-string ] bi ] unit-test
|
|
|
|
[ "A\nB\nC D" ] [ <editor> "A\nB\nC\nD" over set-editor-string { 2 0 } over set-caret dup mark>caret [ com-join-lines ] [ editor-string ] bi ] unit-test
|
2009-02-15 05:01:57 -05:00
|
|
|
|
2009-02-16 02:03:50 -05:00
|
|
|
[ 2 ] [ <editor> 20 >>min-rows 20 >>min-cols pref-viewport-dim length ] unit-test
|
|
|
|
|
|
|
|
[ 20 ] [
|
|
|
|
<editor> 20 >>min-rows 20 >>min-cols
|
|
|
|
dup pref-viewport-dim >>dim
|
|
|
|
visible-lines
|
|
|
|
] unit-test
|
|
|
|
|