Fix compiler problems:

We couldn't automatically cast IPixels to floats under GCC, so just
add explicit comparison operators for these pixels so that they work
with the googletest macros.
This commit is contained in:
Pavel Krajcevski 2016-03-03 15:58:10 -05:00
parent e8b58e3fd0
commit d85b0d1add
2 changed files with 9 additions and 1 deletions

View file

@ -79,6 +79,14 @@ class IPixel : public VectorBase<float, 1> {
void Unpack(uint32 rgba); void Unpack(uint32 rgba);
void MakeOpaque() { /* Do nothing.. */ } void MakeOpaque() { /* Do nothing.. */ }
bool operator==(const IPixel &other) const {
return static_cast<float>(*this) == static_cast<float>(other);
}
bool operator!=(const IPixel &other) const {
return static_cast<float>(*this) != static_cast<float>(other);
}
}; };
REGISTER_VECTOR_TYPE(IPixel); REGISTER_VECTOR_TYPE(IPixel);

View file

@ -265,7 +265,7 @@ TEST(Image, IDCT) {
// First make sure they're different // First make sure they're different
for (uint32 j = 0; j < h; ++j) { for (uint32 j = 0; j < h; ++j) {
for (uint32 i = 0; i < w; ++i) { for (uint32 i = 0; i < w; ++i) {
EXPECT_PRED2(std::not_equal_to<float>(), img(i, j), orig(i, j)); EXPECT_NE(img(i, j), orig(i, j));
} }
} }