summaryrefslogtreecommitdiffstats
path: root/tests/base.tcl
diff options
context:
space:
mode:
authorjoye <joye>2014-02-19 17:22:07 (GMT)
committerjoye <joye>2014-02-19 17:22:07 (GMT)
commitda0918ad43ebff694adfb98fa6870707fd5e7d26 (patch)
treea291987e011570b63855e5cc6e27b3a1d9504b8a /tests/base.tcl
parent1ca66ad06cb322909e3d0ef0b0db91fece94d5a4 (diff)
downloadblt-da0918ad43ebff694adfb98fa6870707fd5e7d26.zip
blt-da0918ad43ebff694adfb98fa6870707fd5e7d26.tar.gz
blt-da0918ad43ebff694adfb98fa6870707fd5e7d26.tar.bz2
*** empty log message ***
Diffstat (limited to 'tests/base.tcl')
-rw-r--r--tests/base.tcl100
1 files changed, 100 insertions, 0 deletions
diff --git a/tests/base.tcl b/tests/base.tcl
new file mode 100644
index 0000000..4ce0e23
--- /dev/null
+++ b/tests/base.tcl
@@ -0,0 +1,100 @@
+set sleep 1000
+
+proc bltPlot {w title} {
+ toplevel $w
+ wm title $w $title
+ wm protocol $w WM_DELETE_WINDOW [list bltPlotDestroy $w]
+
+ set mb ${w}mb
+ menu $mb
+ $w configure -menu $mb
+}
+
+proc bltPlotDestroy {w} {
+ destroy ${w}mb
+ destroy $w
+}
+
+proc bltTest {graph option value} {
+ global sleep
+
+ echo " $option $value"
+ set org [$graph cget $option]
+ $graph configure $option $value
+ update
+ after $sleep
+ $graph configure $option $org
+ update
+ after $sleep
+}
+
+proc bltTest2 {graph which option value} {
+ global sleep
+
+ echo " $option $value"
+ set org [$graph $which cget $option]
+ $graph $which configure $option $value
+ update
+ after $sleep
+ $graph $which configure $option $org
+ update
+ after $sleep
+}
+
+proc bltBarGraph {w} {
+ global sleep
+
+ set title "Bar Graph"
+ bltPlot $w $title
+ set graph [blt::barchart ${w}.gr \
+ -width 600 \
+ -height 500 \
+ -title $title \
+ -barwidth .2 \
+ -barmode aligned \
+ ]
+ pack $graph -expand yes -fill both
+
+ $graph element create data1 \
+ -xdata { 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 } \
+ -ydata { 13 25 36 46 55 64 70 75 80 90}\
+ -color blue
+ $graph element create data2 \
+ -xdata { 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 } \
+ -ydata { 26 50 72 92 110 128 140 150 160 180}\
+ -color red
+ $graph legend configure -title "Legend"
+
+ update
+ after $sleep
+
+ return $graph
+}
+
+proc bltLineGraph {w} {
+ global sleep
+
+ set title "Line Graph"
+ bltPlot $w $title
+ set graph [blt::graph ${w}.gr \
+ -width 600 \
+ -height 500 \
+ -title $title \
+ ]
+ pack $graph -expand yes -fill both
+
+ $graph element create data1 \
+ -xdata { 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 } \
+ -ydata { 13 25 36 46 55 64 70 75 80 90}\
+ -color blue
+ $graph element create data2 \
+ -xdata { 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 } \
+ -ydata { 26 50 72 92 110 128 140 150 160 180}\
+ -color red
+ $graph legend configure -title "Legend"
+
+ update
+ after $sleep
+
+ return $graph
+}