[Commits] r2696 - sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/tests/lib/GeoExt.ux/widgets

commits at geoext.org commits at geoext.org
Mon May 16 20:58:42 CEST 2011


Author: adube
Date: 2011-05-16 20:58:42 +0200 (Mon, 16 May 2011)
New Revision: 2696

Modified:
   sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/tests/lib/GeoExt.ux/widgets/WFSTFeatureEditingManager.html
Log:
WFSTFeatureEditing - manager constructor test units

Modified: sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/tests/lib/GeoExt.ux/widgets/WFSTFeatureEditingManager.html
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/tests/lib/GeoExt.ux/widgets/WFSTFeatureEditingManager.html	2011-05-16 18:37:29 UTC (rev 2695)
+++ sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/tests/lib/GeoExt.ux/widgets/WFSTFeatureEditingManager.html	2011-05-16 18:58:42 UTC (rev 2696)
@@ -18,11 +18,112 @@
     <script src="../../../../lib/GeoExt.ux/WFSTFeatureEditing.js"
             type="text/javascript" ></script>
     <script type="text/javascript">
-    function test_ctor(t) {
-        t.plan(0);
+    var DummyMainPanelContainer = Ext.extend(Ext.Panel, {});
+
+    function getNewMap() {
+        return new OpenLayers.Map("map");
+    };
+
+    function getNewWMSLayer() {
+        return new OpenLayer.Layer.WMS("mylayer");
+    };
+
+    function getNewMainPanelContainer() {
+        return new DummyMainPanelContainer({
+            width: 550,
+            height: 450,
+            title: "my main panel container",
+            layout: 'fit',
+            renderTo: "panel",
+            items: []
+        });
+    };
+
+    function getNewToolbar() {
+        return new Ext.Toolbar();
+    };
+
+    function test_WFSTFeatureEditingStatusBar_constructor(t) {
+        t.plan(21);
+        
+        var manager, log = [];
+        GeoExt.ux.WFSTFeatureEditingManager.prototype.createToolsFromURL = function(url) {
+            log.push(url);
+        };
+
+        // (1) testing GeoExt.ux.WFSTFeatureEditingManager constructor
+        manager = new GeoExt.ux.WFSTFeatureEditingManager({
+            // Mandatory properties
+            "map": getNewMap(),
+            "toolbar": getNewToolbar(),
+            "mainPanelContainer": getNewMainPanelContainer(),
+            "url": "http://localhost/mywfsserver?",
+            // Optional properties
+            "capabilitiesParams": "capFoo",
+            "describeFeatureTypeParams": "descFoo",
+            "protocolOptions": "protoFoo",
+            "layerOptions": "layerFoo",
+            "geomProperty": "geomFoo",
+            "actionGroup": "groupFoo",
+            "useFilter": "filterFoo",
+            "ignoredAttributes": "ignoredFoo"
+        });
+        t.ok(manager instanceof GeoExt.ux.WFSTFeatureEditingManager,
+            "new  GeoExt.ux.WFSTFeatureEditingManager returns an instance");
+
+        // (4) testing GeoExt.ux.WFSTFeatureEditingManager instance public
+        //     mandatory properties
+        t.ok(manager.map instanceof OpenLayers.Map,
+            "constructor sets map correctly");
+        t.ok(manager.toolbar instanceof Ext.Toolbar,
+            "constructor sets toolbar correctly");
+        t.ok(manager.mainPanelContainer instanceof DummyMainPanelContainer,
+            "constructor sets mainPanelContainer correctly");
+        t.eq(manager.url, "http://localhost/mywfsserver?",
+            "constructor sets url correctly");
+
+        // (8) testing GeoExt.ux.WFSTFeatureEditingManager instance public
+        //     optional properties
+        t.eq(manager.capabilitiesParams, "capFoo",
+            "constructor sets capabilitiesParams correctly");
+        t.eq(manager.describeFeatureTypeParams, "descFoo",
+            "constructor sets describeFeatureTypeParams correctly");
+        t.eq(manager.protocolOptions, "protoFoo",
+            "constructor sets protocolOptions correctly");
+        t.eq(manager.layerOptions, "layerFoo",
+            "constructor sets layerOptions correctly");
+        t.eq(manager.geomProperty, "geomFoo",
+            "constructor sets geomProperty correctly");
+        t.eq(manager.actionGroup, "groupFoo",
+            "constructor sets actionGroup correctly");
+        t.eq(manager.useFilter, "filterFoo",
+            "constructor sets useFilter correctly");
+        t.eq(manager.ignoredAttributes, "ignoredFoo",
+            "constructor sets ignoredAttributes correctly");
+
+        // (6) testing private properties - objects created by initMainTools
+        //     method, called by constructor
+        t.ok(manager.drawMenuButton instanceof Ext.Button,
+            "constructor sets drawMenuButton correctly using initMainTools method");
+        t.ok(manager.editMenuButton instanceof Ext.Button,
+            "constructor sets editMenuButton correctly using initMainTools method");
+        t.eq(manager.toolbar.items.getCount(), 4, "The two buttons were added to the toolbar + 2 separators");
+        t.ok(manager.featureGridContainer instanceof Ext.TabPanel,
+            "constructor sets featureGridContainer correctly using initMainTools method");
+        t.ok(manager.featureEditorGridContainer instanceof Ext.Panel,
+            "constructor sets featureEditorGridContainer correctly using initMainTools method");
+        t.ok(manager.mainPanel instanceof Ext.Panel,
+            "constructor sets mainPanel correctly using initMainTools method");
+
+        // (2) testing the createToolsFromURL method called by constructor
+        //     (does nothing for test purpose)
+        t.eq(log.length, 1, "createToolsFromURL called once");
+        t.eq(log[0], "http://localhost/mywfsserver?",
+            "createToolsFromURL called with correct url");
     }
     </script>
   <body>
+    <div id="map"></div>
     <div id="panel"></div>
   </body>
 </html>
\ No newline at end of file



More information about the Commits mailing list