Skip to content

Commit

Permalink
add a language test in the (failed) hope of catching #162
Browse files Browse the repository at this point in the history
It seems like the values *do* get set correctly on import,
they're just not showing in the swing widgets.
  • Loading branch information
nicolaspayette committed Nov 11, 2017
1 parent be4ebad commit 8273f9d
Show file tree
Hide file tree
Showing 2 changed files with 252 additions and 0 deletions.
226 changes: 226 additions & 0 deletions tests/export-import-preserves-values.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
{
"b":{
"COLOR":[
188.0,
188.0,
230.0,
255.0
],
"COMMANDS":"print \"hello world\"",
"ENABLED?":true,
"FONT-COLOR":0.0,
"FONT-SIZE":12.0,
"HEIGHT":50.0,
"HIDDEN?":false,
"KEY":"b",
"KIND":"BUTTON",
"LABEL":"",
"TAB":"t1",
"WIDTH":150.0,
"X":10.0,
"Y":10.0
},
"ti":{
"COLOR":[
130.0,
188.0,
183.0,
255.0
],
"ENABLED?":true,
"FONT-COLOR":0.0,
"FONT-SIZE":12.0,
"HEIGHT":50.0,
"HIDDEN?":false,
"KEY":"ti",
"KIND":"TEXT-INPUT",
"LABEL":"",
"OPAQUE?":true,
"TAB":"t1",
"TEXT":"a",
"WIDTH":150.0,
"X":10.0,
"Y":10.0
},
"mc":{
"COLOR":[
130.0,
188.0,
183.0,
255.0
],
"ENABLED?":true,
"FONT-COLOR":0.0,
"FONT-SIZE":12.0,
"HEIGHT":100.0,
"HIDDEN?":false,
"ITEMS":[
"a",
"b",
"c",
"d"
],
"KEY":"mc",
"KIND":"MULTI-CHOOSER",
"LABEL":"",
"OPAQUE?":true,
"SELECTED-ITEMS":[
"b",
"c"
],
"TAB":"t1",
"WIDTH":150.0,
"X":10.0,
"Y":10.0
},
"ni":{
"COLOR":[
130.0,
188.0,
183.0,
255.0
],
"ENABLED?":true,
"FONT-COLOR":0.0,
"FONT-SIZE":12.0,
"HEIGHT":50.0,
"HIDDEN?":false,
"KEY":"ni",
"KIND":"NUMERIC-INPUT",
"LABEL":"",
"OPAQUE?":true,
"TAB":"t1",
"VALUE":10.0,
"WIDTH":150.0,
"X":10.0,
"Y":10.0
},
"t1":{
"COLOR":9.9,
"ENABLED?":true,
"KEY":"t1",
"KIND":"TAB",
"ORDER":0.0,
"TITLE":""
},
"c1":{
"COLOR":[
130.0,
188.0,
183.0,
255.0
],
"ENABLED?":true,
"FONT-COLOR":0.0,
"FONT-SIZE":12.0,
"HEIGHT":50.0,
"HIDDEN?":false,
"ITEMS":[
"a",
"b",
"c",
"d"
],
"KEY":"c1",
"KIND":"CHOOSER",
"LABEL":"",
"OPAQUE?":true,
"SELECTED-ITEM":"b",
"TAB":"t1",
"WIDTH":150.0,
"X":10.0,
"Y":10.0
},
"n":{
"COLOR":9.9,
"ENABLED?":true,
"FONT-COLOR":0.0,
"FONT-SIZE":12.0,
"HEIGHT":25.0,
"HIDDEN?":false,
"KEY":"n",
"KIND":"NOTE",
"OPAQUE?":false,
"TAB":"t1",
"TEXT":"a",
"WIDTH":150.0,
"X":10.0,
"Y":10.0
},
"s1":{
"COLOR":[
130.0,
188.0,
183.0,
255.0
],
"ENABLED?":true,
"FONT-COLOR":0.0,
"FONT-SIZE":12.0,
"HEIGHT":50.0,
"HIDDEN?":false,
"INCREMENT":1.0,
"KEY":"s1",
"KIND":"SLIDER",
"LABEL":"",
"MAXIMUM":100.0,
"MINIMUM":0.0,
"OPAQUE?":true,
"TAB":"t1",
"UNITS":"",
"VALUE":10.0,
"WIDTH":150.0,
"X":10.0,
"Y":10.0
},
"c2":{
"COLOR":[
130.0,
188.0,
183.0,
255.0
],
"ENABLED?":true,
"FONT-COLOR":0.0,
"FONT-SIZE":12.0,
"HEIGHT":50.0,
"HIDDEN?":false,
"ITEMS":[
1.0,
2.0,
3.0,
4.0
],
"KEY":"c2",
"KIND":"CHOOSER",
"LABEL":"",
"OPAQUE?":true,
"SELECTED-ITEM":2.0,
"TAB":"t1",
"WIDTH":150.0,
"X":10.0,
"Y":10.0
},
"cb":{
"COLOR":[
130.0,
188.0,
183.0,
255.0
],
"ENABLED?":false,
"FONT-COLOR":0.0,
"FONT-SIZE":12.0,
"HEIGHT":25.0,
"HIDDEN?":false,
"KEY":"cb",
"KIND":"CHECKBOX",
"LABEL":"",
"OPAQUE?":true,
"SELECTED?":false,
"TAB":"t1",
"WIDTH":150.0,
"X":10.0,
"Y":10.0
}
}
26 changes: 26 additions & 0 deletions xw/tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,32 @@ test-export-import
glob1 = glob2 => true
O> file-close-all

export-import-preserves-values
extensions [xw]
O> xw:clear-all
O> xw:create-tab "t1"
O> xw:create-slider "s1" [ xw:set-value 10 ]
O> xw:create-chooser "c1" [ xw:set-items ["a" "b" "c" "d"] xw:set-selected-item "b" ]
O> xw:create-chooser "c2" [ xw:set-items [1 2 3 4] xw:set-selected-item 2 ]
O> xw:create-note "n" [ xw:set-text "a" ]
O> xw:create-checkbox "cb" [ xw:set-enabled? false ]
O> xw:create-multi-chooser "mc" [ xw:set-items [ "a" "b" "c" "d"] xw:set-selected-items ["b" "c"] ]
O> xw:create-text-input "ti" [ xw:set-text "a" ]
O> xw:create-numeric-input "ni" [ xw:set-value 10 ]
O> xw:create-button "b" [ xw:set-commands "print \"hello world\"" ]
O> xw:export "tests/export-import-preserves-values.json"
O> xw:clear-all
O> xw:import "tests/export-import-preserves-values.json"
xw:get "s1" => 10
xw:get "c1" => "b"
xw:get "c2" => 2
xw:get "n" => "a"
xw:get "cb" => false
xw:get "mc" => ["b" "c"]
xw:get "ti" => "a"
xw:get "ni" => 10
[ xw:commands ] xw:of "b" => "print \"hello world\""

import-multiple-files
extensions [xw]
O> xw:create-tab "t1"
Expand Down

0 comments on commit 8273f9d

Please sign in to comment.