[Commits] r1450 - in sandbox/cmoullet/ux/GeonamesSearchCombo/tests: . ux ux/src ux/src/widgets ux/src/widgets/form

commits at geoext.org commits at geoext.org
Sat Nov 7 04:58:12 CET 2009


Author: cmoullet
Date: 2009-11-07 04:58:12 +0100 (Sat, 07 Nov 2009)
New Revision: 1450

Added:
   sandbox/cmoullet/ux/GeonamesSearchCombo/tests/ux/src/
   sandbox/cmoullet/ux/GeonamesSearchCombo/tests/ux/src/widgets/
   sandbox/cmoullet/ux/GeonamesSearchCombo/tests/ux/src/widgets/form/
   sandbox/cmoullet/ux/GeonamesSearchCombo/tests/ux/src/widgets/form/GeonamesSearchCombo.html
Modified:
   sandbox/cmoullet/ux/GeonamesSearchCombo/tests/list-tests.html
Log:
Add initial unit tests


Modified: sandbox/cmoullet/ux/GeonamesSearchCombo/tests/list-tests.html
===================================================================
--- sandbox/cmoullet/ux/GeonamesSearchCombo/tests/list-tests.html	2009-11-07 02:59:47 UTC (rev 1449)
+++ sandbox/cmoullet/ux/GeonamesSearchCombo/tests/list-tests.html	2009-11-07 03:58:12 UTC (rev 1450)
@@ -1,35 +1,3 @@
 <ul id="testlist">
-  <li>lib/overrides/override-ext-ajax.html</li>
-  <li>lib/GeoExt/data/AttributeReader.html</li>
-  <li>lib/GeoExt/data/FeatureRecord.html</li>
-  <li>lib/GeoExt/data/FeatureReader.html</li>
-  <li>lib/GeoExt/data/FeatureStore.html</li>
-  <li>lib/GeoExt/data/LayerRecord.html</li>
-  <li>lib/GeoExt/data/LayerReader.html</li>
-  <li>lib/GeoExt/data/LayerStore.html</li>
-  <li>lib/GeoExt/data/ScaleStore.html</li>
-  <li>lib/GeoExt/data/ProtocolProxy.html</li>
-  <li>lib/GeoExt/data/WFSCapabilitiesReader.html</li>
-  <li>lib/GeoExt/data/WMSCapabilitiesReader.html</li>
-  <li>lib/GeoExt/data/WMSDescribeLayerReader.html</li>
-  <li>lib/GeoExt/data/WMCReader.html</li>
-  <li>lib/GeoExt/widgets/Action.html</li>
-  <li>lib/GeoExt/widgets/LayerOpacitySlider.html</li>
-  <li>lib/GeoExt/widgets/MapPanel.html</li>
-  <li>lib/GeoExt/widgets/Popup.html</li>
-  <li>lib/GeoExt/widgets/form.html</li>
-  <li>lib/GeoExt/widgets/form/SearchAction.html</li>
-  <li>lib/GeoExt/widgets/form/BasicForm.html</li>
-  <li>lib/GeoExt/widgets/form/FormPanel.html</li>
-  <li>lib/GeoExt/widgets/tree/BaseLayerContainer.html</li>
-  <li>lib/GeoExt/widgets/tree/LayerContainer.html</li>
-  <li>lib/GeoExt/widgets/tree/LayerLoader.html</li>
-  <li>lib/GeoExt/widgets/tree/LayerNode.html</li>
-  <li>lib/GeoExt/widgets/tree/LayerParamLoader.html</li>
-  <li>lib/GeoExt/widgets/tree/LayerParamNode.html</li>
-  <li>lib/GeoExt/widgets/LegendImage.html</li>
-  <li>lib/GeoExt/widgets/LegendPanel.html</li>
-  <li>lib/GeoExt/widgets/LegendWMS.html</li>
-  <li>lib/GeoExt/widgets/ZoomSlider.html</li>
-  <li>lib/GeoExt/widgets/grid/FeatureSelectionModel.html</li>
+  <li>ux/src/widgets/form/GeonamesSearchCombo.html</li>
 </ul>

Added: sandbox/cmoullet/ux/GeonamesSearchCombo/tests/ux/src/widgets/form/GeonamesSearchCombo.html
===================================================================
--- sandbox/cmoullet/ux/GeonamesSearchCombo/tests/ux/src/widgets/form/GeonamesSearchCombo.html	                        (rev 0)
+++ sandbox/cmoullet/ux/GeonamesSearchCombo/tests/ux/src/widgets/form/GeonamesSearchCombo.html	2009-11-07 03:58:12 UTC (rev 1450)
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html debug="true">
+<head>
+
+    <script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.js"></script>
+    <script type="text/javascript" src="http://openlayers.org/api/2.8/OpenLayers.js"></script>
+    <script type="text/javascript" src="../../../../../../../geoext/lib/GeoExt.js"></script>
+    <script type="text/javascript" src="../../../../../src/widgets/form/GeonamesSearchCombo.js"></script>
+
+    <script type="text/javascript">
+
+        function test_geonamesSearch(t) {
+            t.plan(4);
+
+            var map = new OpenLayers.Map({
+                div: "map",
+                allOverlays: true
+            });
+            map.addLayer(new OpenLayers.Layer());
+            map.setCenter(new OpenLayers.LonLat(0, 0), 2);
+
+            var GeoNameSearchCombo = new GeoExt.ux.GeonamesSearchCombo({
+                map: map,
+                zoom: 12,
+                renderTo: 'geonamesSearch'
+            });
+
+            // test range of values
+            t.eq(GeoNameSearchCombo.width, 350, "default width is 350");
+            t.eq(GeoNameSearchCombo.zoom, 12, "zoom level has been set to 12");
+
+            // map exists
+            t.ok(GeoNameSearchCombo.map, 'a map is associated to combo')
+
+            // test that combo can be destroyed
+            try {
+                GeoNameSearchCombo.destroy();
+                t.ok(true, "combo destroy does not cause problems");
+            } catch(err) {
+                t.fail("combo destroy causes problems: " + err);
+            }
+
+            map.destroy();
+        }
+
+
+    </script>
+<body>
+<div id="geonamesSearch"></div>
+<div id="map" style="width: 512px; height: 256px;"></div>
+</body>
+</html>
\ No newline at end of file



More information about the Commits mailing list