Files
comaps/editor/editor_tests/config_loader_test.cpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

56 lines
1.3 KiB
C++

#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("/omaps/editor/types");
TEST(!types.empty(), ());
auto const fields = doc.select_nodes("/omaps/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