Exemple #1
0
void ColorTest::configuration() {
    Corrade::Utility::Configuration c;

    Color3f color3(0.5f, 0.75f, 1.0f);
    std::string value3("0.5 0.75 1");

    c.setValue("color3", color3);
    CORRADE_COMPARE(c.value("color3"), value3);
    CORRADE_COMPARE(c.value<Color3f>("color3"), color3);

    Color4f color4(0.5f, 0.75f, 0.0f, 1.0f);
    std::string value4("0.5 0.75 0 1");

    c.setValue("color4", color4);
    CORRADE_COMPARE(c.value("color4"), value4);
    CORRADE_COMPARE(c.value<Color4f>("color4"), color4);
}
Exemple #2
0
void Vector3Test::configuration() {
    Corrade::Utility::Configuration c;

    Vector3 vec(3.0f, 3.125f, 9.55f);
    std::string value("3 3.125 9.55");

    c.setValue("vector", vec);
    CORRADE_COMPARE(c.value("vector"), value);
    CORRADE_COMPARE(c.value<Vector3>("vector"), vec);
}
Exemple #3
0
void RangeTest::configuration() {
    Corrade::Utility::Configuration c;

    Range2D rect({3.0f, 3.125f}, {9.0f, 9.55f});
    std::string value("3 3.125 9 9.55");

    c.setValue("rectangle", rect);
    CORRADE_COMPARE(c.value("rectangle"), value);
    CORRADE_COMPARE(c.value<Range2D>("rectangle"), rect);
}
Exemple #4
0
void AngleTest::configurationRad() {
    Corrade::Utility::Configuration c;

    Rad angle{3.14159f};
    std::string value("3.14159");

    c.setValue("angle", angle);
    CORRADE_COMPARE(c.value("angle"), value);
    CORRADE_COMPARE(c.value<Rad>("angle"), angle);
}
Exemple #5
0
void AngleTest::configurationDeg() {
    Corrade::Utility::Configuration c;

    Deg angle{25.3f};
    std::string value("25.3");

    c.setValue("angle", angle);
    CORRADE_COMPARE(c.value("angle"), value);
    CORRADE_COMPARE(c.value<Deg>("angle"), angle);
}
Exemple #6
0
void RangeTest::deprecated() {
    typedef Geometry::Rectangle<Float> Rectangle;
    typedef Geometry::Rectangle<Int> Rectanglei;

    Rectanglei a({45, 23}, {-17, 35});
    CORRADE_COMPARE(Rectanglei(), Range2Di({0, 0}, {0, 0}));
    CORRADE_COMPARE(a, Range2Di({45, 23}, {-17, 35}));
    CORRADE_COMPARE(Rectanglei(a), Range2Di({45, 23}, {-17, 35}));
    CORRADE_COMPARE(Rectangle(a), Range2D({45.0f, 23.0f}, {-17.0f, 35.0f}));

    CORRADE_COMPARE(a.width(), -62);
    CORRADE_COMPARE(a.height(), 12);

    CORRADE_VERIFY(!(std::is_convertible<Rectangle, Rectanglei>::value));

    Corrade::Utility::Configuration c;
    Rectangle rect({3.0f, 3.125f}, {9.0f, 9.55f});
    std::string value("3 3.125 9 9.55");

    c.setValue("rectangle", rect);
    CORRADE_COMPARE(c.value("rectangle"), value);
    CORRADE_COMPARE(c.value<Rectangle>("rectangle"), rect);
}