#include "gtest/gtest.h"

#include "Photon/Canvas.hpp"

using namespace Photon;

TEST(Canvas_Tests, Constructor) {
    Canvas image{10U, 20U};

    EXPECT_EQ(10, image.getWidth());
    EXPECT_EQ(20, image.getHeight());

    for (int i = 0; i < image.getHeight(); i++)
        for (int j = 0; j < image.getWidth(); j++) {
            Color pixelColor = image.getPixel(j, i);
            EXPECT_DOUBLE_EQ(0.0, pixelColor.getR());
            EXPECT_DOUBLE_EQ(0.0, pixelColor.getG());
            EXPECT_DOUBLE_EQ(0.0, pixelColor.getB());
        }
}

TEST(Canvas_Tests, Set_Pixel) {
    Canvas image{10U, 20U};
    Color red{1.0, 0.0, 0.0};

    image.setPixel(2, 3, red);
    Color res = image.getPixel(2, 3);
    EXPECT_DOUBLE_EQ(1.0, res.getR());
    EXPECT_DOUBLE_EQ(0.0, res.getG());
    EXPECT_DOUBLE_EQ(0.0, res.getB());
}