Browse Source

Math: adapt to changes in Corrade's TweakableParser also for Angle.

Forgot to do this in 4ef33236eb.
pull/601/head
Vladimír Vondruš 3 years ago
parent
commit
826329258a
  1. 3
      src/Magnum/Math/Half.cpp
  2. 3
      src/Magnum/Math/Half.h
  3. 10
      src/Magnum/Math/Test/HalfTest.cpp

3
src/Magnum/Math/Half.cpp

@ -30,6 +30,7 @@
#include <Corrade/Utility/DebugStl.h> #include <Corrade/Utility/DebugStl.h>
#if defined(DOXYGEN_GENERATING_OUTPUT) || defined(CORRADE_TARGET_UNIX) || (defined(CORRADE_TARGET_WINDOWS) && !defined(CORRADE_TARGET_WINDOWS_RT)) || defined(CORRADE_TARGET_EMSCRIPTEN) #if defined(DOXYGEN_GENERATING_OUTPUT) || defined(CORRADE_TARGET_UNIX) || (defined(CORRADE_TARGET_WINDOWS) && !defined(CORRADE_TARGET_WINDOWS_RT)) || defined(CORRADE_TARGET_EMSCRIPTEN)
#include <Corrade/Containers/Pair.h>
#include <Corrade/Containers/StringView.h> #include <Corrade/Containers/StringView.h>
#include <Corrade/Utility/TweakableParser.h> #include <Corrade/Utility/TweakableParser.h>
#endif #endif
@ -49,7 +50,7 @@ Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, Half value)
#if defined(DOXYGEN_GENERATING_OUTPUT) || defined(CORRADE_TARGET_UNIX) || (defined(CORRADE_TARGET_WINDOWS) && !defined(CORRADE_TARGET_WINDOWS_RT)) || defined(CORRADE_TARGET_EMSCRIPTEN) #if defined(DOXYGEN_GENERATING_OUTPUT) || defined(CORRADE_TARGET_UNIX) || (defined(CORRADE_TARGET_WINDOWS) && !defined(CORRADE_TARGET_WINDOWS_RT)) || defined(CORRADE_TARGET_EMSCRIPTEN)
namespace Corrade { namespace Utility { namespace Corrade { namespace Utility {
std::pair<TweakableState, Magnum::Math::Half> TweakableParser<Magnum::Math::Half>::parse(const Containers::StringView value) { Containers::Pair<TweakableState, Magnum::Math::Half> TweakableParser<Magnum::Math::Half>::parse(const Containers::StringView value) {
using namespace Containers::Literals; using namespace Containers::Literals;
char* end; char* end;

3
src/Magnum/Math/Half.h

@ -29,7 +29,6 @@
* @brief Class @ref Magnum::Math::Half, literal @link Magnum::Math::Literals::operator""_h() @endlink * @brief Class @ref Magnum::Math::Half, literal @link Magnum::Math::Literals::operator""_h() @endlink
*/ */
#include <utility>
#ifndef CORRADE_NO_DEBUG #ifndef CORRADE_NO_DEBUG
#include <Corrade/Utility/Utility.h> #include <Corrade/Utility/Utility.h>
#endif #endif
@ -214,7 +213,7 @@ template<> struct MAGNUM_EXPORT TweakableParser<Magnum::Math::Half> {
TweakableParser() = delete; TweakableParser() = delete;
/** @brief Parse the value */ /** @brief Parse the value */
static std::pair<TweakableState, Magnum::Math::Half> parse(Containers::StringView value); static Containers::Pair<TweakableState, Magnum::Math::Half> parse(Containers::StringView value);
}; };
}} }}

10
src/Magnum/Math/Test/HalfTest.cpp

@ -639,11 +639,9 @@ void HalfTest::debug() {
void HalfTest::tweakable() { void HalfTest::tweakable() {
auto&& data = TweakableData[testCaseInstanceId()]; auto&& data = TweakableData[testCaseInstanceId()];
setTestCaseDescription(data.name); setTestCaseDescription(data.name);
Corrade::Utility::TweakableState state; auto result = Corrade::Utility::TweakableParser<Half>::parse(data.data);
Half result; CORRADE_COMPARE(result.first(), Corrade::Utility::TweakableState::Success);
std::tie(state, result) = Corrade::Utility::TweakableParser<Half>::parse(data.data); CORRADE_COMPARE(result.second(), data.result);
CORRADE_COMPARE(state, Corrade::Utility::TweakableState::Success);
CORRADE_COMPARE(result, data.result);
} }
void HalfTest::tweakableError() { void HalfTest::tweakableError() {
@ -653,7 +651,7 @@ void HalfTest::tweakableError() {
std::ostringstream out; std::ostringstream out;
Warning redirectWarning{&out}; Warning redirectWarning{&out};
Error redirectError{&out}; Error redirectError{&out};
Corrade::Utility::TweakableState state = Corrade::Utility::TweakableParser<Half>::parse(data.data).first; Corrade::Utility::TweakableState state = Corrade::Utility::TweakableParser<Half>::parse(data.data).first();
CORRADE_COMPARE(out.str(), data.error); CORRADE_COMPARE(out.str(), data.error);
CORRADE_COMPARE(state, data.state); CORRADE_COMPARE(state, data.state);
} }

Loading…
Cancel
Save