diff options
author | Atsushi Eno <atsushi@ximian.com> | 2011-01-20 10:59:05 +0300 |
---|---|---|
committer | Atsushi Eno <atsushi@ximian.com> | 2011-01-20 10:59:05 +0300 |
commit | bdef99df3450df5192c8266b42623b6d4bb208d2 (patch) | |
tree | f62e91a56e92fc30bc309cafd513a7811dab09cc /mcs/class/System.Xaml | |
parent | 4a5f7c742c650c001a25cc5c60bcb852f155cca5 (diff) |
finish XamlType.BaseType implementation.
Diffstat (limited to 'mcs/class/System.Xaml')
-rwxr-xr-x | mcs/class/System.Xaml/System.Xaml/XamlType.cs | 6 | ||||
-rwxr-xr-x | mcs/class/System.Xaml/Test/System.Xaml/XamlLanguageTest.cs | 1 | ||||
-rwxr-xr-x | mcs/class/System.Xaml/Test/System.Xaml/XamlTypeTest.cs | 10 |
3 files changed, 13 insertions, 4 deletions
diff --git a/mcs/class/System.Xaml/System.Xaml/XamlType.cs b/mcs/class/System.Xaml/System.Xaml/XamlType.cs index ac31f2cddc9..bcde76a6e51 100755 --- a/mcs/class/System.Xaml/System.Xaml/XamlType.cs +++ b/mcs/class/System.Xaml/System.Xaml/XamlType.cs @@ -508,15 +508,13 @@ namespace System.Xaml return GetAllAttachableMembers ().FirstOrDefault (m => m.Name == name); } - [MonoTODO] protected virtual XamlType LookupBaseType () { if (base_type == null) { if (UnderlyingType == null) - // FIXME: probably something advanced is needed here. - base_type = new XamlType (typeof (object), SchemaContext, Invoker); + base_type = SchemaContext.GetXamlType (typeof (object)); else - base_type = type.BaseType == null || type.BaseType == typeof (object) ? null : new XamlType (type.BaseType, SchemaContext, Invoker); + base_type = type.BaseType == null || type.BaseType == typeof (object) ? null : SchemaContext.GetXamlType (type.BaseType); } return base_type; } diff --git a/mcs/class/System.Xaml/Test/System.Xaml/XamlLanguageTest.cs b/mcs/class/System.Xaml/Test/System.Xaml/XamlLanguageTest.cs index 82bc3033a54..d1e4214fda6 100755 --- a/mcs/class/System.Xaml/Test/System.Xaml/XamlLanguageTest.cs +++ b/mcs/class/System.Xaml/Test/System.Xaml/XamlLanguageTest.cs @@ -565,6 +565,7 @@ namespace MonoTests.System.Xaml { var t = XamlLanguage.Object; TestXamlTypePrimitive (t, "Object", typeof (object), true, false); + Assert.IsNull (t.BaseType, "#x1"); /* Those properties are pointless regarding practical use. Those "members" does not participate in serialization. var l = t.GetAllAttachableMembers ().ToArray (); diff --git a/mcs/class/System.Xaml/Test/System.Xaml/XamlTypeTest.cs b/mcs/class/System.Xaml/Test/System.Xaml/XamlTypeTest.cs index db9df1dc9a9..59f4025453e 100755 --- a/mcs/class/System.Xaml/Test/System.Xaml/XamlTypeTest.cs +++ b/mcs/class/System.Xaml/Test/System.Xaml/XamlTypeTest.cs @@ -783,6 +783,16 @@ namespace MonoTests.System.Xaml Assert.IsNotNull (xm, "#1"); Assert.IsFalse (xm.IsWritePublic, "#2"); } + + [Test] + public void UnknownType () + { + var xt = new XamlType ("urn:foo", "MyUnknown", null, sctx); + Assert.IsTrue (xt.IsUnknown, "#1"); + Assert.IsNotNull (xt.BaseType, "#2"); + Assert.IsFalse (xt.BaseType.IsUnknown, "#3"); + Assert.AreEqual (typeof (object), xt.BaseType.UnderlyingType, "#4"); + } } class MyXamlType : XamlType |