diff options
author | fvogel <fvogelnew1@free.fr> | 2020-08-30 12:09:23 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2020-08-30 12:09:23 (GMT) |
commit | df142b003e91df5e16b298ddb77c392b630fb52a (patch) | |
tree | 58c96c21998204a22d004c727d4758232992767b /tests | |
parent | fe28edf2894878179f0dc39786a5e8a47f0f7dc7 (diff) | |
download | tk-df142b003e91df5e16b298ddb77c392b630fb52a.zip tk-df142b003e91df5e16b298ddb77c392b630fb52a.tar.gz tk-df142b003e91df5e16b298ddb77c392b630fb52a.tar.bz2 |
Add tests for the new 'style' command for ttk widgets.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ttk/checkbutton.test | 14 | ||||
-rw-r--r-- | tests/ttk/combobox.test | 14 | ||||
-rw-r--r-- | tests/ttk/entry.test | 14 | ||||
-rw-r--r-- | tests/ttk/labelframe.test | 14 | ||||
-rw-r--r-- | tests/ttk/notebook.test | 14 | ||||
-rw-r--r-- | tests/ttk/panedwindow.test | 18 | ||||
-rw-r--r-- | tests/ttk/progressbar.test | 16 | ||||
-rw-r--r-- | tests/ttk/radiobutton.test | 14 | ||||
-rw-r--r-- | tests/ttk/scrollbar.test | 32 | ||||
-rw-r--r-- | tests/ttk/spinbox.test | 14 | ||||
-rw-r--r-- | tests/ttk/treeview.test | 14 |
11 files changed, 178 insertions, 0 deletions
diff --git a/tests/ttk/checkbutton.test b/tests/ttk/checkbutton.test index 5e929de..ce57fec 100644 --- a/tests/ttk/checkbutton.test +++ b/tests/ttk/checkbutton.test @@ -70,4 +70,18 @@ test checkbutton-1.8 "Empty -variable" -body { destroy .cbev } -result {} +test checkbutton-2.1 "style command" -body { + ttk::checkbutton .w + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {{} TCheckbutton TCheckbutton} +test checkbutton-2.2 "style command" -body { + ttk::style configure customStyle.TCheckbutton + ttk::checkbutton .w -style customStyle.TCheckbutton + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.TCheckbutton customStyle.TCheckbutton TCheckbutton} + tcltest::cleanupTests diff --git a/tests/ttk/combobox.test b/tests/ttk/combobox.test index c14db9b..e0a44d3 100644 --- a/tests/ttk/combobox.test +++ b/tests/ttk/combobox.test @@ -85,4 +85,18 @@ test combobox-1890211 "ComboboxSelected event after listbox unposted" -body { destroy .cb } +test combobox-4.1 "style command" -body { + ttk::combobox .w + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {{} TCombobox TCombobox} +test combobox-4.2 "style command" -body { + ttk::style configure customStyle.TCombobox + ttk::combobox .w -style customStyle.TCombobox + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.TCombobox customStyle.TCombobox TCombobox} + tcltest::cleanupTests diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test index a2d6016..e7f9d7c 100644 --- a/tests/ttk/entry.test +++ b/tests/ttk/entry.test @@ -354,4 +354,18 @@ test entry-11.1 {Bug [2830360fff] - Don't loose invalid at focus events} -setup destroy .e } +test entry-12.1 "style command" -body { + ttk::entry .w + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {{} TEntry TEntry} +test entry-12.2 "style command" -body { + ttk::style configure customStyle.TEntry + ttk::entry .w -style customStyle.TEntry + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.TEntry customStyle.TEntry TEntry} + tcltest::cleanupTests diff --git a/tests/ttk/labelframe.test b/tests/ttk/labelframe.test index 649c35f..2a99390 100644 --- a/tests/ttk/labelframe.test +++ b/tests/ttk/labelframe.test @@ -127,4 +127,18 @@ test labelframe-6.1 "Stacking order" -body { destroy .t } -result [list .t.x1 .t.lf .t.lb .t.x2] +test labelframe-7.1 "style command" -body { + ttk::labelframe .w + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {{} TLabelframe TLabelframe} +test labelframe-7.2 "style command" -body { + ttk::style configure customStyle.TLabelframe + ttk::labelframe .w -style customStyle.TLabelframe + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.TLabelframe customStyle.TLabelframe TLabelframe} + tcltest::cleanupTests diff --git a/tests/ttk/notebook.test b/tests/ttk/notebook.test index ac63088..66e48dd 100644 --- a/tests/ttk/notebook.test +++ b/tests/ttk/notebook.test @@ -511,4 +511,18 @@ test notebook-1343984-2 "don't autoselect on destroy" -body { set ::history } -result [list DESTROY .nb.frame1 DESTROY .nb.frame2 DESTROY .nb.frame3] +test notebook-8.1 "style command" -body { + ttk::notebook .w + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {{} TNotebook TNotebook} +test notebook-8.2 "style command" -body { + ttk::style configure customStyle.TNotebook + ttk::notebook .w -style customStyle.TNotebook + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.TNotebook customStyle.TNotebook TNotebook} + tcltest::cleanupTests diff --git a/tests/ttk/panedwindow.test b/tests/ttk/panedwindow.test index c1fc6ac..8d23f94 100644 --- a/tests/ttk/panedwindow.test +++ b/tests/ttk/panedwindow.test @@ -288,4 +288,22 @@ test paned-propagation-5 "Slave change after map, on-axis" -body { test paned-propagation-cleanup "Clean up." -body { destroy .pw } +test panedwindow-6.1 "style command" -body { + # Contrary to ttk::scrollbar, ttk::progressbar and ttk::scale, + # ttk::panedwindow has same style TPanedwindow whatever -orient is + ttk::panedwindow .wv ; # default is -orient vertical + ttk::panedwindow .wh -orient horizontal + list [.wv cget -style] [.wv style] [winfo class .wv]\ + [.wh cget -style] [.wh style] [winfo class .wh] +} -cleanup { + destroy .wv .wh +} -result {{} TPanedwindow TPanedwindow {} TPanedwindow TPanedwindow} +test panedwindow-6.2 "style command" -body { + ttk::style configure customStyle.TPanedwindow + ttk::panedwindow .w -style customStyle.TPanedwindow + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.TPanedwindow customStyle.TPanedwindow TPanedwindow} + tcltest::cleanupTests diff --git a/tests/ttk/progressbar.test b/tests/ttk/progressbar.test index 7c888c6..f9d3366 100644 --- a/tests/ttk/progressbar.test +++ b/tests/ttk/progressbar.test @@ -121,4 +121,20 @@ test progressbar-3.2 "TIP #442 options are taken into account" -setup { destroy .p } -result {{-anchor e} {-foreground green} {-justify center} {-text {Cannot be seen}} {-wraplength 250}} +test progressbar-4.1 "style command" -body { + ttk::progressbar .wh ; # default is -orient horizontal + ttk::progressbar .wv -orient vertical + list [.wh cget -style] [.wh style] [winfo class .wh]\ + [.wv cget -style] [.wv style] [winfo class .wv] +} -cleanup { + destroy .wh .wv +} -result {{} Horizontal.TProgressbar TProgressbar {} Vertical.TProgressbar TProgressbar} +test progressbar-4.2 "style command" -body { + ttk::style configure customStyle.Vertical.TProgressbar + ttk::progressbar .w -orient vertical -style customStyle.Vertical.TProgressbar + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.Vertical.TProgressbar Vertical.customStyle.Vertical.TProgressbar TProgressbar} + tcltest::cleanupTests diff --git a/tests/ttk/radiobutton.test b/tests/ttk/radiobutton.test index ba02954..7442a6c 100644 --- a/tests/ttk/radiobutton.test +++ b/tests/ttk/radiobutton.test @@ -45,4 +45,18 @@ test radiobutton-1.8 "Reset radiobutton variable" -body { list [info exists ::choice] [.rb1 instate alternate] [.rb2 instate alternate] } -result {1 0 0} +test radiobutton-2.1 "style command" -body { + ttk::radiobutton .w + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {{} TRadiobutton TRadiobutton} +test radiobutton-2.2 "style command" -body { + ttk::style configure customStyle.TRadiobutton + ttk::radiobutton .w -style customStyle.TRadiobutton + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.TRadiobutton customStyle.TRadiobutton TRadiobutton} + tcltest::cleanupTests diff --git a/tests/ttk/scrollbar.test b/tests/ttk/scrollbar.test index 443687a..88965e4 100644 --- a/tests/ttk/scrollbar.test +++ b/tests/ttk/scrollbar.test @@ -156,6 +156,22 @@ test scrollbar-10.2.4 {<MouseWheel> event on horizontal scrollbar} -constraints destroy .t .s } -result {1.4} +test scrollbar-11.1 "style command" -body { + ttk::scrollbar .wv ; # default is -orient vertical + ttk::scrollbar .wh -orient horizontal + list [.wv cget -style] [.wv style] [winfo class .wv] \ + [.wh cget -style] [.wh style] [winfo class .wh] +} -cleanup { + destroy .wv .wh +} -result {{} Vertical.TScrollbar TScrollbar {} Horizontal.TScrollbar TScrollbar} +test scrollbar-11.2 "style command" -body { + ttk::style configure customStyle.Horizontal.TScrollbar + ttk::scrollbar .w -orient horizontal -style customStyle.Horizontal.TScrollbar + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.Horizontal.TScrollbar Horizontal.customStyle.Horizontal.TScrollbar TScrollbar} + # # Scale tests: # @@ -190,5 +206,21 @@ test scale-2.1 "-state option" -setup { unset -nocomplain res } -result {0 normal 1 disabled 0 normal 1 normal {disabled readonly} normal} +test scale-3.1 "style command" -body { + ttk::scale .wh ; # default is -orient horizontal + ttk::scale .wv -orient vertical + list [.wh cget -style] [.wh style] [winfo class .wh] \ + [.wv cget -style] [.wv style] [winfo class .wv] +} -cleanup { + destroy .wh .wv +} -result {{} Horizontal.TScale TScale {} Vertical.TScale TScale} +test scale-3.2 "style command" -body { + ttk::style configure customStyle.Vertical.TScale + ttk::scale .w -orient vertical -style customStyle.Vertical.TScale + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.Vertical.TScale Vertical.customStyle.Vertical.TScale TScale} + tcltest::cleanupTests diff --git a/tests/ttk/spinbox.test b/tests/ttk/spinbox.test index b5a9ab5..b06a1e1 100644 --- a/tests/ttk/spinbox.test +++ b/tests/ttk/spinbox.test @@ -357,6 +357,20 @@ test spinbox-dieoctaldie-2 "Cope with general bad input" -body { destroy .sb } +test spinbox-5.1 "style command" -body { + ttk::spinbox .w + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {{} TSpinbox TSpinbox} +test spinbox-5.2 "style command" -body { + ttk::style configure customStyle.TSpinbox + ttk::spinbox .w -style customStyle.TSpinbox + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.TSpinbox customStyle.TSpinbox TSpinbox} + tcltest::cleanupTests # Local variables: diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test index 4236b01..23743ea 100644 --- a/tests/ttk/treeview.test +++ b/tests/ttk/treeview.test @@ -834,4 +834,18 @@ test treeview-ce470f20fd-4 "changing -stretch resizes columns" -setup { destroy .tv } -result {60 50 60 50 60 50 1} +test treeview-11.1 "style command" -body { + ttk::treeview .w + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {{} Treeview Treeview} +test treeview-11.2 "style command" -body { + ttk::style configure customStyle.Treeview + ttk::treeview .w -style customStyle.Treeview + list [.w cget -style] [.w style] [winfo class .w] +} -cleanup { + destroy .w +} -result {customStyle.Treeview customStyle.Treeview Treeview} + tcltest::cleanupTests |