Пример #1
0
        public void ValidGetTypefacesHachiFile()
        {
            var path = new DirectoryInfo(System.Environment.CurrentDirectory);

            using (var reader = new TypefaceReader(path))
            {
                var file = new FileInfo(ValidateHachi.UrlPath);

                var faces = reader.GetFonts(file);
                Assert.IsNotNull(faces);

                var all = faces.ToArray();
                Assert.AreEqual(1, all.Length);

                ValidateHachi.AssertTypeface(all[0]);
            }
        }
Пример #2
0
        public void ValidGetTypefacesGillSansUrl()
        {
            var path = new Uri(ValidateGillSans.RootUrl);

            using (var reader = new TypefaceReader(path))
            {
                var url = new Uri(ValidateGillSans.UrlPath, UriKind.Relative);

                var faces = reader.GetFonts(url);
                Assert.IsNotNull(faces);

                var all = faces.ToArray();
                Assert.AreEqual(9, all.Length);

                ValidateGillSans.AssertTypefaces(all);
            }
        }
Пример #3
0
        public void ValidGetTypefacesHelveticaUrl()
        {
            var path = new Uri(ValidateHelvetica.RootUrl);

            using (var reader = new TypefaceReader(path))
            {
                var url = new Uri(ValidateHelvetica.UrlPath, UriKind.Relative);

                var faces = reader.GetFonts(url);
                Assert.IsNotNull(faces);

                var all = faces.ToArray();
                Assert.AreEqual(1, all.Length);

                ValidateHelvetica.AssertTypeface(all[0]);
            }
        }
Пример #4
0
        public void ValidGetTypefacesGillSansPath()
        {
            var path = new DirectoryInfo(System.Environment.CurrentDirectory);

            using (var reader = new TypefaceReader(path))
            {
                var url = new FileInfo(ValidateGillSans.UrlPath);

                var faces = reader.GetFonts(url);
                Assert.IsNotNull(faces);

                var all = faces.ToArray();
                Assert.AreEqual(9, all.Length);

                ValidateGillSans.AssertTypefaces(all);
            }
        }
        public void FailGetFontsFromRelativePath()
        {
            var path = new DirectoryInfo(System.Environment.CurrentDirectory);

            //Set the base url

            using (var reader = new TypefaceReader(path))
            {
                //Set the relative path
                var file = new FileInfo("INVALID/" + ValidateHelvetica.UrlPath);

                Assert.ThrowsException <TypefaceReadException>(() =>
                {
                    var faces = reader.GetFonts(file);

                    ValidateGillSans.AssertTypefaces(faces.ToArray());
                });
            }
        }