#include <gtest/gtest.h>
#include "renderive/renderable/Renderable.hpp"
#include "renderive/scene/Scene.hpp"
static_assert(Color_Cache_Type<Recording_Color_Cache>);
struct Resource_Only_Color_Cache : Color_Cache {
    explicit Resource_Only_Color_Cache(std::pmr::memory_resource& memory_resource) : memory_resource(&memory_resource) {}
    void clear() override {}
    void composite(const Color_Cache&) override {}
    std::pmr::memory_resource* memory_resource;
};
static_assert(Color_Cache_Type<Resource_Only_Color_Cache>);
TEST(color_cache_test, composites_source_values_in_order) {
    Recording_Color_Cache first;
    Recording_Color_Cache second;
    Recording_Color_Cache result;
    first.append(1);
    second.append(2);
    result.composite(first);
    result.composite(second);
    EXPECT_EQ(result.values.size(), 2);
    EXPECT_EQ(result.values.at(0), 1);
    EXPECT_EQ(result.values.at(1), 2);
}
TEST(color_cache_test, scene_accepts_resource_only_cache) {
    using Strategy = Low_Latency_Strategy<Scene2D_Frame_Data>;
    Scene2D_Context<Strategy, Resource_Only_Color_Cache> scene;
    scene.with_final_color_cache([&](const Resource_Only_Color_Cache& cache) {
        EXPECT_EQ(cache.memory_resource, &scene.memory_resource());
    });
}
