1 USING: accessors ui.gadgets.editors ui.gadgets.editors.private
2 tools.test kernel io io.streams.plain definitions namespaces
3 ui.gadgets ui.gadgets.grids prettyprint documents ui.gestures
4 ui.gadgets.debug models documents.elements ui.gadgets.scrollers
5 ui.gadgets.line-support sequences ;
6 IN: ui.gadgets.editors.tests
11 "foo bar" "editor" get set-editor-string
12 "editor" get one-line-elt select-elt
13 "editor" get gadget-selection
20 "foo bar\nbaz quux" "editor" get set-editor-string
21 "editor" get one-line-elt select-elt
22 "editor" get gadget-selection
29 "foo bar\nbaz quux" "editor" get set-editor-string
31 "editor" get position-caret
38 "bar\nbaz quux" "editor" get set-editor-string
39 { 0 3 } "editor" get caret>> set-model
40 "editor" get select-word
41 "editor" get gadget-selection
45 "hello" <model> <model-field> "field" set
48 [ "hello" ] [ "field" get field-model>> value>> ] unit-test
51 { "Hello world." } [ "Hello \n world." join-lines ] unit-test
52 { " Hello world. " } [ " Hello \n world. " join-lines ] unit-test
53 { " Hello world. Goodbye." } [ " Hello \n world. \n Goodbye." join-lines ] unit-test
55 { } [ <editor> com-join-lines ] unit-test
56 { } [ <editor> "A" over set-editor-string com-join-lines ] unit-test
57 { "A B" } [ <editor> "A\nB" over set-editor-string [ com-join-lines ] [ editor-string ] bi ] unit-test
58 { "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
59 { "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
60 { "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
62 { 2 } [ <editor> 20 >>min-rows 20 >>min-cols pref-viewport-dim length ] unit-test
65 <editor> 20 >>min-rows 20 >>min-cols
66 dup pref-viewport-dim >>dim