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 ui.gadgets.debug models math summary
5 inspector accessors help.topics see fry ;
6 IN: ui.gadgets.panes.tests
8 : #children ( -- n ) "pane" get children>> length ;
10 { } [ <pane> "pane" set ] unit-test
12 { } [ #children "num-children" set ] unit-test
15 "pane" get <pane-stream> [ 100 [ . ] each-integer ] with-output-stream*
18 { t } [ #children "num-children" get = ] unit-test
20 : test-gadget-text ( quot -- ? )
22 [ make-pane gadget-text dup print "======" print ]
23 [ with-string-writer dup print ] bi = ;
25 { t } [ [ "hello" write ] test-gadget-text ] unit-test
26 { t } [ [ "hello" pprint ] test-gadget-text ] unit-test
29 H{ { wrap-margin 100 } } [ "hello" pprint ] with-nesting
34 H{ { wrap-margin 100 } } [
41 { t } [ [ [ 1 2 3 ] pprint ] test-gadget-text ] unit-test
42 { t } [ [ \ + describe ] test-gadget-text ] unit-test
43 { t } [ [ \ = see ] test-gadget-text ] unit-test
44 { t } [ [ \ = print-topic ] test-gadget-text ] unit-test
77 [ "Hello world" write ] ($block)
87 "Hello world" print-content
94 \ = >link title-style get [
97 "Hello world" print-content
102 [ { { "a\n" } } simple-table. ] test-gadget-text
106 [ { { "a" } } simple-table. "x" write ] test-gadget-text
110 [ H{ } [ { { "a" } } simple-table. ] with-nesting "x" write ] test-gadget-text
113 ARTICLE: "test-article-1" "This is a test article"
114 "Hello world, how are you today." ;
116 { t } [ [ "test-article-1" $title ] test-gadget-text ] unit-test
118 { t } [ [ "test-article-1" print-topic ] test-gadget-text ] unit-test
120 ARTICLE: "test-article-2" "This is a test article"
121 "Hello world, how are you today."
122 { $table { "a" "b" } { "c" "d" } } ;
124 { t } [ [ "test-article-2" print-topic ] test-gadget-text ] unit-test
126 <pane> [ \ = see ] with-pane
127 <pane> [ \ = print-topic ] with-pane
130 \ = <model> [ see ] <pane-control> [ ] with-grafted-gadget
133 : <test-pane> ( -- foo )
134 <gadget> pane new-pane ;
136 { t } [ <test-pane> dup input>> child? ] unit-test
137 { t } [ <test-pane> dup last-line>> child? ] unit-test