From d85b0d1add35f7eae99ad2053be9b88b57dad2ee Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Thu, 3 Mar 2016 15:58:10 -0500 Subject: [PATCH] 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. --- Base/include/FasTC/IPixel.h | 8 ++++++++ Base/test/TestImage.cpp | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Base/include/FasTC/IPixel.h b/Base/include/FasTC/IPixel.h index dedf271..97d49ba 100644 --- a/Base/include/FasTC/IPixel.h +++ b/Base/include/FasTC/IPixel.h @@ -79,6 +79,14 @@ class IPixel : public VectorBase { void Unpack(uint32 rgba); void MakeOpaque() { /* Do nothing.. */ } + + bool operator==(const IPixel &other) const { + return static_cast(*this) == static_cast(other); + } + + bool operator!=(const IPixel &other) const { + return static_cast(*this) != static_cast(other); + } }; REGISTER_VECTOR_TYPE(IPixel); diff --git a/Base/test/TestImage.cpp b/Base/test/TestImage.cpp index d099ceb..72778af 100644 --- a/Base/test/TestImage.cpp +++ b/Base/test/TestImage.cpp @@ -265,7 +265,7 @@ TEST(Image, IDCT) { // First make sure they're different for (uint32 j = 0; j < h; ++j) { for (uint32 i = 0; i < w; ++i) { - EXPECT_PRED2(std::not_equal_to(), img(i, j), orig(i, j)); + EXPECT_NE(img(i, j), orig(i, j)); } }