From 3e4646f4be512d5511989bce0a617010786d3b03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 16 Nov 2019 10:13:58 +0100 Subject: [PATCH] Platform: add tests for setMin/MaxWindowSize(). DPI scaling is not respected and viewport event is not fired on SDL. Ugh. --- src/Magnum/Platform/Test/GlfwApplicationTest.cpp | 9 ++++++++- src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Magnum/Platform/Test/GlfwApplicationTest.cpp b/src/Magnum/Platform/Test/GlfwApplicationTest.cpp index ea0761dcb..efb3db2f7 100644 --- a/src/Magnum/Platform/Test/GlfwApplicationTest.cpp +++ b/src/Magnum/Platform/Test/GlfwApplicationTest.cpp @@ -61,7 +61,14 @@ struct GlfwApplicationTest: Platform::Application { } else if(event.key() == KeyEvent::Key::T) { Debug{} << "setting window title"; setWindowTitle("This is a UTF-8 Window Title™!"); - } else if(event.key() == KeyEvent::Key::H) { + } + #if GLFW_VERSION_MAJOR*100 + GLFW_VERSION_MINOR >= 302 + else if(event.key() == KeyEvent::Key::W) { + Debug{} << "setting max window size, which should trigger a viewport event if the size changes"; + setMaxWindowSize(Vector2i{700, 500}); + } + #endif + else if(event.key() == KeyEvent::Key::H) { Debug{} << "toggling hand cursor"; setCursor(cursor() == Cursor::Arrow ? Cursor::Hand : Cursor::Arrow); } else if(event.key() == KeyEvent::Key::L) { diff --git a/src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp b/src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp index 4c9229bce..8e74cfa4f 100644 --- a/src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp +++ b/src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp @@ -86,7 +86,14 @@ struct Sdl2ApplicationTest: Platform::Application { } else if(event.key() == KeyEvent::Key::T) { Debug{} << "setting window title"; setWindowTitle("This is a UTF-8 Window Title™!"); - } else if(event.key() == KeyEvent::Key::H) { + } + #ifndef CORRADE_TARGET_EMSCRIPTEN + else if(event.key() == KeyEvent::Key::W) { + Debug{} << "setting max window size, which should trigger a viewport event"; + setMaxWindowSize(Vector2i{700, 500}); + } + #endif + else if(event.key() == KeyEvent::Key::H) { Debug{} << "toggling hand cursor"; setCursor(cursor() == Cursor::Arrow ? Cursor::Hand : Cursor::Arrow); }