Problem
SKFontTest.cs has 27 test methods that create new SKFont(...) without a using declaration, leaking the native Skia font handle when the test completes. The file already uses using var font = new SKFont() in 14 other tests, so the inconsistency is clear.
Location
- File(s):
tests/Tests/SkiaSharp/SKFontTest.cs
- Line(s): 83, 112, 125, 143, 154, 164, 183, 194, 217, 229, 242, 250, 258, 276, and others
Current Code
var font = new SKFont(SKTypeface.Default);
var widths = font.GetGlyphWidths("Hello World!", out var bounds);
// ... assertions ...
Suggested Fix
using var font = new SKFont(SKTypeface.Default);
var widths = font.GetGlyphWidths("Hello World!", out var bounds);
// ... assertions ...
Apply the same pattern to all ~27 instances in this file where var font = new SKFont(...) appears without using. The fix is purely mechanical: add using before var on each declaration.
SkiaSharp Guidelines
Acceptance Criteria
Part of #3976
Generated by Nightly Fix Finder · ● 4.5M · ◷
Problem
SKFontTest.cshas 27 test methods that createnew SKFont(...)without ausingdeclaration, leaking the native Skia font handle when the test completes. The file already usesusing var font = new SKFont()in 14 other tests, so the inconsistency is clear.Location
tests/Tests/SkiaSharp/SKFontTest.csCurrent Code
Suggested Fix
Apply the same pattern to all ~27 instances in this file where
var font = new SKFont(...)appears withoutusing. The fix is purely mechanical: addusingbeforevaron each declaration.SkiaSharp Guidelines
*.generated.csfile#ifguardsAcceptance Criteria
var font = new SKFont(...)declarations inSKFontTest.csuseusing var font = new SKFont(...)usingkeyword is addeddotnet test tests/SkiaSharp.Tests.Console/SkiaSharp.Tests.Console.csprojPart of #3976