From ba08003d66421eb911befc29d668255e081b25ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 4 Aug 2018 20:42:59 +0200 Subject: [PATCH] Animation: workaround so we're able to test with MSVC debug iterators on. --- src/Magnum/Animation/Player.hpp | 3 ++- src/Magnum/Animation/Test/PlayerTest.cpp | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Magnum/Animation/Player.hpp b/src/Magnum/Animation/Player.hpp index 9148f682c..2740a7f53 100644 --- a/src/Magnum/Animation/Player.hpp +++ b/src/Magnum/Animation/Player.hpp @@ -88,7 +88,8 @@ template std::size_t Player::size() const { template const TrackViewStorage& Player::track(std::size_t i) const { CORRADE_ASSERT(i < _tracks.size(), - "Animation::Player::track(): index out of range", _tracks[i].track); + /* Returning track 0 so we can test this w/ MSVC debug iterators */ + "Animation::Player::track(): index out of range", _tracks[0].track); return _tracks[i].track; } diff --git a/src/Magnum/Animation/Test/PlayerTest.cpp b/src/Magnum/Animation/Test/PlayerTest.cpp index 61e1a3112..b7960fb6f 100644 --- a/src/Magnum/Animation/Test/PlayerTest.cpp +++ b/src/Magnum/Animation/Test/PlayerTest.cpp @@ -278,8 +278,13 @@ void PlayerTest::trackInvalidIndex() { std::ostringstream out; Error redirectError{&out}; + Float value; Player player; - player.track(0); + /* Adding at least one track so the return in the graceful assert can + return the first value and not trigger MSVC debug iterator abort */ + player.add(TrackView{}, value); + + player.track(1); CORRADE_COMPARE(out.str(), "Animation::Player::track(): index out of range\n"); }