-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from Gnimuc/tests
Add some real tests
- Loading branch information
Showing
4 changed files
with
81 additions
and
24 deletions.
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 |
---|---|---|
|
@@ -36,10 +36,14 @@ jobs: | |
arch: ${{ matrix.arch }} | ||
- uses: julia-actions/cache@v2 | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
- uses: julia-actions/julia-runtest@v1 | ||
- uses: julia-actions/[email protected] | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
# We add ModernGL and GLFW so that the backend extensions will be loaded too | ||
- run: | | ||
julia --project=. -e ' | ||
using Pkg | ||
Pkg.add(["ModernGL", "GLFW"]) | ||
import CImGui, ModernGL, GLFW | ||
' | ||
tests: | ||
name: Tests - Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} | ||
|
@@ -68,9 +72,11 @@ jobs: | |
- uses: julia-actions/julia-runtest@v1 | ||
with: | ||
prefix: xvfb-run -a -s '-screen 0 1024x768x24' | ||
- uses: julia-actions/[email protected] | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
- uses: julia-actions/julia-processcoverage@v1 | ||
- uses: codecov/codecov-action@v4 | ||
with: | ||
files: lcov.info | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
docs: | ||
name: Documentation | ||
|
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
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,7 @@ | ||
[deps] | ||
CImGui = "5d785b6c-b76f-510e-a07c-3070796c7e87" | ||
GLFW = "f7f18e0c-5ee9-5ccd-a5bf-e8befd85ed98" | ||
ImGuiTestEngine = "464e2eba-0a11-4ed3-b274-413caa1a1cca" | ||
ModernGL = "66fc600b-dfda-50eb-8b99-91cfa97b1301" | ||
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" |
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,14 +1,71 @@ | ||
using CImGui | ||
using Test | ||
import CImGui as ig | ||
using ImGuiTestEngine | ||
import ImGuiTestEngine as te | ||
import ModernGL, GLFW | ||
|
||
@testset "CImGui.jl" begin | ||
# if CI only run if linux given xvfb is available in CI | ||
if !haskey(ENV, "CI") || Sys.islinux() && Sys.WORD_SIZE == 64 | ||
withenv("AUTO_CLOSE_DEMO" => "5") do | ||
include(joinpath("..", "demo", "demo.jl")) | ||
Base.invokelatest(official_demo) | ||
end | ||
else | ||
@warn "Tests not run" haskey(ENV, "CI") Sys.islinux() Sys.WORD_SIZE | ||
ig.set_backend(:GlfwOpenGL3) | ||
|
||
|
||
include(joinpath(@__DIR__, "../demo/demo.jl")) | ||
|
||
@testset "Official demo" begin | ||
@test ig.imgui_version() isa VersionNumber | ||
engine = te.CreateContext() | ||
|
||
@register_test(engine, "Official demo", "Hiding demo window") do ctx | ||
@imcheck GetWindowByRef("Dear ImGui Demo") != nothing | ||
|
||
SetRef("Hello, world!") | ||
ItemClick("Demo Window") # This should hide the demo window | ||
|
||
@imcheck GetWindowByRef("Dear ImGui Demo") == nothing | ||
end | ||
|
||
official_demo(; engine) | ||
|
||
te.DestroyContext(engine) | ||
end | ||
|
||
include(joinpath(@__DIR__, "../examples/demo.jl")) | ||
|
||
@testset "Julia demo" begin | ||
engine = te.CreateContext()#; exit_on_completion=false, show_test_window=true) | ||
# engine_io = te.GetIO(engine) | ||
# engine_io.ConfigRunSpeed = te.RunSpeed_Normal | ||
|
||
@register_test(engine, "Julia demo", "About window") do ctx | ||
SetRef("ImGui Demo") | ||
MenuClick("Help/About Dear ImGui") | ||
|
||
Yield() # Let it run another frame so that the new window can be drawn | ||
@imcheck GetWindowByRef("//About Dear ImGui") != nothing | ||
|
||
SetRef("About Dear ImGui") | ||
ItemCheck("Config\\/Build Information") | ||
end | ||
|
||
@register_test(engine, "Configuration", "ConfigFlags") do ctx | ||
SetRef("ImGui Demo") | ||
ItemClick("Configuration") | ||
ItemClick("Configuration##2") | ||
SetRef("ImGui Demo/Configuration##2") | ||
ItemCheck("io.ConfigFlags: NoMouse") | ||
end | ||
|
||
@register_test(engine, "Widgets", "Selectables") do ctx | ||
SetRef("ImGui Demo") | ||
ItemClick("Widgets") | ||
ItemClick("Selectables") | ||
ItemClick("Selectables/Basic") | ||
SetRef("ImGui Demo/Selectables/Basic") | ||
ItemDoubleClick("5. I am double clickable") | ||
|
||
SetRef("ImGui Demo") | ||
ItemClick("Plots Widgets") | ||
end | ||
|
||
julia_demo(; engine) | ||
|
||
te.DestroyContext(engine) | ||
end |