Skip to content

Commit

Permalink
Merge pull request #50 from bauglir/fix-theme-change-test-expectations
Browse files Browse the repository at this point in the history
Detect theme changes based on associated fonts
  • Loading branch information
bauglir authored Mar 12, 2024
2 parents fd2815d + 888574b commit 660a11c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: '1.7'
- name: Install dependencies
run: |
julia --project=docs -e '
Expand Down
6 changes: 3 additions & 3 deletions docs/architecture/workspace.dsl
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@ workspace {
}

views {
container kroki_jl {
container kroki_jl PackageContainers {
include *
autoLayout lr
}

component library {
component library PackageComponents {
include *
autoLayout bt
}

container kroki_service {
container kroki_service ServiceContainers {
include *
autoLayout tb
}
Expand Down
4 changes: 2 additions & 2 deletions docs/src/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ rendered from the set defined in the file.
structurizr_diagram = Diagram(
:structurizr;
path = joinpath(@__DIR__, "..", "architecture", "workspace.dsl"),
options = Dict("view-key" => "KrokiService-Container")
options = Dict("view-key" => "ServiceContainers")
)
```

Expand Down Expand Up @@ -218,7 +218,7 @@ end
DocumenterSvg(
render(
structurizr_diagram, "svg";
options = Dict("view-key" => "Krokijl-Krokijl-Component")
options = Dict("view-key" => "PackageComponents")
)
)
```
Expand Down
14 changes: 8 additions & 6 deletions test/kroki/rendering_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,25 @@ end
end

@testset "takes `options` into account" begin
expected_theme_name = "materia"
options = Dict{String, String}("theme" => expected_theme_name)
options = Dict{String, String}("theme" => "materia")
diagram = Diagram(:plantuml, "A -> B: C"; options)

# The most straightforward way to differentiate between the themes used
# for testing is by checking the associated fonts. The "Materia" theme
# relies on "Verdana", whereas the "Sketchy" theme relies on the
# handwritten look of "Segoe Print"
@testset "defaults to `Diagram` options" begin
rendered = String(render(diagram, "svg"))

@test occursin("!theme $(expected_theme_name)", rendered)
@test occursin("Verdana", rendered)
end

@testset "allows definition at render-time" begin
expected_overridden_theme = "sketchy"
rendered = String(
render(diagram, "svg"; options = Dict("theme" => expected_overridden_theme)),
render(diagram, "svg"; options = Dict{String, String}("theme" => "sketchy")),
)

@test occursin("!theme $(expected_overridden_theme)", rendered)
@test occursin("Segoe Print", rendered)
end
end
end
Expand Down

0 comments on commit 660a11c

Please sign in to comment.