https://gitlab.opengeosys.org/ogs/ogs.git
Raw File
Tip revision: 15416fe1369901f4f9e6f127c6ef80f093c0dfc8 authored by Tobias Meisel on 18 December 2020, 15:22:46 UTC
[MeL/IO] Xdmfwriter is optional part of xdmfhdfwriter
Tip revision: 15416fe
TestQtGmlInterface.cpp
/**
 * \file
 * \author Karsten Rink
 * \date   2013-03-20
 *
 * \copyright
 * Copyright (c) 2012-2020, OpenGeoSys Community (http://www.opengeosys.org)
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.org/project/license
 *
 *
 */

#include <cstdio>

#include "BaseLib/StringTools.h"
#include "GeoLib/GEOObjects.h"
#include "GeoLib/IO/XmlIO/Qt/XmlGmlInterface.h"
#include "InfoLib/TestInfo.h"
#include "Tests/FileIO/TestGmlInterface.h"
#include "filesystem.h"
#include "gtest/gtest.h"

TEST_F(TestGmlInterface, QtXmlGmlWriterReaderTest)
{
    // Writer test
    std::string test_data_file =
        (fs::temp_directory_path() /= BaseLib::randomString(32)).string();

    GeoLib::IO::XmlGmlInterface xml(geo_objects);
    xml.setNameForExport(geo_name);
    int result = xml.writeToFile(test_data_file);
    EXPECT_EQ(result, 1);

    // remove the written data from the data structures
    geo_objects.removeSurfaceVec(geo_name);
    geo_objects.removePolylineVec(geo_name);
    geo_objects.removePointVec(geo_name);

    // Reader test
    result = xml.readFile(QString::fromStdString(test_data_file));
    EXPECT_EQ(1, result);

    std::remove(test_data_file.c_str());
    test_data_file += ".md5";
    std::remove(test_data_file.c_str());

    checkPointProperties();
    checkPolylineProperties();
    checkSurfaceProperties();
}
back to top