From 829cc9ebecce9e312284dc59287bd87943ec6f2a Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 22 May 2017 15:21:10 -0300 Subject: [PATCH] Fix ordered_dither_tests --- src/render/ordered_dither_tests.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/render/ordered_dither_tests.cpp b/src/render/ordered_dither_tests.cpp index 120b7ac29..f00bbc7df 100644 --- a/src/render/ordered_dither_tests.cpp +++ b/src/render/ordered_dither_tests.cpp @@ -1,5 +1,5 @@ // Aseprite Render Library -// Copyright (c) 2001-2015 David Capello +// Copyright (c) 2001-2017 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. @@ -17,31 +17,35 @@ using namespace render; TEST(BayerMatrix, CheckD2) { - BayerMatrix<2> matrix; + BayerMatrix matrix(2); int expected[2*2] = { 0, 2, 3, 1 }; - for (int i=0; i<2*2; ++i) - EXPECT_EQ(expected[i], matrix[i]); + int c=0; + for (int i=0; i<2; ++i) + for (int j=0; j<2; ++j) + EXPECT_EQ(expected[c++], matrix(i, j)); } TEST(BayerMatrix, CheckD4) { - BayerMatrix<4> matrix; + BayerMatrix matrix(4); int expected[4*4] = { 0, 8, 2, 10, 12, 4, 14, 6, 3, 11, 1, 9, 15, 7, 13, 5 }; - for (int i=0; i<2*2; ++i) - EXPECT_EQ(expected[i], matrix[i]); + int c=0; + for (int i=0; i<4; ++i) + for (int j=0; j<4; ++j) + EXPECT_EQ(expected[c++], matrix(i, j)); } TEST(BayerMatrix, CheckD8) { - BayerMatrix<8> matrix; + BayerMatrix matrix(8); int expected[8*8] = { 0, 32, 8, 40, 2, 34, 10, 42, 48, 16, 56, 24, 50, 18, 58, 26, @@ -53,8 +57,10 @@ TEST(BayerMatrix, CheckD8) 15, 47, 7, 39, 13, 45, 5, 37, 63, 31, 55, 23, 61, 29, 53, 21 }; - for (int i=0; i<2*2; ++i) - EXPECT_EQ(expected[i], matrix[i]); + int c=0; + for (int i=0; i<8; ++i) + for (int j=0; j<8; ++j) + EXPECT_EQ(expected[c++], matrix(i, j)); } int main(int argc, char** argv)