From 567ecb26653c984aa663520c8b9ceaa4707a1f10 Mon Sep 17 00:00:00 2001 From: Colin Caine Date: Wed, 15 Mar 2023 23:01:05 +0000 Subject: [PATCH] Fix #225 I messed up somehow and committed a typo (I left out a colon). This commit also ensures that ==(Action, Bool) gives the same result as ==(Bool, Action), because that just makes sense. Sorry, Simon! --- src/glfw3.jl | 3 ++- test/runtests.jl | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/glfw3.jl b/src/glfw3.jl index 8cda544..5436d82 100644 --- a/src/glfw3.jl +++ b/src/glfw3.jl @@ -16,7 +16,8 @@ end # # This method tells Julia how to compare an Action and a Bool so that code # calling GetKey as documented will work as expected. -Base.(==)(b::Bool, a::Action) = b == Integer(a) +Base.:(==)(b::Bool, a::Action) = b == Integer(a) +Base.:(==)(a::Action, b::Bool) = b == a @enum Key::Cint begin # Unknown key diff --git a/test/runtests.jl b/test/runtests.jl index 396b6eb..a2909f3 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -11,7 +11,9 @@ println(GLFW.GetVersionString()) # https://github.com/JuliaGL/GLFW.jl/pull/225 @test GLFW.PRESS == true +@test true == GLFW.PRESS @test GLFW.RELEASE == false +@test false == GLFW.RELEASE if !haskey(ENV, "CI") # AppVeyor and Travis CI don't support OpenGL include("windowclose.jl")