1 USING: alien ui.gadgets.panes ui.gadgets namespaces
2 kernel sequences io io.styles io.streams.string tools.test
3 prettyprint definitions help help.syntax help.markup
4 help.stylesheet splitting tools.test.ui models math summary
5 inspector accessors help.topics see ;
6 IN: ui.gadgets.panes.tests
8 : #children "pane" get children>> length ;
10 [ ] [ <pane> "pane" set ] unit-test
12 [ ] [ #children "num-children" set ] unit-test
15 "pane" get <pane-stream> [ 100 [ . ] each ] with-output-stream*
18 [ t ] [ #children "num-children" get = ] unit-test
20 : test-gadget-text ( quot -- ? )
21 dup make-pane gadget-text dup print "======" print
22 swap with-string-writer dup print = ;
24 [ t ] [ [ "hello" write ] test-gadget-text ] unit-test
25 [ t ] [ [ "hello" pprint ] test-gadget-text ] unit-test
28 H{ { wrap-margin 100 } } [ "hello" pprint ] with-nesting
33 H{ { wrap-margin 100 } } [
40 [ t ] [ [ [ 1 2 3 ] pprint ] test-gadget-text ] unit-test
41 [ t ] [ [ \ + describe ] test-gadget-text ] unit-test
42 [ t ] [ [ \ = see ] test-gadget-text ] unit-test
43 [ t ] [ [ \ = print-topic ] test-gadget-text ] unit-test
76 [ "Hello world" write ] ($block)
86 "Hello world" print-content
93 \ = >link title-style get [
96 "Hello world" print-content
101 [ { { "a\n" } } simple-table. ] test-gadget-text
105 [ { { "a" } } simple-table. "x" write ] test-gadget-text
109 [ H{ } [ { { "a" } } simple-table. ] with-nesting "x" write ] test-gadget-text
112 ARTICLE: "test-article-1" "This is a test article"
113 "Hello world, how are you today." ;
115 [ t ] [ [ "test-article-1" $title ] test-gadget-text ] unit-test
117 [ t ] [ [ "test-article-1" print-topic ] test-gadget-text ] unit-test
119 ARTICLE: "test-article-2" "This is a test article"
120 "Hello world, how are you today."
121 { $table { "a" "b" } { "c" "d" } } ;
123 [ t ] [ [ "test-article-2" print-topic ] test-gadget-text ] unit-test
125 <pane> [ \ = see ] with-pane
126 <pane> [ \ = print-topic ] with-pane
129 \ = <model> [ see ] <pane-control> [ ] with-grafted-gadget
132 : <test-pane> ( -- foo )
133 <gadget> pane new-pane ;
135 [ t ] [ <test-pane> dup input>> child? ] unit-test
136 [ t ] [ <test-pane> dup last-line>> child? ] unit-test