summaryrefslogtreecommitdiffstats
path: root/tests/ttk/radiobutton.test
diff options
context:
space:
mode:
authorhobbs <hobbs>2010-08-26 02:06:08 (GMT)
committerhobbs <hobbs>2010-08-26 02:06:08 (GMT)
commitb29adcfbfc2e03e058536524f1aa3378b948e7ed (patch)
treefa90e1e6d32590addfbb0a1599a40b1f7f99ea3b /tests/ttk/radiobutton.test
parent7dec1714e5d5efd6b7d095657c1434fa68af0f87 (diff)
downloadtk-b29adcfbfc2e03e058536524f1aa3378b948e7ed.zip
tk-b29adcfbfc2e03e058536524f1aa3378b948e7ed.tar.gz
tk-b29adcfbfc2e03e058536524f1aa3378b948e7ed.tar.bz2
Major backport of 8.6 Ttk for 8.5.9. Most changes were only being
committed to head (8.6), although they could apply for 8.5 as well. This re-sync makes future work easier to maintain and adds some useful work for 8.5 users. Notable changes: - Lots of code cleanup - Some bug fixes never backported - Addition of ttk::spinbox - minor color changes - Improved Vista/7 styling - Move to tile version 0.8.6 (pseudo-package) - ABI and API compatible (even $w identify) - minor new features (extended $w identify)
Diffstat (limited to 'tests/ttk/radiobutton.test')
-rw-r--r--tests/ttk/radiobutton.test49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/ttk/radiobutton.test b/tests/ttk/radiobutton.test
new file mode 100644
index 0000000..6858659
--- /dev/null
+++ b/tests/ttk/radiobutton.test
@@ -0,0 +1,49 @@
+# $Id: radiobutton.test,v 1.1.2.2 2010/08/26 02:06:10 hobbs Exp $
+#
+# ttk::radiobutton widget tests.
+#
+
+package require Tk
+package require tcltest ; namespace import -force tcltest::*
+loadTestedCommands
+
+test radiobutton-1.1 "Radiobutton check" -body {
+ pack \
+ [ttk::radiobutton .rb1 -text "One" -variable choice -value 1] \
+ [ttk::radiobutton .rb2 -text "Two" -variable choice -value 2] \
+ [ttk::radiobutton .rb3 -text "Three" -variable choice -value 3] \
+ ;
+}
+test radiobutton-1.2 "Radiobutton invoke" -body {
+ .rb1 invoke
+ set ::choice
+} -result 1
+
+test radiobutton-1.3 "Radiobutton state" -body {
+ .rb1 instate selected
+} -result 1
+
+test radiobutton-1.4 "Other radiobutton invoke" -body {
+ .rb2 invoke
+ set ::choice
+} -result 2
+
+test radiobutton-1.5 "Other radiobutton state" -body {
+ .rb2 instate selected
+} -result 1
+
+test radiobutton-1.6 "First radiobutton state" -body {
+ .rb1 instate selected
+} -result 0
+
+test radiobutton-1.7 "Unset radiobutton variable" -body {
+ unset ::choice
+ list [info exists ::choice] [.rb1 instate alternate] [.rb2 instate alternate]
+} -result {0 1 1}
+
+test radiobutton-1.8 "Reset radiobutton variable" -body {
+ set ::choice 2
+ list [info exists ::choice] [.rb1 instate alternate] [.rb2 instate alternate]
+} -result {1 0 0}
+
+tcltest::cleanupTests