diff options
Diffstat (limited to 'tests/systray.test')
| -rw-r--r-- | tests/systray.test | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/tests/systray.test b/tests/systray.test index a87e6ef..6f38823 100644 --- a/tests/systray.test +++ b/tests/systray.test @@ -14,7 +14,7 @@ test systray-1 {systray icon creation, all options} -setup { image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== } -body { tk systray create -image _book -text "Systray sample" \ - -button1 {puts "button 1 click"} -button3 {puts "button 3 click"} + -button1 {puts "button 1 click"} -button3 {puts "button 3 click"} } -cleanup { tk systray destroy image delete _book @@ -22,17 +22,17 @@ test systray-1 {systray icon creation, all options} -setup { test systray-2 {systray create, argument checking} -body { tk systray create -} -returnCodes {error} -result {missing required option "-image"} +} -returnCodes error -result {missing required option "-image"} test systray-3 {systray create, argument checking} -body { tk systray create -text Hell -} -returnCodes {error} -result {missing required option "-image"} +} -returnCodes error -result {missing required option "-image"} test systray-4 {systray create, argument checking} -setup { image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== } -body { tk systray create -image _book -gorp invalidOption -} -returnCodes {error} -result {unknown option "-gorp": must be -image, -text, -button1 or -button3} +} -returnCodes error -result {unknown option "-gorp": must be -image, -text, -button1 or -button3} test systray-5 {systray icon creation, only required option present} -setup { image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== @@ -94,13 +94,13 @@ test systray-10 {configure non-existing systray icon} -setup { catch {tk systray destroy} } -body { tk systray configure -} -returnCodes {error} -result {systray not created} +} -returnCodes error -result {systray not created} test systray-11 {destroy non-existing systray icon} -setup { catch {tk systray destroy} } -body { tk systray destroy -} -returnCodes {error} -result {systray not created} +} -returnCodes error -result {systray not created} test systray-12 {destroy systray icon works} -setup { image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== @@ -118,7 +118,7 @@ test systray-13 {systray icon creation, attempt to create more than one in an in } -cleanup { tk systray destroy image delete _book -} -returnCodes {error} -result {only one system tray icon supported per interpeter} +} -returnCodes error -result {only one system tray icon supported per interpeter} test systray-14 {systray icon creation, create one per interp, visibiliy checks} -setup { image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== @@ -127,23 +127,23 @@ test systray-14 {systray icon creation, create one per interp, visibiliy checks} interp create second # load Tk into the 'second' interp foreach pkg [info loaded] { - if {[lindex $pkg 1] == "Tk"} { - set loadTk "load $pkg" - break - } + if {[lindex $pkg 1] == "Tk"} { + set loadTk "load $pkg" + break + } } eval $loadTk second # create the icon in the 'second' interp second eval { - # should trigger an error: image _book unknown in 'second' interp' - # image from higer interp should not be visible by 'tk systray' - tk systray create -image _book -text "second interp" + # should trigger an error: image _book unknown in 'second' interp' + # image from higer interp should not be visible by 'tk systray' + tk systray create -image _book -text "second interp" } } -cleanup { tk systray destroy image delete _book interp delete second -} -returnCodes {error} -result {image "_book" doesn't exist} +} -returnCodes error -result {image "_book" does not exist} test systray-15 {systray icon creation, create one per interp} -setup { image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== @@ -152,21 +152,21 @@ test systray-15 {systray icon creation, create one per interp} -setup { interp create second # load Tk into the 'second' interp foreach pkg [info loaded] { - if {[lindex $pkg 1] == "Tk"} { - set loadTk "load $pkg" - break - } + if {[lindex $pkg 1] == "Tk"} { + set loadTk "load $pkg" + break + } } eval $loadTk second # create the icon in the 'second' interp second eval { - image create photo _page -data R0lGODlhCwAPAKIAAP//////AMDAwICAgAAA/wAAAAAAAAAAACwAAAAACwAPAAADMzi6CzAugiAgDGE68aB0RXgRJBFVX0SNpQlUWfahQOvSsgrX7eZJMlQMWBEYj8iQchlKAAA7 - tk systray create -image _page -text "second interp" + image create photo _page -data R0lGODlhCwAPAKIAAP//////AMDAwICAgAAA/wAAAAAAAAAAACwAAAAACwAPAAADMzi6CzAugiAgDGE68aB0RXgRJBFVX0SNpQlUWfahQOvSsgrX7eZJMlQMWBEYj8iQchlKAAA7 + tk systray create -image _page -text "second interp" } } -cleanup { second eval { - tk systray destroy - image delete _page + tk systray destroy + image delete _page } interp delete second tk systray destroy @@ -177,13 +177,13 @@ test systray-16 {systray icon creation from a bitmap, on Linux and macOS only} - nonwin } -setup { set data1 { - #define foo_width 16 - #define foo_height 16 - static unsigned char foo_bits[] = { - 0xff, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, - 0x81, 0x81, 0xff, 0xff, 0xff, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, - 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xff, 0xff - }; + #define foo_width 16 + #define foo_height 16 + static unsigned char foo_bits[] = { + 0xff, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0xff, 0xff, 0xff, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xff, 0xff + }; } image create bitmap cross -data $data1 } -body { @@ -227,7 +227,7 @@ test sysnotify-2.1 {system notification stems from a systray icon on Windows} -c catch {tk systray destroy} } -body { tk sysnotify {Alert} {This is an alert} -} -returnCodes {error} -result {must create a system tray icon with the "tk systray" command first} +} -returnCodes error -result {must create a system tray icon with the "tk systray" command first} test sysnotify-2.2 {system notification is not linked to any systray icon on X11 or aqua} -constraints { nonwin } -setup { |
