From ea29eb439f66b8a9dd8affa42c9abd06d67922e2 Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 15 Nov 2008 22:35:36 +0000 Subject: [PATCH] * Test for default of property override: default of parent must be preserved git-svn-id: trunk@12117 - --- .gitattributes | 1 + tests/tbs/tb0557.pp | 48 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 tests/tbs/tb0557.pp diff --git a/.gitattributes b/.gitattributes index 1c6a8b0c5a..3dc5676d55 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7136,6 +7136,7 @@ tests/tbs/tb0553.pp svneol=native#text/plain tests/tbs/tb0554.pp svneol=native#text/plain tests/tbs/tb0555.pp svneol=native#text/plain tests/tbs/tb0556.pp svneol=native#text/plain +tests/tbs/tb0557.pp svneol=native#text/plain tests/tbs/tb205.pp svneol=native#text/plain tests/tbs/ub0060.pp svneol=native#text/plain tests/tbs/ub0069.pp svneol=native#text/plain diff --git a/tests/tbs/tb0557.pp b/tests/tbs/tb0557.pp new file mode 100644 index 0000000000..28a393088f --- /dev/null +++ b/tests/tbs/tb0557.pp @@ -0,0 +1,48 @@ +program rtti; + +{$ifdef fpc} +{$mode objfpc}{$H+} +{$apptype console} +{$endif} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Classes, typinfo + { you can add units after this }; + +type + { TSomeBaseClass } + + TSomeBaseClass = class(TPersistent) + private + FSomeProperty: Integer; + public + property SomeProperty: Integer read FSomeProperty write FSomeProperty default 10; + end; + + { TSomeDerivedClass } + + TSomeDerivedClass = class(TSomeBaseClass) + private + FOwnProperty: Integer; + published + property SomeProperty; + property OwnProperty: Integer read FOwnProperty write FOwnProperty default 11; + end; + +var + BC : TSomeBaseClass; + DC: TSomeDerivedClass; + Info: PPropInfo; +begin + DC := TSomeDerivedClass.Create; + Info := GetPropInfo(DC, 'SomeProperty'); + if (Info^.Default<>10) then + Halt(1); + Info := GetPropInfo(DC, 'OwnProperty'); + if Info^.Default<>11 then + Halt(2); +end. +