Skip to content

Commit

Permalink
test passing String or FTFont to TextConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
ederag authored and rafaqz committed Feb 7, 2022
1 parent 8f46180 commit 9961bd8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion test/textconfig.jl
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

0 comments on commit 9961bd8

Please sign in to comment.