mirror of
https://gitlab.com/splashmapper/splash.git
synced 2026-02-12 06:50:49 +01:00
40 lines
1.0 KiB
C++
40 lines
1.0 KiB
C++
#include <doctest.h>
|
|
|
|
#include "./core/factory.h"
|
|
#include "./core/root_object.h"
|
|
|
|
using namespace Splash;
|
|
|
|
/*************/
|
|
TEST_CASE("Testing attributes for all objects the Factory can create")
|
|
{
|
|
auto factory = Factory(nullptr);
|
|
|
|
auto objectTypes = factory.getObjectTypes();
|
|
for (const auto& objectType : objectTypes)
|
|
{
|
|
const auto object = factory.create(objectType);
|
|
if (!object)
|
|
continue;
|
|
|
|
auto attributeList = object->getAttributesList();
|
|
|
|
for (const auto& attribute : attributeList)
|
|
{
|
|
const auto ret = object->getAttribute(attribute);
|
|
if (!ret.has_value())
|
|
continue;
|
|
|
|
const auto& value = ret.value();
|
|
if (value.empty())
|
|
continue;
|
|
CHECK(object->setAttribute(attribute, value) != BaseObject::SetAttrStatus::failure);
|
|
|
|
const auto retAfterSet = object->getAttribute(attribute);
|
|
const auto& valueAfterSet = retAfterSet.value();
|
|
|
|
CHECK_EQ(value, valueAfterSet);
|
|
}
|
|
}
|
|
}
|