Avoid examining converted type after using TypeConverter. Add ArgumentAttributed...
authorAtsushi Eno <atsushi@ximian.com>
Wed, 17 Nov 2010 20:37:18 +0000 (05:37 +0900)
committerAtsushi Eno <atsushi@ximian.com>
Wed, 17 Nov 2010 20:37:18 +0000 (05:37 +0900)
mcs/class/System.Xaml/System.Xaml/XamlObjectWriter.cs
mcs/class/System.Xaml/Test/System.Xaml/XamlObjectReaderTest.cs
mcs/class/System.Xaml/Test/System.Xaml/XamlObjectWriterTest.cs
mcs/class/System.Xaml/Test/System.Xaml/XamlXmlReaderTest.cs

index 254e02d85b83340e2a7331492e03e229d24dec28..964a8a90346579bbd153ed008ab5c22ffc578c16 100644 (file)
@@ -250,8 +250,7 @@ namespace System.Xaml
                                var tc = xt.TypeConverter.ConverterInstance;
                                if (tc != null && tc.CanConvertFrom (value.GetType ()))
                                        value = tc.ConvertFrom (value);
-                               if (IsAllowedType (xt, value))
-                                       return value;
+                               return value;
                        }
 
                        throw new XamlObjectWriterException (String.Format ("Value '{1}' (of type {2}) is not of or convertible to type {0}", xt, value, value != null ? (object) value.GetType () : "(null)"));
index d4b065cc1ec92731d13252b3d3735f669c1c81be..cfd8ced1a053c118e29d8545df01943c5fb38238 100755 (executable)
@@ -1137,15 +1137,12 @@ namespace MonoTests.System.Xaml
                        Read_CustomMarkupExtension6 (r);
                }
 
-               [Test] // not commonized
+               [Test]
                public void Read_ArgumentAttributed ()
                {
                        var obj = new ArgumentAttributed ("foo", "bar");
                        var r = new XamlObjectReader (obj);
-                       Read_CommonClrType (r, obj, new KeyValuePair<string,string> ("x", XamlLanguage.Xaml2006Namespace));
-                       var args = Read_AttributedArguments_String (r, new string [] {"arg1", "arg2"});
-                       Assert.AreEqual ("foo", args [0], "#1");
-                       Assert.AreEqual ("bar", args [1], "#2");
+                       Read_ArgumentAttributed (r, obj);
                }
        }
 
@@ -1320,6 +1317,18 @@ namespace MonoTests.System.Xaml
                        Assert.IsFalse (r.Read (), "#9");
                }
 
+               protected void Read_ArgumentAttributed (XamlReader r, object obj)
+               {
+                       Read_CommonClrType (r, obj, new KeyValuePair<string,string> ("x", XamlLanguage.Xaml2006Namespace));
+
+                       if (r is XamlXmlReader)
+                               ReadBase (r);
+
+                       var args = Read_AttributedArguments_String (r, new string [] {"arg1", "arg2"});
+                       Assert.AreEqual ("foo", args [0], "#1");
+                       Assert.AreEqual ("bar", args [1], "#2");
+               }
+
                protected void Read_Dictionary (XamlReader r)
                {
                        Assert.IsTrue (r.Read (), "ns#1-1");
index cf0609c75be203aa1ee8f87ea9acf8d4fea50f4f..ba714001471ff04340820a3b10fe1b080832d6b4 100755 (executable)
@@ -1044,7 +1044,6 @@ namespace MonoTests.System.Xaml
                }
 
                [Test]
-               [Category ("NotWorking")]
                public void Write_MyExtension3 ()
                {
                        //var obj = new MyExtension3 () { Foo = typeof (int), Bar = "v2"};
index c3d18bf1c9401818cbe2571e5512411c75c529aa..8cf9b36634c7f5a6d2e4030a7d8c6196e5178e8e 100755 (executable)
@@ -438,6 +438,14 @@ namespace MonoTests.System.Xaml
                        Read_CustomMarkupExtension6 (r);
                }
 
+               [Test]
+               public void Read_ArgumentAttributed ()
+               {
+                       var obj = new ArgumentAttributed ("foo", "bar");
+                       var r = GetReader ("ArgumentAttributed.xml");
+                       Read_ArgumentAttributed (r, obj);
+               }
+
                [Test]
                public void Read_Dictionary ()
                {