Changeset View
Changeset View
Standalone View
Standalone View
tests/libkopete/kopetepicturetest.cpp
- This file was added.
1 | #include "kopetepicture.h" | ||||
---|---|---|---|---|---|
2 | | ||||
3 | #include <QtTest> | ||||
4 | #include <QObject> | ||||
5 | | ||||
6 | class KopetePictureTest : public QObject | ||||
7 | { | ||||
8 | Q_OBJECT | ||||
9 | private slots: | ||||
10 | void PictureTest(); | ||||
11 | }; | ||||
12 | | ||||
13 | void KopetePictureTest::PictureTest() | ||||
14 | { | ||||
15 | QString path = QStringLiteral("./null_image_for_testing.png"); | ||||
16 | QImage image(path); | ||||
17 | | ||||
18 | Kopete::Picture picture; | ||||
19 | QVERIFY(picture.isNull()); | ||||
20 | | ||||
21 | picture.setPicture(path); | ||||
22 | QVERIFY(!picture.isNull()); | ||||
23 | Kopete::Picture newPicture(picture); | ||||
24 | QVERIFY(!newPicture.isNull()); | ||||
25 | const QImage newImage = picture.image(); | ||||
26 | QCOMPARE(newImage, image); | ||||
27 | QString newPath = picture.path(); | ||||
28 | QCOMPARE(newPath, path); | ||||
29 | | ||||
30 | picture.clear(); | ||||
31 | QVERIFY(picture.isNull()); | ||||
32 | newPicture.clear(); | ||||
33 | QVERIFY(newPicture.isNull()); | ||||
34 | } | ||||
35 | | ||||
36 | QTEST_MAIN(KopetePictureTest) | ||||
37 | #include "kopetepicturetest.moc" |