Skip to content

Commit

Permalink
Fix juce::Point variant converter
Browse files Browse the repository at this point in the history
  • Loading branch information
ImJimmi committed Feb 7, 2024
1 parent 9749362 commit da003a8
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions jive_core/values/variant-converters/jive_MiscVariantConverters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,20 @@ namespace juce
const auto tokens = StringArray::fromTokens(value.toString(), ",", "");
jassert(tokens.size() == 2);

return Point<Arithmetic>{
static_cast<Arithmetic>(tokens[0].getDoubleValue()),
static_cast<Arithmetic>(tokens[1].getDoubleValue()),
};
if constexpr (std::is_integral<Arithmetic>())
{
return {
static_cast<Arithmetic>(std::round(tokens[0].getDoubleValue())),
static_cast<Arithmetic>(std::round(tokens[1].getDoubleValue())),
};
}
else
{
return {
static_cast<Arithmetic>(tokens[0].getDoubleValue()),
static_cast<Arithmetic>(tokens[1].getDoubleValue()),

Check warning on line 251 in jive_core/values/variant-converters/jive_MiscVariantConverters.cpp

View check run for this annotation

Codecov / codecov/patch

jive_core/values/variant-converters/jive_MiscVariantConverters.cpp#L249-L251

Added lines #L249 - L251 were not covered by tests
};
}
}

template <typename Arithmetic>
Expand Down

0 comments on commit da003a8

Please sign in to comment.