This commit is contained in:
Matthew Leibowitz 2017-04-23 06:51:10 -04:00
Родитель 0aa845e001
Коммит 282d705aba
1 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -71,30 +71,30 @@ namespace SkiaSharp.Tests
{ {
using (var bitmap = new SKBitmap(new SKImageInfo(200, 200))) using (var bitmap = new SKBitmap(new SKImageInfo(200, 200)))
using (var canvas = new SKCanvas(bitmap)) using (var canvas = new SKCanvas(bitmap))
using (var tf = SKTypeface.FromFamilyName("Arial Black")) using (var tf = SKTypeface.FromFamilyName("Arial"))
using (var paint = new SKPaint { TextSize = 50, IsAntialias = true, Typeface = tf }) using (var paint = new SKPaint { TextSize = 50, IsAntialias = true, Typeface = tf })
{ {
canvas.Clear(SKColors.White); canvas.Clear(SKColors.White);
canvas.Scale(1, 2); canvas.Scale(1, 2);
canvas.DrawText("Skia", 10, 60, paint); canvas.DrawText("Skia", 10, 60, paint);
Assert.AreEqual(SKColors.Black, bitmap.GetPixel(53, 86), "Antialias (1)"); Assert.AreEqual(SKColors.Black, bitmap.GetPixel(49, 92), "Antialias (1)");
Assert.AreEqual(SKColors.White, bitmap.GetPixel(87, 64), "Antialias (2)"); Assert.AreEqual(SKColors.White, bitmap.GetPixel(73, 63), "Antialias (2)");
Assert.AreEqual(SKColors.Black, bitmap.GetPixel(121, 86), "Antialias (3)"); Assert.AreEqual(SKColors.Black, bitmap.GetPixel(100, 89), "Antialias (3)");
} }
using (var bitmap = new SKBitmap(new SKImageInfo(200, 200))) using (var bitmap = new SKBitmap(new SKImageInfo(200, 200)))
using (var canvas = new SKCanvas(bitmap)) using (var canvas = new SKCanvas(bitmap))
using (var tf = SKTypeface.FromFamilyName("Arial Black")) using (var tf = SKTypeface.FromFamilyName("Arial"))
using (var paint = new SKPaint { TextSize = 50, Typeface = tf }) using (var paint = new SKPaint { TextSize = 50, Typeface = tf })
{ {
canvas.Clear(SKColors.White); canvas.Clear(SKColors.White);
canvas.Scale(1, 2); canvas.Scale(1, 2);
canvas.DrawText("Skia", 10, 60, paint); canvas.DrawText("Skia", 10, 60, paint);
Assert.AreEqual(SKColors.Black, bitmap.GetPixel(53, 86), "Non-Antialias (1)"); Assert.AreEqual(SKColors.Black, bitmap.GetPixel(49, 92), "Non-Antialias (1)");
Assert.AreEqual(SKColors.White, bitmap.GetPixel(87, 64), "Non-Antialias (2)"); Assert.AreEqual(SKColors.White, bitmap.GetPixel(73, 63), "Non-Antialias (2)");
Assert.AreEqual(SKColors.Black, bitmap.GetPixel(121, 86), "Non-Antialias (3)"); Assert.AreEqual(SKColors.Black, bitmap.GetPixel(100, 89), "Non-Antialias (3)");
} }
} }
} }