source: branches/geomap/gui/test/geomaplayer.test @ 5949

Last change on this file since 5949 was 5949, checked in by dkearney, 8 years ago

adding data provider and layer objects, updating mapviewer to remove layers from client and server.

File size: 2.7 KB
RevLine 
[5949]1# Commands covered:
2#   Rappture::GeoMapLayer
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
16if {[lsearch [namespace children] ::tcltest] == -1} {
17    package require tcltest
18    package require RapptureGUI
19    namespace import -force ::tcltest::*
20}
21catch {unset lib}
22
23proc 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
37set provider [Rappture::GeoMapDataProviderXYZ #auto {http://myurl.com/}]
38
39#----------------------------------------------------------
40#----------------------------------------------------------
41# constructor command
42# Rappture::GeoMapLayer <name> <provider> \
43#   ?-label <label>? \
44#   ?-description <desc>? \
45#   ?-attribution <attrib>? \
46#   ?-visibility <visibility>? \
47#   ?-opacity <opacity>?
48#----------------------------------------------------------
49test geomaplayer-1.1 {Rappture::GeoMapLayer, 0 arguments} {
50    list [catch {Rappture::GeoMapLayer} msg] $msg
51} {0 {}}
52
53test geomaplayer-1.2 {Rappture::GeoMapLayer, 1 arguments} {
54    list [catch {Rappture::GeoMapLayer name $provider} msg] $msg
55} {0 name}
56
57
58test geomaplayer-11.0 {Rappture::GeoMapLayer, export (default format)} {
59    set l [Rappture::GeoMapLayer #auto $provider]
60    set t [$l export]
61    list [catch {lindex [$t dump 0] 3} msg] $msg
62} {0 {type image driver xyz cache true attribution {} xyz.url http://myurl.com/ label {} description {} visible true opacity 1.0}}
63
64test geomaplayer-11.1 {Rappture::GeoMapLayer, export bad format} {
65    set l [Rappture::GeoMapLayer #auto $provider]
66    list [catch {$l export -format blahh} msg] $msg
67} {1 {bad format "blahh": should be one of blt_tree}}
68
69test geomaplayer-11.2 {Rappture::GeoMapLayer, export -format blt_tree} {
70    set l [Rappture::GeoMapLayer #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}}
74
75
76
77# TODO:
78
79::tcltest::cleanupTests
80return
81
Note: See TracBrowser for help on using the repository browser.