COMPARE(cat->description(), "First test catalog");
// check the packages too
- COMPARE(cat->packages().size(), 2);
+ COMPARE(cat->packages().size(), 3);
pkg::PackageRef p1 = cat->packages().front();
COMPARE(p1->catalog(), cat.ptr());
// test filtering / searching too
+ string_set tags(p2->tags());
+ COMPARE(tags.size(), 4);
+ VERIFY(tags.find("ifr") != tags.end());
+ VERIFY(tags.find("cessna") != tags.end());
+ VERIFY(tags.find("jet") == tags.end());
+
+
+ SGPropertyNode_ptr queryA(new SGPropertyNode);
+ queryA->setStringValue("tag", "ifr");
+ VERIFY(p2->matches(queryA.ptr()));
+
+ SGPropertyNode_ptr queryB(new SGPropertyNode);
+ queryB->setStringValue("name", "ces");
+ VERIFY(p2->matches(queryB.ptr()));
+
+ SGPropertyNode_ptr queryC(new SGPropertyNode);
+ queryC->setStringValue("name", "foo");
+ VERIFY(!p2->matches(queryC.ptr()));
+
+ SGPropertyNode_ptr queryD(new SGPropertyNode);
+ queryD->setIntValue("rating-FDM", 3);
+ VERIFY(p2->matches(queryD.ptr()));
+
+ SGPropertyNode_ptr queryE(new SGPropertyNode);
+ queryE->setIntValue("rating-model", 5);
+ queryE->setStringValue("description", "cessna");
+ VERIFY(p2->matches(queryE.ptr()));
+
delete root;
return EXIT_SUCCESS;
{
return getLocalisedProp("description");
}
+
+string_set Package::tags() const
+{
+ return m_tags;
+}
SGPropertyNode* Package::properties() const
{
// prefer local hangar package if possible, in case someone does something
// silly with naming. Of course flightgear's aircraft search doesn't know
- // about hanagrs, so names still need to be unique.
+ // about hangars, so names still need to be unique.
PackageRef depPkg = m_catalog->getPackageById(depName);
if (!depPkg) {
Root* rt = m_catalog->root();
<version>8.1.*</version>
<version>8.0.0</version>
<version>8.2.0</version>
-
+
<package>
<id>alpha</id>
<name>Alpha package</name>
<revision type="int">8</revision>
<file-size-bytes type="int">1234567</file-size-bytes>
</package>
-
+
<package>
<id>c172p</id>
<name>Cessna 172-P</name>
<description>A plane made by Cessna</description>
<revision type="int">42</revision>
<file-size-bytes type="int">34567</file-size-bytes>
-
- <tags>
- <tag>cessna</tag>
- <tag>ga</tag>
- <tag>piston</tag>
- <tag>ifr</tag>
- </tags>
+
+ <tag>cessna</tag>
+ <tag>ga</tag>
+ <tag>piston</tag>
+ <tag>ifr</tag>
+
+ <rating>
+ <FDM type="int">3</FDM>
+ <systems type="int">4</systems>
+ <model type="int">5</model>
+ <cockpit type="int">4</cockpit>
+ </rating>
+
+ <!-- local dependency -->
+ <depends>
+ <id>org.flightgear.test.catalog1.common-sounds</id>
+ <revision>10</revision>
+ </depends>
+
+ <variant>
+ <id>c172p-2d-panel</id>
+ <name>C172 with 2d panel only</name>
+ </variant>
+
+ <variant>
+ <id>c172p-floats</id>
+ <name>C172 with floats</name>
+ </variant>
+
+ <variant>
+ <id>c172p-skis</id>
+ <name>C172 with skis</name>
+ </variant>
+ </package>
+
+ <package>
+ <id>common-sounds</id>
+ <name>Common sound files for test catalog aircraft</name>
+ <revision>10</revision>
</package>
</PropertyList>
-
\ No newline at end of file