-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test passing String or FTFont to TextConfig
- Loading branch information
Showing
1 changed file
with
14 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
using DynamicGrids, Test | ||
using DynamicGrids, FreeTypeAbstraction, Test | ||
|
||
@testset "Fonts" begin | ||
@test DynamicGrids.autofont() isa String | ||
name = DynamicGrids.autofont() | ||
face = FreeTypeAbstraction.findfont(name) | ||
@testset "TextConfig accepts font as String" begin | ||
@test name isa String | ||
textconfig = TextConfig(; font=name) | ||
@test textconfig.face isa FreeTypeAbstraction.FTFont | ||
end | ||
@testset "TextConfig accepts font as FTFont" begin | ||
@test face isa FreeTypeAbstraction.FTFont | ||
textconfig = TextConfig(; font=face) | ||
@test textconfig.face === face | ||
end | ||
@test_throws ArgumentError TextConfig(; font="not_a_font") | ||
@test_throws ArgumentError TextConfig(; font=:not_a_string) | ||
end |