diff options
author | Alexander Köplinger <alex.koeplinger@outlook.com> | 2018-09-27 22:36:24 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2018-09-27 23:47:13 +0300 |
commit | ebfcbad23204c4af7124923a3391fc480c9da6ef (patch) | |
tree | 860beaa085ef8030ac5a0a5ea8642d4f8c2bcfe2 /mcs/class | |
parent | bf6bc36b2ef63d5b43f5e639d1bc097aee633c2b (diff) |
[System.Xaml] Switch tests to use embedded test resources
Diffstat (limited to 'mcs/class')
6 files changed, 20 insertions, 10 deletions
diff --git a/mcs/class/System.Xaml/Makefile b/mcs/class/System.Xaml/Makefile index 5f96dcbd7d7..1651967c3cd 100644 --- a/mcs/class/System.Xaml/Makefile +++ b/mcs/class/System.Xaml/Makefile @@ -8,12 +8,13 @@ LIBRARY = System.Xaml.dll LIB_REFS = System System.Xml System.Core LIB_MCS_FLAGS = $(RESOURCE_FILES:%=/resource:%) -TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) +TEST_RESOURCE_FILES = \ + $(wildcard Test/XmlFiles/*.xml) \ + $(wildcard Test/XmlFiles/*.xaml) -EXTRA_DISTFILES = $(RESOURCE_FILES) $(TEST_EXTRA_DISTFILES) -TEST_EXTRA_DISTFILES = \ - Test/XmlFiles/*.xml \ - Test/XmlFiles/*.xaml +TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) $(foreach r, $(TEST_RESOURCE_FILES), -resource:$(r),$(r)) + +EXTRA_DISTFILES = $(RESOURCE_FILES) $(TEST_RESOURCE_FILES) VALID_PROFILE := $(filter 4, $(FRAMEWORK_VERSION_MAJOR)) ifndef VALID_PROFILE diff --git a/mcs/class/System.Xaml/System.Xaml_test.dll.sources b/mcs/class/System.Xaml/System.Xaml_test.dll.sources index 7ff9a23002a..32a59af7058 100644 --- a/mcs/class/System.Xaml/System.Xaml_test.dll.sources +++ b/mcs/class/System.Xaml/System.Xaml_test.dll.sources @@ -1,3 +1,4 @@ +../../test-helpers/TestResourceHelper.cs System.Windows.Markup/ArrayExtensionTest.cs System.Windows.Markup/ReferenceTest.cs System.Windows.Markup/StaticExtensionTest.cs diff --git a/mcs/class/System.Xaml/Test/System.Xaml/XamlBackgroundReaderTest.cs b/mcs/class/System.Xaml/Test/System.Xaml/XamlBackgroundReaderTest.cs index 5f40fe552cf..46527975758 100644 --- a/mcs/class/System.Xaml/Test/System.Xaml/XamlBackgroundReaderTest.cs +++ b/mcs/class/System.Xaml/Test/System.Xaml/XamlBackgroundReaderTest.cs @@ -35,6 +35,8 @@ using NUnit.Framework; using CategoryAttribute = NUnit.Framework.CategoryAttribute; +using MonoTests.Helpers; + namespace MonoTests.System.Xaml { [TestFixture] @@ -42,7 +44,7 @@ namespace MonoTests.System.Xaml { XamlReader GetReader (string filename) { - return new XamlXmlReader (XmlReader.Create (Path.Combine ("Test/XmlFiles", filename), new XmlReaderSettings () { CloseInput =true })); + return new XamlXmlReader (XmlReader.Create (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/" + filename), new XmlReaderSettings () { CloseInput =true })); } void ReadTest (string filename) diff --git a/mcs/class/System.Xaml/Test/System.Xaml/XamlObjectWriterTest.cs b/mcs/class/System.Xaml/Test/System.Xaml/XamlObjectWriterTest.cs index 1aadbebcbb4..fc462dc22e9 100755 --- a/mcs/class/System.Xaml/Test/System.Xaml/XamlObjectWriterTest.cs +++ b/mcs/class/System.Xaml/Test/System.Xaml/XamlObjectWriterTest.cs @@ -35,6 +35,8 @@ using NUnit.Framework; using CategoryAttribute = NUnit.Framework.CategoryAttribute; +using MonoTests.Helpers; + namespace MonoTests.System.Xaml { [TestFixture] @@ -835,7 +837,7 @@ namespace MonoTests.System.Xaml XamlReader GetReader (string filename) { const string ver = "net_4_x"; - string xml = File.ReadAllText (Path.Combine ("Test/XmlFiles", filename)).Replace ("System.Xaml_test_net_4_0", ver + "_System.Xaml_test"); + string xml = File.ReadAllText (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/" + filename)).Replace ("System.Xaml_test_net_4_0", ver + "_System.Xaml_test"); return new XamlXmlReader (XmlReader.Create (new StringReader (xml))); } diff --git a/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlReaderTest.cs b/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlReaderTest.cs index 85a4a59e286..b2d90b00e0c 100755 --- a/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlReaderTest.cs +++ b/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlReaderTest.cs @@ -36,6 +36,8 @@ using NUnit.Framework; using CategoryAttribute = NUnit.Framework.CategoryAttribute; +using MonoTests.Helpers; + namespace MonoTests.System.Xaml { [TestFixture] @@ -46,7 +48,7 @@ namespace MonoTests.System.Xaml XamlReader GetReader (string filename) { const string ver = "net_4_x"; - string xml = File.ReadAllText (Path.Combine ("Test/XmlFiles", filename)).Replace ("System.Xaml_test_net_4_0", ver + "_System.Xaml_test"); + string xml = File.ReadAllText (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/" + filename)).Replace ("System.Xaml_test_net_4_0", ver + "_System.Xaml_test"); return new XamlXmlReader (XmlReader.Create (new StringReader (xml))); } @@ -722,7 +724,7 @@ namespace MonoTests.System.Xaml [Test] public void Bug680385 () { - XamlServices.Load ("Test/XmlFiles/CurrentVersion.xaml"); + XamlServices.Load (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/CurrentVersion.xaml")); } #endregion } diff --git a/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlWriterTest.cs b/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlWriterTest.cs index e46771c9b31..e0fe218af54 100755 --- a/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlWriterTest.cs +++ b/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlWriterTest.cs @@ -34,6 +34,8 @@ using NUnit.Framework; using CategoryAttribute = NUnit.Framework.CategoryAttribute; +using MonoTests.Helpers; + namespace MonoTests.System.Xaml { [TestFixture] @@ -637,7 +639,7 @@ namespace MonoTests.System.Xaml string ReadXml (string name) { string ver = "net_4_x"; - return File.ReadAllText ("Test/XmlFiles/" + name).Trim ().Replace (">\n", ">\r\n").Replace ("System.Xaml_test_net_4_0", ver + "_System.Xaml_test").Replace ("\r\n", Environment.NewLine); + return File.ReadAllText (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/" + name)).Trim ().Replace (">\n", ">\r\n").Replace ("System.Xaml_test_net_4_0", ver + "_System.Xaml_test").Replace ("\r\n", Environment.NewLine); } [Test] |