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

Last change on this file since 5949 was 5949, checked in by dkearney, 7 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::GeoMapDataProviderGdal
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
37# temporary class for testing protected methods
38itcl::class TestDataProviderGdal {
39    inherit Rappture::GeoMapDataProviderGdal
40
41    constructor {url args} {
42        Rappture::GeoMapDataProviderGdal::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::GeoMapDataProviderGdal <name> <url>
56#----------------------------------------------------------
57test geomapdataprovidergdal-1.1 {Rappture::GeoMapDataProviderGdal, 0 arguments} {
58    list [catch {Rappture::GeoMapDataProviderGdal} msg] $msg
59} {0 {}}
60
61
62test geomapdataprovidergdal-1.2 {
63    Rappture::GeoMapDataProviderGdal, name url
64} -body {
65    list [catch {Rappture::GeoMapDataProviderGdal 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
76test geomapdataprovidergdal-2.1 {exportToBltTree, } {
77    set dp [Rappture::GeoMapDataProviderGdal #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 gdal cache true attribution {} gdal.url http://myurl.com/} {}
82}
83
84
85# TODO:
86
87::tcltest::cleanupTests
88return
89
Note: See TracBrowser for help on using the repository browser.