public async Task ValidGetFontHelveticaUrlInfoAndIndex() { var path = new Uri(ValidateHelvetica.RootUrl); using (var reader = new TypefaceReader(path)) { var file = new Uri(ValidateHelvetica.UrlPath, UriKind.Relative); var info = await reader.ReadTypefaceAsync(file); var face = await reader.GetFontAsync(info, 0); Assert.IsNotNull(face); ValidateHelvetica.AssertTypeface(face); } }
public async Task AsyncLoadFromRelativeUrlString() { ITypefaceInfo info; var path = RootUrl; using (var reader = new TypefaceReader(new Uri(path))) { //valid path path = UrlPath; info = await reader.ReadTypefaceAsync(path); Assert.IsNotNull(info, "Info was not returned"); Assert.IsTrue(string.IsNullOrEmpty(info.ErrorMessage), "An Error message was returned"); //check the info - but not the path ValidateHelvetica.AssertInfo(info, null, 6); } }
public async Task ValidGetFontHelveticaFileInfoAndIndex() { var path = new DirectoryInfo(System.Environment.CurrentDirectory); using (var reader = new TypefaceReader(path)) { var file = new FileInfo(ValidateHelvetica.UrlPath); var info = await reader.ReadTypefaceAsync(file); //Get the font with the info and an index of 0 var face = await reader.GetFontAsync(info, 0); Assert.IsNotNull(face); ValidateHelvetica.AssertTypeface(face); } }
public async Task AsyncLoadFromRelativeFile() { ITypefaceInfo info; var path = System.Environment.CurrentDirectory; using (var reader = new TypefaceReader(new DirectoryInfo(path))) { //valid path path = PartialFilePath; var file = new FileInfo(path); info = await reader.ReadTypefaceAsync(file); Assert.IsNotNull(info, "Info was not returned"); Assert.IsTrue(string.IsNullOrEmpty(info.ErrorMessage), "An Error message was returned"); //check the info - but not the path, as this will be changed ValidateHelvetica.AssertInfo(info, null, 7); } }
public async Task AsyncLoadFromAbsoluteUrl() { ITypefaceInfo info; using (var reader = new TypefaceReader()) { var path = RootUrl; //valid path path = path + UrlPath; var uri = new Uri(path); info = await reader.ReadTypefaceAsync(uri); Assert.IsNotNull(info, "Info was not returned"); Assert.IsTrue(string.IsNullOrEmpty(info.ErrorMessage), "An Error message was returned"); //check the info ValidateHelvetica.AssertInfo(info, path, 5); } }
public async Task ValidGetFontHelveticaUrlAndReference() { var path = new Uri(ValidateHelvetica.RootUrl); using (var reader = new TypefaceReader(path)) { var uri = new Uri(ValidateHelvetica.UrlPath, UriKind.Relative); var info = await reader.ReadTypefaceAsync(uri); var fref = info.Fonts[0]; //Load from a known url and a font reference var face = await reader.GetFontAsync(uri, fref); Assert.IsNotNull(face); ValidateHelvetica.AssertTypeface(face); } }
public async Task ValidGetFontGillSansSemiBoldItalicFileInfoAndReference() { var path = new DirectoryInfo(System.Environment.CurrentDirectory); using (var reader = new TypefaceReader(path)) { var file = new FileInfo(ValidateGillSans.UrlPath); var index = ValidateGillSans.SemiBoldItalicIndex; var info = await reader.ReadTypefaceAsync(file); var fref = info.Fonts[index]; //Load from a known file and a font reference var face = await reader.GetFontAsync(file, fref); Assert.IsNotNull(face); ValidateGillSans.AssertMatches(ValidateGillSans.FontTypefaces[index], face); } }
public async Task ValidGetFontGillSansBoldInfoAndRef() { var path = new DirectoryInfo(System.Environment.CurrentDirectory); using (var reader = new TypefaceReader(path)) { var file = new FileInfo(ValidateGillSans.UrlPath); var index = ValidateGillSans.BoldRegularIndex; var info = await reader.ReadTypefaceAsync(file); var fref = info.Fonts[index]; //Get the font with the info and the font reference var face = await reader.GetFontAsync(info, fref); Assert.IsNotNull(face); //Make sure the style matches var expected = ValidateGillSans.FontTypefaces[index]; ValidateGillSans.AssertMatches(expected, face); } }