<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Christopher,<br>
<br>
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).<br>
<br>
I put all the information and patch into the ticket, which I now wonder
whether it's a good idea,
<a class="moz-txt-link-freetext" href="http://trac.openlayers.org/ticket/927#comment:5">http://trac.openlayers.org/ticket/927#comment:5</a><br>
<br>
Anybody might have ran into a similar problem with test.anotherway?<br>
<br>
<br>
Cheers,<br>
Damien<br>
<br>
<br>
Christopher Schmidt wrote:
<blockquote cite="mid20070904155445.GD8348@metacarta.com" type="cite">
<pre wrap="">On Tue, Sep 04, 2007 at 05:21:53PM +0200, Damien Corpataux wrote:
</pre>
<blockquote type="cite">
<pre wrap="">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:
</pre>
</blockquote>
<pre wrap=""><!---->
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!
</pre>
<blockquote type="cite">
<pre wrap="">---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<-------------------------------------------------------------------
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
<style>
<!--
.signature {
font-family:verdana,helvetica,sans-serif;
font-size:0.8em;
line-height: 1.25em;
color: #9999BB;
width: 27em;
}
.signature div {
padding: 0.22em;
margin-bottom: 0.5em;
margin-top: 0.5em;
border-bottom: 1px dotted lightgray;
background-color: #FCFCFF;
}
.signature .attention {
background-color: #FFFAFA;
color: #FFBBBB;
font-size: 0.8em;
font-weight: bold;
}
.header {
}
-->
</style>
<div class="signature">
<div> <span style="font-weight: bold;">Camptocamp SA</span><br>
Damien Corpataux<br>
PSE A<br>
CH-1015 Lausanne<br>
</div>
<div> +41 21 619 10 22 <span class="header">(Direct)</span><br>
+41 21 619 10 10 <span class="header">(Centrale)</span><br>
+41 21 619 10 00 <span class="header">(Fax)</span><br>
</div>
<div style="color: rgb(102, 204, 102);"> <span
style="position: relative; top: -3px; font-family: Webdings; font-size: 24pt;">P</span>
<span style="">Please consider the environment <br>
Do you really need to print this email?</span>
</div>
</div>
</div>
</body>
</html>