[OpenLayers-Dev] xml_eq and geom_eq

Tim Schaub tschaub at opengeo.org
Tue Nov 4 16:07:26 EST 2008


Hey-

I don't think I sent out a message about this before.  A while ago, I 
added a geom_eq method to the test objects from Test.AnotherWay.

This lets you do things like:

function test_soup(t) {
     t.plan(1);
     var format = new OpenLayers.Format.WKT();

     var wkt = "POINT(10 20)";
     var geom = new OpenLayers.Geometry.Point(10, 20);

     var feature = format.read(wkt);
     t.geom_eq(feature.geometry, geom, "point read");
}

All geometry types supported.

This and the xml_eq method (compare nodes to nodes, nodes to strings, 
etc) should make test writing a bit more compact if nothing else.

Both are documented here:
http://trac.openlayers.org/wiki/WritingUnitTests#ModificationstoTest.AnotherWay

Tim


-- 
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.



More information about the Dev mailing list