Files
MapLibreParticleLab/test/style.cpp
2014-07-15 11:42:34 -04:00

67 lines
1.7 KiB
C++

#include "gtest/gtest.h"
#include <llmr/style/style.hpp>
#include "./fixtures/fixture_log.hpp"
#include <iostream>
#include <fstream>
using namespace llmr;
TEST(Style, Style) {
const FixtureLogBackend &log = Log::Set<FixtureLogBackend>();
std::ifstream stylefile("./style.min.js");
ASSERT_TRUE(stylefile.good());
std::stringstream stylejson;
stylejson << stylefile.rdbuf();
Style style;
style.loadJSON((const uint8_t *)stylejson.str().c_str());
}
TEST(Style, Colors) {
const FixtureLogBackend &log = Log::Set<FixtureLogBackend>();
std::ifstream stylefile("./fuzz-colors.min.js");
ASSERT_TRUE(stylefile.good());
std::stringstream stylejson;
stylejson << stylefile.rdbuf();
Style style;
style.loadJSON((const uint8_t *)stylejson.str().c_str());
}
TEST(Style, Functions) {
const FixtureLogBackend &log = Log::Set<FixtureLogBackend>();
std::ifstream stylefile("./fuzz-functions.min.js");
ASSERT_TRUE(stylefile.good());
std::stringstream stylejson;
stylejson << stylefile.rdbuf();
Style style;
style.loadJSON((const uint8_t *)stylejson.str().c_str());
const FixtureLogBackend::LogMessage number {
EventSeverityClass("WARNING"),
EventClass("ParseStyle"),
"value of 'line-width' must be a number, or a number function"
};
ASSERT_EQ(0, log.count(number));
}
TEST(Style, Layers) {
const FixtureLogBackend &log = Log::Set<FixtureLogBackend>();
std::ifstream stylefile("./fuzz-layers.min.js");
ASSERT_TRUE(stylefile.good());
std::stringstream stylejson;
stylejson << stylefile.rdbuf();
Style style;
style.loadJSON((const uint8_t *)stylejson.str().c_str());
}