Hi Christopher, Thanks for the stub! It got me into writing the tests (very quick). Everything's fine on ff2, but a problem occurs on IE7 (only when running the tests, not on using the component within OL).
I put all the information and patch into the ticket, which I now wonder whether it's a good idea, http://trac.openlayers.org/ticket/927#comment:5 Anybody might have ran into a similar problem with test.anotherway? Cheers, Damien Christopher Schmidt wrote: > On Tue, Sep 04, 2007 at 05:21:53PM +0200, Damien Corpataux wrote: > >> Thanks! >> >> I think you mean unit tests... Glurp, I never played around with >> testanotherway. Although I'm interested in doing it when I get to have a >> little time, here is the test code I ran in firebug, using the >> openlayers/examples/vector-features.html example: >> > > Okay, I've put together a stub for you in the tests/Format/test_KML.html > file. What I would do here is very similar to what you have below: > * Create a KML parser. > * Create a feature -- point, line, polygon, whatever. > * In Firebug or elsewhere, create a text string which you can copy > paste with the expected output KML: set that as the expectedOut > variable. > * Create kmlOut against that feature: > kmlOut = kml.write([myFeature]); > * Test that expectedOut matches KML Out: > t.eq(expectedOut, kmlOut, "KML output matches given point feature"); > * If you feel up to it, add a test to write, which reads the output > KML (as below) and test things like: > t.eq(outputFeatures.length, 1, "Got correct number of features > back"); > t.eq(outputFeatures[0].geometry.CLASS_NAME, "OpenLayers.Geometry.Point", > "Correct geom type returned."); > > > etc. > > If you don't get a chance, I'll bang something out soon, since we're > trying not to shove things in without at least some tests -- but thanks > for the patch regardless! > > >> ---8<------------------------------------------------------------------- >> var kml = new OpenLayers.Format.KML(); >> var kmlOut = kml.write(map.layers[1].features); >> >> map.layers[1].eraseFeatures(map.layers[1].features); >> map.layers[1].features = []; >> >> var features = kml.read(kmlOut); >> >> features; >> >> map.layers[1].addFeatures(features); >> ---8<------------------------------------------------------------------- >> > > > > -- Camptocamp SA Damien Corpataux PSE A CH-1015 Lausanne +41 21 619 10 22 (Direct) +41 21 619 10 10 (Centrale) +41 21 619 10 00 (Fax) P Please consider the environment Do you really need to print this email?
_______________________________________________ Dev mailing list Dev@openlayers.org http://openlayers.org/mailman/listinfo/dev