Skip to content

Commit

Permalink
Test dynamic OpenGL on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
barche committed Aug 15, 2020
1 parent 2d23b7b commit b360036
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/test-win-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ jobs:
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- run: julia --color=yes --project -e 'using Pkg; pkg"add https://github.com/barche/Qt_jll.jl.git"'
- run: julia --color=yes --project -e 'using Pkg; pkg"add https://github.com/barche/jlqml_jll.jl.git"'
- run: julia --color=yes --project -e 'using Pkg; pkg"add https://github.com/barche/Mesa_jll.jl.git"'
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
env:
QT_QUICK_BACKEND: software

QT_LOGGING_RULES: "*.debug=true;qt.qpa.input*.debug=false;qt.scenegraph.general=true;qt.qpa.gl=true"
12 changes: 12 additions & 0 deletions src/QML.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export QPainter, device, width, height, logicalDpiX, logicalDpiY, QQuickWindow,
export @emit, @qmlfunction, qmlfunction, load, QQmlPropertyMap
export set_context_property
export QUrlFromLocalFile
export qputenv, qgetenv, qunsetenv

# TODO: Document: init_application, init_qmlapplicationengine
# TODO: Document painter: device, effectiveDevicePixelRatio, height, JuliaCanvas, JuliaPaintedItem, logicalDpiX, logicalDpiY, width, window
Expand Down Expand Up @@ -78,6 +79,10 @@ end
end
end

@static if Sys.iswindows()
using Mesa_jll
end

function __init__()
@initcxx
FileIO.add_format(format"QML", (), ".qml")
Expand All @@ -87,6 +92,13 @@ function __init__()
end

@require Makie="ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" include(joinpath(@__DIR__, "makie_support.jl"))

# Make sure Qt can find the Mesa dll if it doesn't find a compatible OpenGL implementation
@static if Sys.iswindows()
@show Mesa_jll.opengl32sw
@show isfile(Mesa_jll.opengl32sw)
qputenv("PATH", QByteArray(ENV["PATH"] * ";" * dirname(Mesa_jll.opengl32sw)))
end
end

# QString
Expand Down
11 changes: 11 additions & 0 deletions test/environmment.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using CxxWrap
using QML
using Test

let key = "__QML_TESTVAR", val = "TestStr"
qputenv(key, QByteArray(val))
@test ENV[key] == val
@test QML.to_string(qgetenv(key)) == val
qunsetenv(key)
@test !haskey(ENV, key)
end
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ using Test
import QML
using Documenter: doctest

doctest(QML, fix=true)

excluded = ["runtests.jl", "qml", "include"]

testfiles = filter(fname -> fname excluded, readdir())
Expand All @@ -15,3 +13,5 @@ testfiles = filter(fname -> fname ∉ excluded, readdir())
include(f)
end
end

# doctest(QML, fix=true)

0 comments on commit b360036

Please sign in to comment.