--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jukka Saastamoinen - jukka.saastamoinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include <QtTest>
+#include <QtGui>
+#include "ui/pixmap.h"
+
+
+class TestPixmap: public QObject
+{
+ Q_OBJECT
+private slots:
+ void constructorTest();
+ void boundingRegionTest();
+private:
+ bool pixelCompareImages( const QImage &a, const QImage &b );
+};
+
+/**
+* @brief Tests that the class accepts the png file used to draw the image
+*/
+void TestPixmap::constructorTest()
+{
+ Pixmap *infoTab = new Pixmap(QPixmap("dummy_personal_infotab_background.png"));
+ delete infoTab;
+ infoTab=NULL;
+ QVERIFY(!infoTab);
+}
+
+/**
+* @brief Tests that the bounding area reserved for the picture is the same as
+* the picture size.
+*/
+
+void TestPixmap::boundingRegionTest()
+{
+ Pixmap testPic(QPixmap("dummy_personal_infotab_background.png")); //350x300 pix
+ QPixmap refPic("dummy_personal_infotab_background.png");
+ QRectF boundArea = testPic.boundingRect();
+ QRectF refArea;
+ refArea.setSize(refPic.size());
+ QVERIFY(boundArea.size()==refArea.size());
+}
+
+bool TestPixmap::pixelCompareImages( const QImage &a, const QImage &b )
+{
+ if( a.size() != b.size() )
+ return false;
+
+ if( a.format() != b.format() )
+ return false;
+
+ for( int x=0; x<a.width(); ++x )
+ for( int y=0; y<a.height(); ++y )
+ if( a.pixel(x,y) != b.pixel(x,y) )
+ return false;
+
+ return true;
+}
+
+QTEST_MAIN(TestPixmap)
+#include "testpixmap.moc"
+
+