49 lines
1.8 KiB
C++
49 lines
1.8 KiB
C++
#include <mcp/core/runtime/Gallery_Plots.hpp>
|
|
#include <mcp/core/runtime/Input_Event.hpp>
|
|
#include <gtest/gtest.h>
|
|
#include <unordered_set>
|
|
|
|
namespace aethera::web {
|
|
namespace {
|
|
TEST(Gallery_Plots, Catalog_Is_Complete_And_Unique) {
|
|
const auto definitions = gallery_plot_definitions();
|
|
ASSERT_FALSE(definitions.empty());
|
|
|
|
std::unordered_set<std::string_view> identifiers;
|
|
bool has_2d{};
|
|
bool has_3d{};
|
|
for (const auto& definition : definitions) {
|
|
EXPECT_FALSE(definition.id.empty());
|
|
EXPECT_FALSE(definition.title.empty());
|
|
EXPECT_FALSE(definition.category.empty());
|
|
EXPECT_FALSE(definition.description.empty());
|
|
EXPECT_NE(definition.create, nullptr);
|
|
EXPECT_TRUE(identifiers.insert(definition.id).second)
|
|
<< "duplicate plot id: " << definition.id;
|
|
const auto found = find_gallery_plot_definition(definition.id);
|
|
ASSERT_TRUE(found);
|
|
EXPECT_EQ(found, &definition);
|
|
has_2d |= definition.dimension == Plot_Dimension::two_d;
|
|
has_3d |= definition.dimension == Plot_Dimension::three_d;
|
|
}
|
|
EXPECT_TRUE(has_2d);
|
|
EXPECT_TRUE(has_3d);
|
|
EXPECT_FALSE(find_gallery_plot_definition("not-a-plot"));
|
|
}
|
|
|
|
TEST(Gallery_Plots, Concrete_Scenes_Submit_Input_Through_Final_Storage) {
|
|
for (const auto id : {std::string_view{"axes"},
|
|
std::string_view{"datoviz_splat"}}) {
|
|
const auto* definition = find_gallery_plot_definition(id);
|
|
ASSERT_NE(definition, nullptr);
|
|
auto build = definition->create();
|
|
auto event = std::make_shared<Input_Pointer_Event>(
|
|
Event_Type::pointer_move, Event_Timeline_Time{});
|
|
std::visit([event = std::move(event)](auto& scene) mutable {
|
|
scene->submit_event(std::move(event));
|
|
}, build.second);
|
|
}
|
|
}
|
|
}
|
|
}
|