2007-03-16 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Fri, 16 Mar 2007 11:45:14 +0000 (11:45 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Fri, 16 Mar 2007 11:45:14 +0000 (11:45 -0000)
* SystemFontsTest.cs: Avoid failures (ignore tests) if no fonts are
available on the system.

svn path=/trunk/mcs/; revision=74460

mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
mcs/class/System.Drawing/Test/System.Drawing/SystemFontsTest.cs

index 56cdcf9208f128e5aa62161314dacc3563421c85..554f1280beb75ff27e716a8bb52780b398465529 100644 (file)
@@ -1,3 +1,8 @@
+2007-03-16  Sebastien Pouliot  <sebastien@ximian.com> 
+
+       * SystemFontsTest.cs: Avoid failures (ignore tests) if no fonts are 
+       available on the system.
+
 2007-03-15  Sebastien Pouliot  <sebastien@ximian.com> 
 
        * ColorConverter.cs: Merge ConvertFrom_NotWorking with ConvertFrom as
index c88ad598d6837be4e4da1548a2a6f814e67d3db3..47c00ac3d6e3bf48c448d3da83c531c25507c5e8 100644 (file)
@@ -39,6 +39,28 @@ namespace MonoTests.System.Drawing {
        [TestFixture]
        public class SystemFontsTest {
 
+               // avoid lots of failures if no fonts are available (e.g. headless systems)
+               static bool font_available;
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       try {
+                               Font f = SystemFonts.DefaultFont;
+                               font_available = true;
+                       }
+                       catch (ArgumentException) {
+                               font_available = false;
+                       }
+               }
+
+               [SetUp]
+               public void SetUp ()
+               {
+                       if (!font_available)
+                               Assert.Ignore ("No font family could be found.");
+               }
+
                [Test]
                public void DefaultFont ()
                {