mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 13:23:59 +00:00
committed by
Konstantin Pastbin
parent
c9cbb64f12
commit
76ffc99abd
55
libs/editor/editor_tests/config_loader_test.cpp
Normal file
55
libs/editor/editor_tests/config_loader_test.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#include "testing/testing.hpp"
|
||||
|
||||
#include "editor/config_loader.hpp"
|
||||
#include "editor/editor_config.hpp"
|
||||
|
||||
#include "platform/platform_tests_support/scoped_file.hpp"
|
||||
|
||||
#include "base/atomic_shared_ptr.hpp"
|
||||
|
||||
#include <pugixml.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
using namespace editor;
|
||||
using platform::tests_support::ScopedFile;
|
||||
|
||||
void CheckGeneralTags(pugi::xml_document const & doc)
|
||||
{
|
||||
auto const types = doc.select_nodes("/comaps/editor/types");
|
||||
TEST(!types.empty(), ());
|
||||
auto const fields = doc.select_nodes("/comaps/editor/fields");
|
||||
TEST(!fields.empty(), ());
|
||||
}
|
||||
|
||||
UNIT_TEST(ConfigLoader_Base)
|
||||
{
|
||||
base::AtomicSharedPtr<EditorConfig> config;
|
||||
ConfigLoader loader(config);
|
||||
|
||||
TEST(!config.Get()->GetTypesThatCanBeAdded().empty(), ());
|
||||
}
|
||||
|
||||
// This functionality is not used and corresponding server is not working.
|
||||
// Uncomment it when server will be up.
|
||||
//UNIT_TEST(ConfigLoader_GetRemoteHash)
|
||||
//{
|
||||
// auto const hashStr = ConfigLoader::GetRemoteHash();
|
||||
// TEST_NOT_EQUAL(hashStr, "", ());
|
||||
// TEST_EQUAL(hashStr, ConfigLoader::GetRemoteHash(), ());
|
||||
//}
|
||||
//
|
||||
//UNIT_TEST(ConfigLoader_GetRemoteConfig)
|
||||
//{
|
||||
// pugi::xml_document doc;
|
||||
// ConfigLoader::GetRemoteConfig(doc);
|
||||
// CheckGeneralTags(doc);
|
||||
//}
|
||||
|
||||
UNIT_TEST(ConfigLoader_LoadFromLocal)
|
||||
{
|
||||
pugi::xml_document doc;
|
||||
ConfigLoader::LoadFromLocal(doc);
|
||||
CheckGeneralTags(doc);
|
||||
}
|
||||
} // namespace
|
||||
Reference in New Issue
Block a user