Issue #73 Unittest for CIdentifier dbus object path conversion

This commit is contained in:
Mat Sutcliffe
2020-08-16 00:28:33 +01:00
parent 97fe8069b0
commit 2f22904540
2 changed files with 13 additions and 1 deletions

View File

@@ -34,6 +34,9 @@ namespace BlackMiscTest
//! Machine unique id tests
void machineUniqueId();
//! Conversion to dbus object path
void dbusObjectPath();
};
//! Test identifiable object
@@ -67,6 +70,15 @@ namespace BlackMiscTest
QVERIFY2(!o.getMachineId().isEmpty(), "Machine id shall never be empty! If this test failed on a supported platform, get a fallback solution!");
}
void CTestIdentifier::dbusObjectPath()
{
QObject q;
q.setObjectName("!@#$%^&*()_+");
CTestIdentifiable id(&q);
QString s(id.identifier().toDBusObjectPath());
QVERIFY2(id.identifier() == CIdentifier::fromDBusObjectPath(s), "Conversion from dbus object path and back compares equal");
}
CTestIdentifiable::CTestIdentifiable(QObject *nameObject) : CIdentifiable(nameObject)
{ }