Author: olivier Date: 2008-01-20 05:07:14 -0500 (Sun, 20 Jan 2008) New Revision: 93341
Modified: trunk/mcs/class/Managed.Windows.Forms/Test/System.Resources/ChangeLog trunk/mcs/class/Managed.Windows.Forms/Test/System.Resources/ResXResourceReaderTest.cs Log: 2008-01-20 Olivier Dufour <[EMAIL PROTECTED]> * ResXResourceReaderTest.cs: Add tests to check GetNodePosition. Modified: trunk/mcs/class/Managed.Windows.Forms/Test/System.Resources/ChangeLog =================================================================== --- trunk/mcs/class/Managed.Windows.Forms/Test/System.Resources/ChangeLog 2008-01-20 10:06:12 UTC (rev 93340) +++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Resources/ChangeLog 2008-01-20 10:07:14 UTC (rev 93341) @@ -1,7 +1,6 @@ -2007-12-01 Olivier Dufour <[EMAIL PROTECTED]> +2008-01-20 Olivier Dufour <[EMAIL PROTECTED]> - * ResXResourceReaderTest.cs: Add tests to check GetMetadataEnumerator - and UseResXDataNode in the reader. + * ResXResourceReaderTest.cs: Add tests to check GetNodePosition. 2007-05-23 Andreia Gaita <[EMAIL PROTECTED]> Modified: trunk/mcs/class/Managed.Windows.Forms/Test/System.Resources/ResXResourceReaderTest.cs =================================================================== --- trunk/mcs/class/Managed.Windows.Forms/Test/System.Resources/ResXResourceReaderTest.cs 2008-01-20 10:06:12 UTC (rev 93340) +++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Resources/ResXResourceReaderTest.cs 2008-01-20 10:07:14 UTC (rev 93341) @@ -3,6 +3,7 @@ // // Authors: // Gert Driesen <[EMAIL PROTECTED]> +// Olivier Dufour <[EMAIL PROTECTED]> // using System; @@ -16,6 +17,7 @@ using System.Xml; using NUnit.Framework; +using System.Reflection; namespace MonoTests.System.Resources { @@ -1473,6 +1475,7 @@ } #if NET_2_0 + [Test] public void useResXDataNodes () { @@ -1496,10 +1499,35 @@ ResXDataNode node = enumerator.Value as ResXDataNode; Assert.IsNotNull (node, "#A3"); Assert.AreEqual ("foo", node.Name, "#A4"); + Bitmap bitmap = node.GetValue (new AssemblyName[] {typeof (Bitmap).Assembly.GetName ()}) as Bitmap; + Assert.IsNotNull (bitmap, "#A5"); } } - //TODO assemblyNames + + [Test] + public void getPosition() + { + string refFile = Path.Combine (_tempDirectory, "32x32.ico"); + WriteEmbeddedResource ("32x32.ico", refFile); + string resxFile = Path.Combine (_tempDirectory, "resources.resx"); + using (StreamWriter sw = new StreamWriter (resxFile, false, Encoding.UTF8)) { + sw.Write (string.Format (CultureInfo.InvariantCulture, + _resXFileRefTemplate, ResXResourceWriter.ResMimeType, "1.0", + Consts.AssemblySystem_Windows_Forms, refFile, + typeof (Bitmap).AssemblyQualifiedName, string.Empty)); + } + + using (ResXResourceReader r = new ResXResourceReader (resxFile)) { + r.UseResXDataNodes = true; + IDictionaryEnumerator enumerator = r.GetEnumerator (); + enumerator.MoveNext (); + ResXDataNode node = enumerator.Value as ResXDataNode; + Assert.IsNotNull (node, "#A1"); + Assert.AreEqual(new Point(1, 1020), node.GetNodePosition (), "#A2"); + } + } + [Test] public void GetMetadataEnumerator () { @@ -1519,12 +1547,14 @@ enumerator.MoveNext (); Assert.IsNotNull (enumerator.Current, "#A1"); Assert.AreEqual ("panel_label.Locked", enumerator.Key, "#A2"); + Assert.AreEqual(typeof(bool), enumerator.Value.GetType(), "#A3"); bool flag = (bool)enumerator.Value; - Assert.IsNotNull (flag, "#A3"); Assert.AreEqual (true, flag, "#A4"); } } + #endif + [Test] public void TypeConversion () { _______________________________________________ Mono-patches maillist - Mono-patches@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-patches