1 USING: accessors colors fonts fry help help.markup help.stylesheet
2 help.syntax help.topics inspector io io.streams.string io.styles
3 kernel literals math models namespaces prettyprint see sequences
4 tools.test ui.gadgets ui.gadgets.debug ui.gadgets.panes
5 ui.gadgets.panes.private ui.theme ;
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
92 [ { { "a\n" } } simple-table. ] test-gadget-text
96 [ { { "a" } } simple-table. "x" write ] test-gadget-text
100 [ H{ } [ { { "a" } } simple-table. ] with-nesting "x" write ] test-gadget-text
103 ARTICLE: "test-article-1" "This is a test article"
104 "Hello world, how are you today." ;
106 { t } [ [ "test-article-1" $title ] test-gadget-text ] unit-test
108 { t } [ [ "test-article-1" print-topic ] test-gadget-text ] unit-test
110 ARTICLE: "test-article-2" "This is a test article"
111 "Hello world, how are you today."
112 { $table { "a" "b" } { "c" "d" } } ;
114 { t } [ [ "test-article-2" print-topic ] test-gadget-text ] unit-test
116 <pane> [ \ = see ] with-pane
117 <pane> [ \ = print-topic ] with-pane
120 \ = <model> [ see ] <pane-control> [ ] with-grafted-gadget
123 : <test-pane> ( -- foo )
124 <gadget> pane new-pane ;
126 { t } [ <test-pane> dup input>> child? ] unit-test
127 { t } [ <test-pane> dup last-line>> child? ] unit-test
133 { name $[ default-sans-serif-font-name ] }
134 { size $[ default-font-size ] }
135 { foreground $[ text-color ] }
136 { background $[ content-background ] }
139 <pane> dup current>> smash-line [ text>> ] [ font>> ] bi