Просмотр исходного кода

* Fix destreaming

git-svn-id: trunk@35565 -
michael 8 лет назад
Родитель
Сommit
53c40371ff
2 измененных файлов с 28 добавлено и 1 удалено
  1. 1 1
      packages/fcl-json/src/fpjsonrtti.pp
  2. 27 0
      packages/fcl-json/tests/testjsonrtti.pp

+ 1 - 1
packages/fcl-json/src/fpjsonrtti.pp

@@ -524,7 +524,7 @@ begin
     try
       For I:=0 to PIL.Count-1 do
         begin
-        J:=JSON.IndexOfName(Pil.Items[i]^.Name,FCaseInsensitive);
+        J:=JSON.IndexOfName(Pil.Items[i]^.Name,(jdoCaseInsensitive in Options));
         If (J<>-1) then
           RestoreProperty(AObject,PIL.Items[i],JSON.Items[J]);
         end;

+ 27 - 0
packages/fcl-json/tests/testjsonrtti.pp

@@ -140,6 +140,8 @@ type
     procedure TestEmpty;
     procedure TestBoolean;
     procedure TestInteger;
+    procedure TestIntegerCaseInsensitive;
+    procedure TestIntegerCaseSensitive;
     procedure TestString;
     procedure TestFloat;
     procedure TestFloat2;
@@ -318,6 +320,31 @@ begin
   AssertEquals('Correct integer value',22,B.IntProp);
 end;
 
+procedure TTestJSONDeStreamer.TestIntegerCaseInsensitive;
+
+Var
+  B : TIntegerComponent;
+
+begin
+  DS.Options:=DS.Options+[jdoCaseInsensitive];
+  B:=TIntegerComponent.Create(Nil);
+  DeStream('{ "intprop" : 22 }',B);
+  AssertEquals('Correct integer value',22,B.IntProp);
+end;
+
+procedure TTestJSONDeStreamer.TestIntegerCaseSensitive;
+
+Var
+  B : TIntegerComponent;
+
+begin
+  DS.Options:=DS.Options;
+  B:=TIntegerComponent.Create(Nil);
+  B.IntProp:=0;
+  DeStream('{ "intprop" : 22 }',B);
+  AssertEquals('Correct integer value not reas',0,B.IntProp);
+end;
+
 procedure TTestJSONDeStreamer.TestString;
 
 Var