From 321c2d22b9148d7a1ba142d653c0989068066245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 6 Nov 2020 11:57:50 +0100 Subject: [PATCH] Platform: improve console output of EmscriptenApplicationTest. --- .../Test/EmscriptenApplicationTest.cpp | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/src/Magnum/Platform/Test/EmscriptenApplicationTest.cpp b/src/Magnum/Platform/Test/EmscriptenApplicationTest.cpp index 2b977b7a3..7b2563b65 100644 --- a/src/Magnum/Platform/Test/EmscriptenApplicationTest.cpp +++ b/src/Magnum/Platform/Test/EmscriptenApplicationTest.cpp @@ -75,17 +75,20 @@ struct EmscriptenApplicationTest: Platform::Application { /* For testing keyboard capture */ void keyPressEvent(KeyEvent& event) override { - if(event.key() != KeyEvent::Key::Unknown) { - Debug{} << "keyPressEvent(" << event.keyName().c_str() << "): ✓"; - } else { - Debug{} << "keyPressEvent(" << event.keyName().c_str() << "): x"; + { + Debug d; + if(event.key() != KeyEvent::Key::Unknown) { + d << "keyPressEvent(" << Debug::nospace << event.keyName().data() << Debug::nospace << "): ✔"; + } else { + d << "keyPressEvent(" << Debug::nospace << event.keyName().data() << Debug::nospace << "): ✘"; + } + + if(event.modifiers() & KeyEvent::Modifier::Shift) d << "Shift"; + if(event.modifiers() & KeyEvent::Modifier::Ctrl) d << "Ctrl"; + if(event.modifiers() & KeyEvent::Modifier::Alt) d << "Alt"; + if(event.modifiers() & KeyEvent::Modifier::Super) d << "Super"; } - if(event.modifiers() & KeyEvent::Modifier::Shift) Debug{} << "Shift"; - if(event.modifiers() & KeyEvent::Modifier::Ctrl) Debug{} << "Ctrl"; - if(event.modifiers() & KeyEvent::Modifier::Alt) Debug{} << "Alt"; - if(event.modifiers() & KeyEvent::Modifier::Super) Debug{} << "Super"; - if(event.key() == KeyEvent::Key::F1) { Debug{} << "starting text input"; startTextInput(); @@ -111,17 +114,20 @@ struct EmscriptenApplicationTest: Platform::Application { } void keyReleaseEvent(KeyEvent& event) override { - if(event.key() != KeyEvent::Key::Unknown) { - Debug{} << "keyReleaseEvent(" << event.keyName().c_str() << "): ✓"; - } else { - Debug{} << "keyReleaseEvent(" << event.keyName().c_str() << "): x"; + { + Debug d; + if(event.key() != KeyEvent::Key::Unknown) { + d << "keyReleaseEvent(" << Debug::nospace << event.keyName().data() << Debug::nospace << "): ✔"; + } else { + d << "keyReleaseEvent(" << Debug::nospace << event.keyName().data() << Debug::nospace << "): ✘"; + } + + if(event.modifiers() & KeyEvent::Modifier::Shift) d << "Shift"; + if(event.modifiers() & KeyEvent::Modifier::Ctrl) d << "Ctrl"; + if(event.modifiers() & KeyEvent::Modifier::Alt) d << "Alt"; + if(event.modifiers() & KeyEvent::Modifier::Super) d << "Super"; } - if(event.modifiers() & KeyEvent::Modifier::Shift) Debug{} << "Shift"; - if(event.modifiers() & KeyEvent::Modifier::Ctrl) Debug{} << "Ctrl"; - if(event.modifiers() & KeyEvent::Modifier::Alt) Debug{} << "Alt"; - if(event.modifiers() & KeyEvent::Modifier::Super) Debug{} << "Super"; - event.setAccepted(); }