Beispiel #1
0
        public void ConstructorException2Test2()
        {
            using (Stream stream = new FileStream(NanoDigiPath, FileMode.Open, FileAccess.Read, FileShare.Read))
            using (FontLoader font = new FontLoader(stream, -1)) { }

            Assert.Fail();
        }
Beispiel #2
0
 public void ConstructorTest1()
 {
     using (FontLoader font = new FontLoader(NanoDigiPath))
     {
         Assert.IsNotNull(font.Families);
         Assert.AreEqual(1, font.Families.Count);
         Assert.AreEqual(NanoDigiFontName, font.Families[0].Name);
     }
 }
Beispiel #3
0
 public void ConstructorTest2()
 {
     using (Stream stream = new FileStream(NanoDigiPath, FileMode.Open, FileAccess.Read, FileShare.Read))
     using (FontLoader font = new FontLoader(stream, (int)stream.Length))
     {
         Assert.IsNotNull(font.Families);
         Assert.AreEqual(1, font.Families.Count);
         Assert.AreEqual(NanoDigiFontName, font.Families[0].Name);
     }
 }
        public void FontGetTest()
        {
            const int LineHeight = 10;

            using (FontLoader fontLoader = new FontLoader(NanoDigiPath))
            using (Font font = new Font(fontLoader.Families[0], 10.0f))
            using (TextRendererOptions options = new TextRendererOptions(font, LineHeight))
            {
                Assert.IsNotNull(options.Font);
                Assert.AreEqual(font, options.Font);
            }
        }
        public void FormatGetExceptionTest()
        {
            const int LineHeight = 10;
            TextRendererOptions options = null;

            using (FontLoader fontLoader = new FontLoader(NanoDigiPath))
            using (Font font = new Font(fontLoader.Families[0], 10.0f))
            using (options = new TextRendererOptions(font, LineHeight)) { }

            if (options == null)
                Assert.Fail();
            else
            {
                var format = options.Format;
            }
        }
Beispiel #6
0
        public void FamiliesExceptionTest()
        {
            FontLoader loader = null;
            try
            {
                loader = new FontLoader(NanoDigiPath);
            }
            finally
            {
                if (loader != null)
                {
                    loader.Dispose();

                    // Fire!
                    var families = loader.Families;

                    loader = null;
                }
                else
                {
                    Assert.Fail();
                }
            }
        }
Beispiel #7
0
        public void ConstructorExceptionTest1()
        {
            using (FontLoader font = new FontLoader(null)) { }

            Assert.Fail();
        }
Beispiel #8
0
 public void IsDisposedTest()
 {
     FontLoader loader = null;
     try
     {
         loader = new FontLoader(NanoDigiPath);
         Assert.IsFalse(loader.IsDisposed);
     }
     finally
     {
         if (loader != null)
         {
             loader.Dispose();
             Assert.IsTrue(loader.IsDisposed);
             loader = null;
         }
     }
 }
        public void ShadowIndexTest()
        {
            const int LineHeight = 10;

            using (FontLoader fontLoader = new FontLoader(NanoDigiPath))
            using (Font font = new Font(fontLoader.Families[0], 10.0f))
            using (TextRendererOptions options = new TextRendererOptions(font, LineHeight))
            {
                Assert.AreEqual(0, options.ShadowIndex);

                options.ShadowIndex = 3;
                Assert.AreEqual(3, options.ShadowIndex);
            }
        }
        public void LineHeightSetTest()
        {
            const int LineHeight = 10;
            const int LineHeightModified = 12;

            using (FontLoader fontLoader = new FontLoader(NanoDigiPath))
            using (Font font = new Font(fontLoader.Families[0], 10.0f))
            using (TextRendererOptions options = new TextRendererOptions(font, LineHeight))
            {
                options.LineHeight = LineHeightModified;
                Assert.AreEqual(LineHeightModified, (int)options.LineHeight);
            }
        }
        public void FormatSetExceptionTest1()
        {
            const int LineHeight = 10;

            using (FontLoader fontLoader = new FontLoader(NanoDigiPath))
            using (Font font = new Font(fontLoader.Families[0], 10.0f))
            using (TextRendererOptions options = new TextRendererOptions(font, LineHeight))
                options.Format = null;
        }