source: branches/geomap/gui/test/geomaplayerimage.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.6 KB
Line 
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
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::GeoMapLayerImage <name> <provider> \
43#   ?-label <text>? \
44#   ?-description <text>? \
45#   ?-visibility <bool>? \
46#   ?-opacity <float>? \
47#   ?-coverage <bool>?
48#----------------------------------------------------------
49test geomaplayerimage-1.1 {Rappture::GeoMapLayerImage, 0 arguments} {
50    list [catch {Rappture::GeoMapLayerImage} msg] $msg
51} {0 {}}
52
53test geomaplayerimage-1.2 {Rappture::GeoMapLayerImage, 2 arguments} {
54    list [catch {Rappture::GeoMapLayerImage name $provider \
55                    -coverage true} msg] $msg
56} {0 name}
57
58test 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
63test 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
69test 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 coverage false}}
74
75
76# TODO:
77
78::tcltest::cleanupTests
79return
80
Note: See TracBrowser for help on using the repository browser.