tests for the copy ctor and assignment operator

svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=466918
This commit is contained in:
Aaron J. Seigo 2005-10-03 17:37:22 +00:00
parent 63d3673092
commit 217feab285
3 changed files with 33 additions and 0 deletions

View File

@ -215,5 +215,35 @@ void TestAppletInfo::hidden()
COMPARE(expected, actual);
}
void TestAppletInfo::assignment()
{
Plasma::AppletInfo assigned = *notUniqueNative;
COMPARE(assigned.name(), notUniqueNative->name());
COMPARE(assigned.comment(), notUniqueNative->comment());
COMPARE(assigned.icon(), notUniqueNative->icon());
COMPARE(assigned.library(), notUniqueNative->library());
COMPARE(assigned.languageBindings(), notUniqueNative->languageBindings());
COMPARE(assigned.desktopFilePath(), notUniqueNative->desktopFilePath());
COMPARE(assigned.desktopFile(), notUniqueNative->desktopFile());
COMPARE(assigned.unique(), notUniqueNative->unique());
COMPARE(assigned.hidden(), notUniqueNative->hidden());
}
void TestAppletInfo::copyConstructor()
{
Plasma::AppletInfo* tempCopy = new Plasma::AppletInfo(*notUniqueNative);
Plasma::AppletInfo copied(*tempCopy);
delete tempCopy;
COMPARE(copied.name(), notUniqueNative->name());
COMPARE(copied.comment(), notUniqueNative->comment());
COMPARE(copied.icon(), notUniqueNative->icon());
COMPARE(copied.library(), notUniqueNative->library());
COMPARE(copied.languageBindings(), notUniqueNative->languageBindings());
COMPARE(copied.desktopFilePath(), notUniqueNative->desktopFilePath());
COMPARE(copied.desktopFile(), notUniqueNative->desktopFile());
COMPARE(copied.unique(), notUniqueNative->unique());
COMPARE(copied.hidden(), notUniqueNative->hidden());
}
QTTEST_MAIN(TestAppletInfo)
#include "testAppletInfo.moc"

View File

@ -56,6 +56,8 @@ class TestAppletInfo: public QObject
void unique();
void hidden_data(QtTestTable& t);
void hidden();
void assignment();
void copyConstructor();
private:
Plasma::AppletInfo* notUniqueNative;

View File

@ -4,6 +4,7 @@ Encoding=UTF-8
Name=Unique Javascript Applet
Comment=An applet written in JavaScript
Icon=javascript
Hidden=true
X-KDE-Library=plasma_applet_javascript
X-KDE-LanguageBindings=JavaScript