1 | # Commands covered: |
---|
2 | # Rappture::GeoMapDataProviderXYZ |
---|
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 | # temporary class for testing protected methods |
---|
38 | itcl::class TestDataProviderXYZ { |
---|
39 | inherit Rappture::GeoMapDataProviderXYZ |
---|
40 | |
---|
41 | constructor {url args} { |
---|
42 | Rappture::GeoMapDataProviderXYZ::constructor $url |
---|
43 | } { |
---|
44 | eval configure $args |
---|
45 | } |
---|
46 | destructor { |
---|
47 | # empty |
---|
48 | } |
---|
49 | public method do { args } {eval $args} |
---|
50 | } |
---|
51 | |
---|
52 | #---------------------------------------------------------- |
---|
53 | #---------------------------------------------------------- |
---|
54 | # constructor command |
---|
55 | # Rappture::GeoMapDataProviderXYZ <name> <url> |
---|
56 | #---------------------------------------------------------- |
---|
57 | test geomapdataproviderxyz-1.1 {Rappture::GeoMapDataProviderXYZ, 0 arguments} { |
---|
58 | list [catch {Rappture::GeoMapDataProviderXYZ} msg] $msg |
---|
59 | } {0 {}} |
---|
60 | |
---|
61 | |
---|
62 | test geomapdataproviderxyz-1.2 { |
---|
63 | Rappture::GeoMapDataProviderXYZ, name url |
---|
64 | } -body { |
---|
65 | list [catch {Rappture::GeoMapDataProviderXYZ name "http://myurl.com/"} msg] $msg |
---|
66 | } -cleanup { |
---|
67 | catch {itcl::delete object name} err |
---|
68 | } -result {0 name} |
---|
69 | |
---|
70 | |
---|
71 | #---------------------------------------------------------- |
---|
72 | # exportToBltTree |
---|
73 | # $dp exportToBltTree $tree |
---|
74 | #---------------------------------------------------------- |
---|
75 | |
---|
76 | test geomapdataproviderxyz-2.1 {exportToBltTree, } { |
---|
77 | set dp [Rappture::GeoMapDataProviderXYZ #auto "http://myurl.com/"] |
---|
78 | set tree [blt::tree create] |
---|
79 | $dp exportToBltTree $tree |
---|
80 | $tree dump root |
---|
81 | } {-1 0 ::tree0 {type image driver xyz cache true attribution {} xyz.url http://myurl.com/} {} |
---|
82 | } |
---|
83 | |
---|
84 | |
---|
85 | # TODO: |
---|
86 | |
---|
87 | ::tcltest::cleanupTests |
---|
88 | return |
---|
89 | |
---|