Sha256: 642c4a06fa9bf157065ae79b4bfd768dbccd6cb9af43f82829fe78a94cec6101

Contents?: true

Size: 1.88 KB

Versions: 12

Compression:

Stored size: 1.88 KB

Contents

<html> 
<head> 
    <script src="../OLLoader.js"></script> 
    <script type="text/javascript">
    function test_basic(t) {
        t.plan(5);
        var format = new OpenLayers.Format.Text({extractStyles: true});
        var features = format.read(OpenLayers.Util.getElement("content").value);
        t.eq(features[0].style.externalGraphic, format.defaultStyle.externalGraphic, "style is set to defaults if no style props set in text file");
        var features = format.read(OpenLayers.Util.getElement("contentMarker").value);
        t.eq(features[0].style.externalGraphic, OpenLayers.Util.getImagesLocation() + "marker.png", "marker set correctly by default.");
        
        var features = format.read(OpenLayers.Util.getElement("content2").value);
        t.eq(features.length, 2, "two features read");
        t.eq(features[0].style.externalGraphic, "marker.png", "marker set correctly from data.");
        // t.eq(format.defaultStyle.externalGraphic, "../../img/marker.png", "defaultStyle externalGraphic not changed by pulling from data");

        var format = new OpenLayers.Format.Text({extractStyles: false});
        var features = format.read(OpenLayers.Util.getElement("content2").value);
        t.eq(features[0].style, null, "extractStyles: false results in null style property, even with style properties used");
    }
	function test_extra(t) {
        t.plan(1);
        var format = new OpenLayers.Format.Text();
        var features = format.read(OpenLayers.Util.getElement("content3").value);
        t.eq(features[0].attributes.whee, "chicken", "extra attributes are stored for later use");
	}
    </script>
</head>
<body>
<textarea id="content">
point
5,5
</textarea>
<textarea id="contentMarker">
point	iconSize
5,5	8,8
</textarea>
<textarea id="content2">
point	icon
5,5	marker.png
10,10	marker2.png
</textarea>
<textarea id="content3">
point	whee
5,5	chicken	
</textarea>
</body>
</html>

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
postrunner-0.0.10 misc/openlayers/tests/Format/Text.html
postrunner-0.0.9 misc/openlayers/tests/Format/Text.html
postrunner-0.0.8 misc/openlayers/tests/Format/Text.html
postrunner-0.0.7 misc/openlayers/tests/Format/Text.html
postrunner-0.0.6 misc/openlayers/tests/Format/Text.html
postrunner-0.0.5 misc/openlayers/tests/Format/Text.html
postrunner-0.0.4 misc/openlayers/tests/Format/Text.html
gb_mapfish_appserver-0.0.5 vendor/assets/javascripts/openlayers/tests/Format/Text.html
gb_mapfish_appserver-0.0.4 vendor/assets/javascripts/openlayers/tests/Format/Text.html
gb_mapfish_appserver-0.0.3 vendor/assets/javascripts/openlayers/tests/Format/Text.html
gb_mapfish_appserver-0.0.2 vendor/assets/javascripts/openlayers/tests/Format/Text.html
gb_mapfish_appserver-0.0.1 vendor/assets/javascripts/openlayers/tests/Format/Text.html