diff --git a/WGLMakie/Project.toml b/WGLMakie/Project.toml index 37d99ac5f32..baed5de190d 100644 --- a/WGLMakie/Project.toml +++ b/WGLMakie/Project.toml @@ -20,7 +20,7 @@ ShaderAbstractions = "65257c39-d410-5151-9873-9b3e5be5013e" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [compat] -Bonito = "3.2.4, 4" +Bonito = "4" Colors = "0.11, 0.12, 0.13" FileIO = "1.1" FreeTypeAbstraction = "0.10" diff --git a/WGLMakie/test/runtests.jl b/WGLMakie/test/runtests.jl index f97f4463979..0032aa26cbd 100644 --- a/WGLMakie/test/runtests.jl +++ b/WGLMakie/test/runtests.jl @@ -45,20 +45,42 @@ end display(edisplay, app) GC.gc(true); # Somehow this may take a while to get emptied completely - Bonito.wait_for(() -> (GC.gc(true);isempty(run(edisplay.window, "Object.keys(WGL.plot_cache)")));timeout=20) + value = @time Bonito.wait_for(() -> (GC.gc(true); isempty(run(edisplay.window, "Object.keys(WGL.plot_cache)"))); timeout=200) + @show run(edisplay.window, "Object.keys(WGL.plot_cache)") + @test value == :success + + s_keys = "Object.keys(Bonito.Sessions.SESSIONS)" + value = @time Bonito.wait_for(() -> (GC.gc(true); length(run(edisplay.window, s_keys)) == 2); timeout=200) + @show run(edisplay.window, s_keys) + @show app.session[].id + @show app.session[].parent + @test value == :success + wgl_plots = run(edisplay.window, "Object.keys(WGL.scene_cache)") @test isempty(wgl_plots) session = edisplay.browserdisplay.handler.session session_size = Base.summarysize(session) / 10^6 texture_atlas_size = Base.summarysize(WGLMakie.TEXTURE_ATLAS) / 10^6 + + @test length(WGLMakie.TEXTURE_ATLAS.listeners) == 1 # Only one from permanent Retain + @test length(session.session_objects) == 1 # Also texture atlas because of Retain + @testset "Session fields empty" for field in [:on_document_load, :stylesheets, :imports, :message_queue, :deregister_callbacks, :inbox] + @test isempty(getfield(session, field)) + end + server = session.connection.server + @test length(server.websocket_routes.table) == 1 + @test server.websocket_routes.table[1][2] == session.connection + @test length(server.routes.table) == 2 + @test server.routes.table[1][1] == "/browser-display" + @test server.routes.table[2][2] isa HTTPAssetServer @show typeof.(last.(WGLMakie.TEXTURE_ATLAS.listeners)) @show length(WGLMakie.TEXTURE_ATLAS.listeners) @show session_size texture_atlas_size - @test session_size / 10^6 < 6 + + @test session_size < 6 @test texture_atlas_size < 6 - s_keys = "Object.keys(Bonito.Sessions.SESSIONS)" - Bonito.wait_for(() -> (GC.gc(true); 2 == length(run(edisplay.window, s_keys))); timeout=30) + js_sessions = run(edisplay.window, "Bonito.Sessions.SESSIONS") js_objects = run(edisplay.window, "Bonito.Sessions.GLOBAL_OBJECT_CACHE") # @test Set([app.session[].id, app.session[].parent.id]) == keys(js_sessions)