]> gitweb.factorcode.org Git - factor.git/blob - extra/ui/commands/commands-tests.factor
Initial import
[factor.git] / extra / ui / commands / commands-tests.factor
1 IN: temporary
2 USING: ui.commands ui.gestures tools.test help.markup io
3 io.streams.string ;
4
5 [ "A+a" ] [ T{ key-down f { A+ } "a" } gesture>string ] unit-test
6 [ "b" ] [ T{ key-down f f "b" } gesture>string ] unit-test
7 [ "Press Button 2" ] [ T{ button-down f f 2 } gesture>string ] unit-test
8
9 : com-test-1 ;
10
11 \ com-test-1 H{ } define-command
12
13 [ [ 3 com-test-1 ] ] [ 3 \ com-test-1 command-quot ] unit-test
14
15 : com-test-2 ;
16
17 \ com-test-2 H{ { +nullary+ t } } define-command
18
19 [ [ com-test-2 ] ] [ 3 \ com-test-2 command-quot ] unit-test
20
21 SYMBOL: testing
22
23 testing "testing" "hey" {
24     { T{ key-down f { C+ } "x" } com-test-1 }
25 } define-command-map
26
27 [ "C+x" ] [
28     [
29         { $command testing "testing" com-test-1 } print-element
30     ] string-out
31 ] unit-test