[gpx] Fix for decs/cmt duplication

Signed-off-by: cyber-toad <the.cyber.toad@proton.me>
This commit is contained in:
cyber-toad 2023-08-18 18:55:00 +02:00 committed by Alexander Borsuk
parent 50d9d9dd3b
commit c22b898463
2 changed files with 4 additions and 0 deletions

View file

@ -240,10 +240,12 @@ d5
</desc>
<cmt>c4</cmt>
</wpt>
<wpt lat="1" lon="2"><name>5</name><cmt>qqq</cmt><desc>qqq</desc></wpt>
)";
kml::FileData const dataFromText = loadGpxFromString(input);
TEST_EQUAL("d1", dataFromText.m_bookmarksData[0].m_description.at(kml::kDefaultLang), ());
TEST_EQUAL("d2\n\nc2", dataFromText.m_bookmarksData[1].m_description.at(kml::kDefaultLang), ());
TEST_EQUAL("c3", dataFromText.m_bookmarksData[2].m_description.at(kml::kDefaultLang), ());
TEST_EQUAL("d4\nd5\n\nc4", dataFromText.m_bookmarksData[3].m_description.at(kml::kDefaultLang), ());
TEST_EQUAL("qqq", dataFromText.m_bookmarksData[4].m_description.at(kml::kDefaultLang), ());
}

View file

@ -349,6 +349,8 @@ std::string GpxParser::BuildDescription()
return m_comment;
else if (m_comment.empty())
return m_description;
else if (m_description == m_comment)
return m_description;
return m_description + "\n\n" + m_comment;
}