Unit-tests for localised-variant strings.

This commit is contained in:
James Turner 2016-11-26 14:28:22 +00:00
parent 63edff078f
commit 835ae941ce
3 changed files with 18 additions and 0 deletions

View File

@ -341,6 +341,10 @@ bool Dir::create(mode_t mode)
bool Dir::removeChildren() const bool Dir::removeChildren() const
{ {
if (!exists()) {
return true;
}
bool ok; bool ok;
PathList cs = children(NO_DOT_OR_DOTDOT | INCLUDE_HIDDEN | TYPE_FILE | TYPE_DIR); PathList cs = children(NO_DOT_OR_DOTDOT | INCLUDE_HIDDEN | TYPE_FILE | TYPE_DIR);
BOOST_FOREACH(SGPath path, cs) { BOOST_FOREACH(SGPath path, cs) {

View File

@ -178,6 +178,16 @@ int parseTest()
unsigned int skisVariant = p2->indexOfVariant("c172p-skis"); unsigned int skisVariant = p2->indexOfVariant("c172p-skis");
VERIFY(skisVariant > 0); VERIFY(skisVariant > 0);
COMPARE(p2->getLocalisedProp("description", skisVariant), "A plane with skis");
COMPARE(p2->getLocalisedProp("author", skisVariant), "Standard author");
unsigned int floatsVariant = p2->indexOfVariant("c172p-floats");
VERIFY(floatsVariant > 0);
COMPARE(p2->getLocalisedProp("description", floatsVariant), "A plane with floats");
COMPARE(p2->getLocalisedProp("author", floatsVariant), "Floats variant author");
pkg::Package::ThumbnailVec thumbs2 = p2->thumbnailsForVariant(skisVariant); pkg::Package::ThumbnailVec thumbs2 = p2->thumbnailsForVariant(skisVariant);
COMPARE(thumbs2.size(), 2); COMPARE(thumbs2.size(), 2);

View File

@ -29,6 +29,7 @@
<description>A plane made by Cessna</description> <description>A plane made by Cessna</description>
<revision type="int">42</revision> <revision type="int">42</revision>
<file-size-bytes type="int">860</file-size-bytes> <file-size-bytes type="int">860</file-size-bytes>
<author>Standard author</author>
<tag>cessna</tag> <tag>cessna</tag>
<tag>ga</tag> <tag>ga</tag>
@ -73,6 +74,8 @@
<variant> <variant>
<id>c172p-floats</id> <id>c172p-floats</id>
<name>C172 with floats</name> <name>C172 with floats</name>
<description>A plane with floats</description>
<author>Floats variant author</author>
<thumbnail> <thumbnail>
<type>exterior</type> <type>exterior</type>
@ -90,6 +93,7 @@
<variant> <variant>
<id>c172p-skis</id> <id>c172p-skis</id>
<name>C172 with skis</name> <name>C172 with skis</name>
<description>A plane with skis</description>
<thumbnail> <thumbnail>
<type>exterior</type> <type>exterior</type>