2016-09-05 01:47:39 -04:00
|
|
|
USING: accessors colors fonts fry help help.markup help.stylesheet
|
|
|
|
help.syntax help.topics inspector io io.streams.string io.styles
|
2018-01-16 15:32:17 -05:00
|
|
|
kernel literals math models namespaces prettyprint see sequences
|
|
|
|
tools.test ui.gadgets ui.gadgets.debug ui.gadgets.panes
|
|
|
|
ui.gadgets.panes.private ;
|
2008-09-02 02:52:22 -04:00
|
|
|
IN: ui.gadgets.panes.tests
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2009-03-23 01:34:02 -04:00
|
|
|
: #children ( -- n ) "pane" get children>> length ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ } [ <pane> "pane" set ] unit-test
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ } [ #children "num-children" set ] unit-test
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ } [
|
2010-01-14 10:10:13 -05:00
|
|
|
"pane" get <pane-stream> [ 100 [ . ] each-integer ] with-output-stream*
|
2007-09-20 18:09:08 -04:00
|
|
|
] unit-test
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [ #children "num-children" get = ] unit-test
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2009-02-09 23:40:11 -05:00
|
|
|
: test-gadget-text ( quot -- ? )
|
2009-03-28 05:19:33 -04:00
|
|
|
'[ _ call( -- ) ]
|
|
|
|
[ make-pane gadget-text dup print "======" print ]
|
|
|
|
[ with-string-writer dup print ] bi = ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [ [ "hello" write ] test-gadget-text ] unit-test
|
|
|
|
{ t } [ [ "hello" pprint ] test-gadget-text ] unit-test
|
|
|
|
{ t } [
|
2008-04-04 09:44:32 -04:00
|
|
|
[
|
|
|
|
H{ { wrap-margin 100 } } [ "hello" pprint ] with-nesting
|
|
|
|
] test-gadget-text
|
|
|
|
] unit-test
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [
|
2008-04-04 09:44:32 -04:00
|
|
|
[
|
|
|
|
H{ { wrap-margin 100 } } [
|
|
|
|
H{ } [
|
|
|
|
"hello" pprint
|
|
|
|
] with-style
|
|
|
|
] with-nesting
|
|
|
|
] test-gadget-text
|
|
|
|
] unit-test
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [ [ [ 1 2 3 ] pprint ] test-gadget-text ] unit-test
|
|
|
|
{ t } [ [ \ + describe ] test-gadget-text ] unit-test
|
|
|
|
{ t } [ [ \ = see ] test-gadget-text ] unit-test
|
|
|
|
{ t } [ [ \ = print-topic ] test-gadget-text ] unit-test
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [
|
2008-04-04 09:44:32 -04:00
|
|
|
[
|
|
|
|
title-style get [
|
|
|
|
"Hello world" write
|
|
|
|
] with-style
|
|
|
|
] test-gadget-text
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [
|
2008-04-04 09:44:32 -04:00
|
|
|
[
|
|
|
|
title-style get [
|
|
|
|
"Hello world" write
|
|
|
|
] with-nesting
|
|
|
|
] test-gadget-text
|
|
|
|
] unit-test
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [
|
2008-04-04 09:44:32 -04:00
|
|
|
[
|
|
|
|
title-style get [
|
|
|
|
title-style get [
|
|
|
|
"Hello world" write
|
|
|
|
] with-nesting
|
|
|
|
] with-style
|
|
|
|
] test-gadget-text
|
|
|
|
] unit-test
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [
|
2008-04-04 09:44:32 -04:00
|
|
|
[
|
|
|
|
title-style get [
|
|
|
|
title-style get [
|
|
|
|
[ "Hello world" write ] ($block)
|
|
|
|
] with-nesting
|
|
|
|
] with-style
|
|
|
|
] test-gadget-text
|
|
|
|
] unit-test
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [
|
2008-12-22 01:54:08 -05:00
|
|
|
[
|
|
|
|
last-element off
|
|
|
|
\ = >link $title
|
|
|
|
"Hello world" print-content
|
|
|
|
] test-gadget-text
|
2009-03-11 04:17:30 -04:00
|
|
|
] unit-test
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [
|
2009-03-11 04:17:30 -04:00
|
|
|
[ { { "a\n" } } simple-table. ] test-gadget-text
|
|
|
|
] unit-test
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [
|
2009-03-11 04:17:30 -04:00
|
|
|
[ { { "a" } } simple-table. "x" write ] test-gadget-text
|
|
|
|
] unit-test
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [
|
2009-03-11 04:17:30 -04:00
|
|
|
[ H{ } [ { { "a" } } simple-table. ] with-nesting "x" write ] test-gadget-text
|
|
|
|
] unit-test
|
|
|
|
|
2008-04-04 09:44:32 -04:00
|
|
|
ARTICLE: "test-article-1" "This is a test article"
|
|
|
|
"Hello world, how are you today." ;
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [ [ "test-article-1" $title ] test-gadget-text ] unit-test
|
2008-04-04 09:44:32 -04:00
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [ [ "test-article-1" print-topic ] test-gadget-text ] unit-test
|
2008-04-04 09:44:32 -04:00
|
|
|
|
|
|
|
ARTICLE: "test-article-2" "This is a test article"
|
2007-09-20 18:09:08 -04:00
|
|
|
"Hello world, how are you today."
|
|
|
|
{ $table { "a" "b" } { "c" "d" } } ;
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [ [ "test-article-2" print-topic ] test-gadget-text ] unit-test
|
2007-09-20 18:09:08 -04:00
|
|
|
|
|
|
|
<pane> [ \ = see ] with-pane
|
2008-11-22 00:01:20 -05:00
|
|
|
<pane> [ \ = print-topic ] with-pane
|
2007-11-16 01:19:13 -05:00
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ } [
|
2007-11-16 01:19:13 -05:00
|
|
|
\ = <model> [ see ] <pane-control> [ ] with-grafted-gadget
|
|
|
|
] unit-test
|
2009-03-06 14:32:41 -05:00
|
|
|
|
|
|
|
: <test-pane> ( -- foo )
|
|
|
|
<gadget> pane new-pane ;
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ t } [ <test-pane> dup input>> child? ] unit-test
|
|
|
|
{ t } [ <test-pane> dup last-line>> child? ] unit-test
|
2016-09-05 01:47:39 -04:00
|
|
|
|
|
|
|
! smash-line
|
2018-01-16 15:32:17 -05:00
|
|
|
${
|
2016-09-05 01:47:39 -04:00
|
|
|
""
|
|
|
|
T{ font
|
2018-01-16 15:32:17 -05:00
|
|
|
{ name $[ default-sans-serif-font-name ] }
|
|
|
|
{ size $[ default-font-size ] }
|
2016-09-05 01:47:39 -04:00
|
|
|
{ foreground
|
|
|
|
T{ rgba
|
|
|
|
{ red 0.0 }
|
|
|
|
{ green 0.0 }
|
|
|
|
{ blue 0.0 }
|
|
|
|
{ alpha 1.0 }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
{ background
|
|
|
|
T{ rgba
|
|
|
|
{ red 1.0 }
|
|
|
|
{ green 1.0 }
|
|
|
|
{ blue 1.0 }
|
|
|
|
{ alpha 1.0 }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} [
|
|
|
|
<pane> current>> smash-line [ text>> ] [ font>> ] bi
|
|
|
|
] unit-test
|