1 | # Commands covered: |
---|
2 | # Rappture::GeoMapLayerImage |
---|
3 | # |
---|
4 | # This file contains a collection of tests for one of the Rappture Tcl |
---|
5 | # commands. Sourcing this file into Tcl runs the tests and |
---|
6 | # generates output for errors. No output means no errors were found. |
---|
7 | # |
---|
8 | # ====================================================================== |
---|
9 | # AUTHOR: Derrick Kearney, Purdue University |
---|
10 | # Copyright (c) 2004-2015 HUBzero Foundation, LLC |
---|
11 | # |
---|
12 | # See the file "license.terms" for information on usage and redistribution |
---|
13 | # of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
14 | |
---|
15 | |
---|
16 | if {[lsearch [namespace children] ::tcltest] == -1} { |
---|
17 | package require tcltest |
---|
18 | package require RapptureGUI |
---|
19 | namespace import -force ::tcltest::* |
---|
20 | } |
---|
21 | catch {unset lib} |
---|
22 | |
---|
23 | proc check {var size} { |
---|
24 | set l [llength $var] |
---|
25 | if {$l != $size} { |
---|
26 | return "length mismatch: should have been $size, was $l" |
---|
27 | } |
---|
28 | for {set i 0} {$i < $size} {set i [expr $i+1]} { |
---|
29 | set j [lindex $var $i] |
---|
30 | if {$j != "item $i"} { |
---|
31 | return "element $i should have been \"item $i\", was \"$j\"" |
---|
32 | } |
---|
33 | } |
---|
34 | return ok |
---|
35 | } |
---|
36 | |
---|
37 | set provider [Rappture::GeoMapDataProviderXYZ #auto {http://myurl.com/}] |
---|
38 | |
---|
39 | #---------------------------------------------------------- |
---|
40 | #---------------------------------------------------------- |
---|
41 | # constructor command |
---|
42 | # Rappture::GeoMapLayerImage <name> <provider> \ |
---|
43 | # ?-label <text>? \ |
---|
44 | # ?-description <text>? \ |
---|
45 | # ?-visibility <bool>? \ |
---|
46 | # ?-opacity <float>? \ |
---|
47 | # ?-coverage <bool>? |
---|
48 | #---------------------------------------------------------- |
---|
49 | test geomaplayerimage-1.1 {Rappture::GeoMapLayerImage, 0 arguments} { |
---|
50 | list [catch {Rappture::GeoMapLayerImage} msg] $msg |
---|
51 | } {0 {}} |
---|
52 | |
---|
53 | test geomaplayerimage-1.2 {Rappture::GeoMapLayerImage, 2 arguments} { |
---|
54 | list [catch {Rappture::GeoMapLayerImage name $provider \ |
---|
55 | -coverage true} msg] $msg |
---|
56 | } {0 name} |
---|
57 | |
---|
58 | test geomaplayerimage-4.0 {Rappture::GeoMapLayerImage, set coverage} { |
---|
59 | set l [Rappture::GeoMapLayerImage #auto $provider] |
---|
60 | list [catch {$l configure -coverage true} msg] $msg |
---|
61 | } {0 {}} |
---|
62 | |
---|
63 | test geomaplayerimage-4.1 {Rappture::GeoMapLayerImage, get coverage} { |
---|
64 | set l [Rappture::GeoMapLayerImage #auto $provider] |
---|
65 | $l configure -coverage true |
---|
66 | list [catch {$l cget -coverage} msg] $msg |
---|
67 | } {0 true} |
---|
68 | |
---|
69 | test geomaplayerimage-5.0 {Rappture::GeoMapLayerImage, export -format blt_tree} { |
---|
70 | set l [Rappture::GeoMapLayerImage #auto $provider] |
---|
71 | set t [$l export -format blt_tree] |
---|
72 | list [catch {lindex [$t dump 0] 3} msg] $msg |
---|
73 | } {0 {type image driver xyz cache true attribution {} xyz.url http://myurl.com/ label {} description {} visible true opacity 1.0 placard {attrlist {} style {fill: #B6B6B688; text-fill: #000000; text-size: 12.0;} padding 5} coverage false}} |
---|
74 | |
---|
75 | |
---|
76 | # TODO: |
---|
77 | |
---|
78 | ::tcltest::cleanupTests |
---|
79 | return |
---|
80 | |
---|