Format.Filter.v1 may fail to read LowerBoundary and upperBoundary, r=bartvde

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10420 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2010-06-21 08:08:13 +00:00
parent e6b0ec0ee3
commit 9a2363d06b
2 changed files with 30 additions and 1 deletions

View File

@@ -227,7 +227,7 @@ OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
var obj = {};
this.readChildNodes(node, obj);
var value = obj.value;
if(!value) {
if(value === undefined) {
value = this.getChildValue(node);
}
return value;

View File

@@ -3,6 +3,35 @@
<script src="../../../lib/OpenLayers.js"></script>
<script type="text/javascript">
function test_PropertyIsBetween(t) {
t.plan(3);
var test_xml =
'<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">' +
'<ogc:PropertyIsBetween>' +
'<ogc:PropertyName>number</ogc:PropertyName>' +
'<ogc:LowerBoundary>' +
'<ogc:Literal>0</ogc:Literal>' +
'</ogc:LowerBoundary>' +
'<ogc:UpperBoundary>' +
'<ogc:Literal>100</ogc:Literal>' +
'</ogc:UpperBoundary>' +
'</ogc:PropertyIsBetween>' +
'</ogc:Filter>';
var parser = new OpenLayers.Format.Filter.v1();
var xml = new OpenLayers.Format.XML();
var filter = parser.read(xml.read(test_xml).documentElement);
t.eq(filter.type, OpenLayers.Filter.Comparison.BETWEEN,
"read correct type");
t.eq(filter.lowerBoundary, 0,
"record correct lower boundary value");
t.eq(filter.upperBoundary, 100,
"record correct upper boundary value");
}
function test_Intersects(t) {