Personal infotab contents merged, reviewed by wallika
authorJukka Saastamoinen <juksa@czc6303cj1.ixonos.local>
Thu, 15 Apr 2010 10:18:46 +0000 (13:18 +0300)
committerJukka Saastamoinen <juksa@czc6303cj1.ixonos.local>
Thu, 15 Apr 2010 10:18:46 +0000 (13:18 +0300)
24 files changed:
src/images.qrc [new file with mode: 0644]
src/resources/arrow_button.png [new file with mode: 0644]
src/resources/arrow_left.png [new file with mode: 0755]
src/resources/arrow_right.png [new file with mode: 0755]
src/resources/clock_small.png [new file with mode: 0644]
src/resources/compas_small.png [new file with mode: 0644]
src/resources/facebook_user_64.png [new file with mode: 0644]
src/resources/list_small.png [new file with mode: 0644]
src/resources/personal_infotab_background.png [new file with mode: 0644]
src/resources/reload_icon.png [new file with mode: 0644]
src/resources/sendPosition_icon.png [new file with mode: 0644]
src/resources/separe_line.png [new file with mode: 0644]
src/resources/top_separtor.png [new file with mode: 0644]
src/src.pro
src/ui/infotab.cpp [new file with mode: 0644]
src/ui/infotab.h [new file with mode: 0644]
src/ui/listviewscreen.cpp
src/ui/listviewscreen.h
src/ui/mapviewscreen.cpp
src/ui/pixmap.cpp [new file with mode: 0644]
src/ui/pixmap.h [new file with mode: 0644]
tests/ui/pixmap/dummy_personal_infotab_background.png [new file with mode: 0644]
tests/ui/pixmap/testpixmap.cpp [new file with mode: 0644]
tests/ui/pixmap/testpixmap.pro [new file with mode: 0644]

diff --git a/src/images.qrc b/src/images.qrc
new file mode 100644 (file)
index 0000000..7095d4f
--- /dev/null
@@ -0,0 +1,12 @@
+<RCC>
+    <qresource prefix="/">
+        <file>resources/facebook_user_64.png</file>
+        <file>resources/compas_small.png</file>
+        <file>resources/reload_icon.png</file>
+        <file>resources/sendPosition_icon.png</file>
+        <file>resources/list_small.png</file>
+        <file>resources/clock_small.png</file>
+        <file>resources/arrow_left.png</file>
+        <file>resources/arrow_right.png</file>
+    </qresource>
+</RCC>
diff --git a/src/resources/arrow_button.png b/src/resources/arrow_button.png
new file mode 100644 (file)
index 0000000..0de60a2
Binary files /dev/null and b/src/resources/arrow_button.png differ
diff --git a/src/resources/arrow_left.png b/src/resources/arrow_left.png
new file mode 100755 (executable)
index 0000000..454fbdb
Binary files /dev/null and b/src/resources/arrow_left.png differ
diff --git a/src/resources/arrow_right.png b/src/resources/arrow_right.png
new file mode 100755 (executable)
index 0000000..4a43016
Binary files /dev/null and b/src/resources/arrow_right.png differ
diff --git a/src/resources/clock_small.png b/src/resources/clock_small.png
new file mode 100644 (file)
index 0000000..50efd6e
Binary files /dev/null and b/src/resources/clock_small.png differ
diff --git a/src/resources/compas_small.png b/src/resources/compas_small.png
new file mode 100644 (file)
index 0000000..a85e802
Binary files /dev/null and b/src/resources/compas_small.png differ
diff --git a/src/resources/facebook_user_64.png b/src/resources/facebook_user_64.png
new file mode 100644 (file)
index 0000000..b828219
Binary files /dev/null and b/src/resources/facebook_user_64.png differ
diff --git a/src/resources/list_small.png b/src/resources/list_small.png
new file mode 100644 (file)
index 0000000..d250a1f
Binary files /dev/null and b/src/resources/list_small.png differ
diff --git a/src/resources/personal_infotab_background.png b/src/resources/personal_infotab_background.png
new file mode 100644 (file)
index 0000000..a9b30ec
Binary files /dev/null and b/src/resources/personal_infotab_background.png differ
diff --git a/src/resources/reload_icon.png b/src/resources/reload_icon.png
new file mode 100644 (file)
index 0000000..7ffa4ec
Binary files /dev/null and b/src/resources/reload_icon.png differ
diff --git a/src/resources/sendPosition_icon.png b/src/resources/sendPosition_icon.png
new file mode 100644 (file)
index 0000000..5c44ea3
Binary files /dev/null and b/src/resources/sendPosition_icon.png differ
diff --git a/src/resources/separe_line.png b/src/resources/separe_line.png
new file mode 100644 (file)
index 0000000..8d9bb0e
Binary files /dev/null and b/src/resources/separe_line.png differ
diff --git a/src/resources/top_separtor.png b/src/resources/top_separtor.png
new file mode 100644 (file)
index 0000000..d21c24a
Binary files /dev/null and b/src/resources/top_separtor.png differ
index cb15dd3..4f084e6 100644 (file)
@@ -1,13 +1,9 @@
-#-------------------------------------------------
-#
+# -------------------------------------------------
 # Project created by QtCreator 2010-03-26T07:57:35
-#
-#-------------------------------------------------
-
+# -------------------------------------------------
 TARGET = ../situare
 TEMPLATE = app
-
-
+RESOURCES += images.qrc
 SOURCES += main.cpp \
     ui/mainwindow.cpp \
     ui/mapviewscreen.cpp \
@@ -16,8 +12,9 @@ SOURCES += main.cpp \
     map/mapview.cpp \
     map/mapscene.cpp \
     map/maptile.cpp \
-    map/mapfetcher.cpp
-    
+    map/mapfetcher.cpp \
+    ui/pixmap.cpp \
+    ui/infotab.cpp
 HEADERS += ui/mainwindow.h \
     ui/mapviewscreen.h \
     ui/listviewscreen.h \
@@ -26,34 +23,30 @@ HEADERS += ui/mainwindow.h \
     map/mapscene.h \
     map/maptile.h \
     map/mapfetcher.h \
-    common.h
-
+    common.h \
+    ui/pixmap.h \
+    ui/infotab.h
 QT += network \
-      webkit
+    webkit
 
 # -----------------------------------------------------------------
-#                      Debian packetizing additions
+# Debian packetizing additions
 # -----------------------------------------------------------------
-unix {
-#VARIABLES
-    isEmpty(PREFIX) {
-        PREFIX = /usr
-    }
-BINDIR = $$PREFIX/bin
-DATADIR =$$PREFIX/share
-
-DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\"
-
-#MAKE INSTALL
-
-desktop.path = $$DATADIR/applications/hildon
-desktop.files += situare.desktop
-INSTALLS += desktop
-
-icon26.path = $$DATADIR/icons/hicolor/26x26/apps
-icon26.files += situare.png
-INSTALLS += icon26
-
-target.path = $$BINDIR
-INSTALLS += target
+unix { 
+    # VARIABLES
+    isEmpty(PREFIX):PREFIX = /usr
+    BINDIR = $$PREFIX/bin
+    DATADIR = $$PREFIX/share
+    DEFINES += DATADIR=\\\"$$DATADIR\\\" \
+        PKGDATADIR=\\\"$$PKGDATADIR\\\"
+    
+    # MAKE INSTALL
+    desktop.path = $$DATADIR/applications/hildon
+    desktop.files += situare.desktop
+    INSTALLS += desktop
+    icon26.path = $$DATADIR/icons/hicolor/26x26/apps
+    icon26.files += situare.png
+    INSTALLS += icon26
+    target.path = $$BINDIR
+    INSTALLS += target
 }
diff --git a/src/ui/infotab.cpp b/src/ui/infotab.cpp
new file mode 100644 (file)
index 0000000..3f11fa0
--- /dev/null
@@ -0,0 +1,122 @@
+#include "infotab.h"
+
+InfoTab::InfoTab(QWidget *parent)
+    : QWidget(parent, Qt::FramelessWindowHint)
+{
+    layout = new QGridLayout(this);
+    userPicture = new QLabel;
+    userNameLabel = new QLabel;
+    messageLabel = new QLabel;
+    addressLabel = new QLabel;
+    timeLabel = new QLabel;
+    QLabel *clockLabel = new QLabel;
+    QLabel *envelopeLabel = new QLabel;
+    QLabel *compassLabel = new QLabel;
+    QToolButton *sendLocationButton = new QToolButton;
+    QToolButton *updateStatusMessageButton = new QToolButton;
+
+    sendLocationButton->setIcon(QIcon(QPixmap(":/resources/reload_icon.png")));
+    updateStatusMessageButton->setIcon(QIcon(QPixmap(":/resources/sendPosition_icon.png")));
+
+    clockLabel->setPixmap(QPixmap(":/resources/clock_small.png"));
+    envelopeLabel->setPixmap(QPixmap(":/resources/list_small.png"));
+    compassLabel->setPixmap(QPixmap(":/resources/compas_small.png"));
+    layout->addWidget(userPicture,0,0,4,1);
+    layout->addWidget(userNameLabel,0,2,1,2);
+    layout->addWidget(clockLabel,1,1,1,1);
+    layout->addWidget(envelopeLabel,2,1,1,1);
+    layout->addWidget(compassLabel,3,1,1,1);
+    layout->addWidget(timeLabel,1,2,1,1);
+    layout->addWidget(messageLabel,2,2,1,1);
+    layout->addWidget(addressLabel,3,2,1,1);
+    layout->addWidget(sendLocationButton,0,3,2,1);
+    layout->addWidget(updateStatusMessageButton,1,3,2,1);
+
+}
+
+InfoTab::~InfoTab()
+{
+    if (userPicture)
+        delete userPicture;
+    if (userNameLabel)
+        delete userNameLabel;
+    if (messageLabel)
+        delete messageLabel;
+    if (addressLabel)
+        delete addressLabel;
+    if (timeLabel)
+        delete timeLabel;
+    if (layout)
+        delete layout;
+    userPicture=NULL;
+    userNameLabel=NULL;
+    messageLabel=NULL;
+    addressLabel=NULL;
+    timeLabel=NULL;
+    layout=NULL;
+}
+
+void InfoTab::paintEvent(QPaintEvent *aPaintEvent)
+{
+    //Look and feel settings
+    QPalette qpalette;
+    QColor myColor(Qt::black);
+    myColor.setAlpha(50);
+    qpalette.setColor(QPalette::Background,myColor);
+    setPalette(qpalette);
+    int roundness(6);
+
+    QRect widgetRect = this->rect();
+    QPainter painter(this);
+    painter.save();
+
+    painter.setRenderHint(QPainter::Antialiasing);
+    QPainterPath roundedRect;
+    roundedRect.addRoundedRect(1,1,widgetRect.width() - 2, widgetRect.height()-2,roundness,roundness);
+
+    painter.setClipPath(roundedRect);
+    QRegion maskRegion = painter.clipRegion();
+
+    setMask(maskRegion);
+
+    painter.fillPath(roundedRect,QBrush(myColor));
+    painter.restore();
+}
+
+void InfoTab::setAvatar(const QPixmap &avat)
+{
+    avatar = avat;
+    userPicture->setPixmap(avat);
+}
+
+void InfoTab::setUserName(const QString &usernam)
+{
+    if(userName == usernam)
+      return;
+    userName = usernam;
+    userNameLabel->setText(userName);
+}
+
+void InfoTab::setMessageText(const QString &text)
+{
+    if(messageText == text)
+      return;
+    messageText = text;
+    messageLabel->setText(messageText);
+}
+
+void InfoTab::setAddress(const QString &addr)
+{
+    if(address == addr)
+      return;
+    address = addr;
+    addressLabel->setText(address);
+}
+
+void InfoTab::setTime(const QString &tim)
+{
+    if(time == tim)
+      return;
+    time = tim;
+    timeLabel->setText(time);
+}
diff --git a/src/ui/infotab.h b/src/ui/infotab.h
new file mode 100644 (file)
index 0000000..4171d97
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+   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.
+*/
+
+#ifndef INFOTAB_H
+#define INFOTAB_H
+
+#include <QtGui>
+#include <QWidget>
+
+/**
+* @brief Pixmap class.
+* Composite custom widget class used to show user information
+* @author Jukka Saastamoinen
+*/
+
+class InfoTab : public QWidget
+{
+    Q_OBJECT
+public:
+    /**
+    * @brief Constructor
+    *
+    * @param parent Parent
+    */
+    InfoTab(QWidget *parent=0);
+    /**
+    *
+    * @brief Destructor
+    */
+    ~InfoTab();
+public slots:
+    /**
+    * @brief Sets the user picture
+    *
+    * @param avat Reference to user picture
+    */
+    void setAvatar(const QPixmap & avat);
+    /**
+    * @brief Sets the user name
+    *
+    * @param usernam Reference to user name
+    */
+    void setUserName(const QString &usernam);
+    /**
+    * @brief Sets the message text
+    *
+    * @param text Reference to user message
+    */
+    void setMessageText(const QString &text);
+    /**
+    * @brief Sets the users current address
+    *
+    * @param addr Reference to users current address
+    */
+    void setAddress(const QString &addr);
+    /**
+    * @brief Sets the time of updated message
+    *
+    * @param tim Reference to time when message was sent.
+    */
+    void setTime(const QString &tim);
+protected:
+    /**
+    * @brief This function is called when the widget is drawn
+    *
+    * @param aPaintEvent Pointer to paint event
+    */
+    void paintEvent(QPaintEvent *aPaintEvent);
+private:
+    QLabel *userPicture;
+    QLabel *userNameLabel;
+    QLabel *messageLabel;
+    QLabel *addressLabel;
+    QLabel *timeLabel;
+    QGridLayout *layout;
+    QString messageText;
+    QString userName;
+    QString address;
+    QString time;
+    QPixmap avatar;
+};
+
+#endif // INFOTAB_H
index c1084d2..2e02e2c 100644 (file)
@@ -3,6 +3,7 @@
    Copyright (C) 2010  Ixonos Plc. Authors:
 
       Kaj Wallin - kaj.wallin@ixonos.com
+      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
    USA.
 */
 
+#include <QGraphicsScene>
+#include <QGraphicsView>
+#include <QGraphicsWidget>
+#include <QtGui/QVBoxLayout>
+#include <QGraphicsProxyWidget>
+#include <QStateMachine>
 #include "listviewscreen.h"
+#include "pixmap.h"
+#include "infotab.h"
+#include <QDebug>
 
 ListViewScreen::ListViewScreen(QWidget *parent)
    : QWidget(parent)
 {
-   QPushButton *listViewButton = new QPushButton(tr("This is listview"));
-   QHBoxLayout *listViewLayout = new QHBoxLayout;
-   listViewLayout->addWidget(listViewButton);
-   setLayout(listViewLayout);
+    Pixmap *arrowbutton = new Pixmap(QPixmap(":/resources/arrow_right.png"));
+
+    InfoTab *personalInfo = new InfoTab;
+    personalInfo->setAvatar(QPixmap(":/resources/facebook_user_64.png"));
+    personalInfo->setUserName("Fred Facebook");
+    personalInfo->setMessageText("Hello Maemo Situare !");
+    personalInfo->setTime("1 hour ago");
+    personalInfo->setAddress("Kiviharjunlenkki 1E, 91910 Oulu");
+
+    QGraphicsProxyWidget *widgetProxy = new QGraphicsProxyWidget();
+    widgetProxy->setWidget(personalInfo);
+
+    QGraphicsScene *scene= new QGraphicsScene();
+    QGraphicsWidget *graphWidget = new QGraphicsWidget();
+    graphLayout = new QGraphicsLinearLayout(graphWidget);
+    graphLayout->setOrientation(Qt::Horizontal);
+    graphLayout->addItem(widgetProxy);
+    scene->setBackgroundBrush(Qt::white);    
+    scene->addItem(graphWidget);
+    scene->addItem(arrowbutton);
+    qDebug() << "Scene width: " << scene->width();
+    qDebug() << "Scene heigth: " << scene->height();
+
+    QGraphicsView *view = new QGraphicsView(scene);
+    view->setAlignment(Qt::AlignLeft|Qt::AlignTop);
+    view->setSceneRect(0,0,7000,3000);
+    view->centerOn(QPointF(0,0));
+    view->setFrameStyle(0);
+    view->setAlignment(Qt::AlignLeft | Qt::AlignTop);
+    view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+
+    QStateMachine *machine = new QStateMachine;
+    machine->setGlobalRestorePolicy(QStateMachine::RestoreProperties);
+
+    QState *state1 = new QState(machine);
+    QState *state2 = new QState(machine);
+    machine->setInitialState(state1);
+
+    // State 1
+    state1->assignProperty(graphWidget,"pos",QPointF(-(personalInfo->width()+20),0));
+    state1->assignProperty(arrowbutton,"pos",QPointF(0,(arrowbutton->boundingRect().height()/2)+10));
+
+    // State 2
+    state2->assignProperty(graphWidget,"pos",QPointF(-20,0));
+    state2->assignProperty(arrowbutton,"pos",QPointF((personalInfo->width()-5),(arrowbutton->boundingRect().height()/2)+10));
+
+    QAbstractTransition *trans1 = state1->addTransition(arrowbutton,SIGNAL(clicked()),state2);
+    trans1->addAnimation(new QPropertyAnimation(graphWidget,"pos"));
+    trans1->addAnimation(new QPropertyAnimation(arrowbutton,"pos"));
+
+    QAbstractTransition *trans2 = state2->addTransition(arrowbutton,SIGNAL(clicked()),state1);
+    trans2->addAnimation(new QPropertyAnimation(graphWidget,"pos"));
+    trans2->addAnimation(new QPropertyAnimation(arrowbutton,"pos"));
+
+    machine->start();
+
+    vbox = new QVBoxLayout(this);
+    vbox->addWidget(view);
+}
+
+ListViewScreen::~ListViewScreen()
+{
+    if (vbox)
+        delete vbox;
+    if (graphLayout)
+        delete graphLayout;
+    vbox=NULL;
+    graphLayout=NULL;
 }
index f9578a3..67f4e20 100644 (file)
@@ -34,6 +34,10 @@ class ListViewScreen : public QWidget
 {
 public:
     ListViewScreen(QWidget *parent = 0);
+    ~ListViewScreen();
+private:
+    QVBoxLayout *vbox;
+    QGraphicsLinearLayout *graphLayout;
 };
 
 #endif // LISTVIEWTAB_H
index 82b89dc..1bd35eb 100644 (file)
 */
 
 #include "mapviewscreen.h"
+#include "infotab.h"
 #include "../map/mapview.h"
 #include "../map/mapengine.h"
+#include "infotab.h"
 
 MapViewScreen::MapViewScreen(QWidget *parent)
    : QWidget(parent)
diff --git a/src/ui/pixmap.cpp b/src/ui/pixmap.cpp
new file mode 100644 (file)
index 0000000..387358e
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+   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 "pixmap.h"
+#include <QDebug>
+
+Pixmap::Pixmap(const QPixmap &picture, QGraphicsObject *parent)
+    : QGraphicsObject(parent), p(picture)
+{
+}
+
+void Pixmap::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+    emit clicked();
+    qDebug() << __PRETTY_FUNCTION__;
+}
+
+void Pixmap::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+{
+    painter->drawPixmap(QPointF(), p);
+}
+
+QRectF Pixmap::boundingRect() const
+{
+    return QRectF( QPointF(0, 0), p.size());
+}
diff --git a/src/ui/pixmap.h b/src/ui/pixmap.h
new file mode 100644 (file)
index 0000000..40e2c63
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+   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.
+*/
+
+#ifndef PIXMAP_H
+#define PIXMAP_H
+
+#include <QtCore>
+#include <QtGui>
+
+/**
+* @brief Pixmap class.
+*
+* General purpose class used to display graphical objects
+* that can be animated.
+* @author Jukka Saastamoinen
+*/
+
+class Pixmap : public QGraphicsObject
+{
+    Q_OBJECT
+public:
+    /**
+    * @brief Constructor
+    *
+    * @param Reference to the picture displayed
+    * @param parent Parent
+    */
+    Pixmap(const QPixmap &, QGraphicsObject *parent = 0);
+    /**
+    * @brief Mouse press event
+    *
+    * @param event Mouse event
+    */
+    void mousePressEvent(QGraphicsSceneMouseEvent *event);
+    /**
+    * @brief Bounding box of the drawed pixmap
+    *
+    * @return Rectangle shaped bounding box of the pixmap
+    */
+    QRectF boundingRect() const;
+protected:
+    /**
+    * @brief Drawer of the given picture
+    *
+    * @param painter Pointer to painting class
+    * @param Pointer to class describing parameters needed to draw the item
+    * @param Pointer to the widget
+    */
+    void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
+signals:
+    /**
+    * @brief Signal which is emitted when the pixmap
+    * bounding box area is clicked.
+    */
+    void clicked();
+private:
+    QPixmap p;
+};
+
+#endif // PIXMAP_H
diff --git a/tests/ui/pixmap/dummy_personal_infotab_background.png b/tests/ui/pixmap/dummy_personal_infotab_background.png
new file mode 100644 (file)
index 0000000..08dca9d
Binary files /dev/null and b/tests/ui/pixmap/dummy_personal_infotab_background.png differ
diff --git a/tests/ui/pixmap/testpixmap.cpp b/tests/ui/pixmap/testpixmap.cpp
new file mode 100644 (file)
index 0000000..e229a79
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+     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();
+};
+
+/**
+* @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());
+}
+
+
+QTEST_MAIN(TestPixmap)
+#include "testpixmap.moc"
+
+
diff --git a/tests/ui/pixmap/testpixmap.pro b/tests/ui/pixmap/testpixmap.pro
new file mode 100644 (file)
index 0000000..b562322
--- /dev/null
@@ -0,0 +1,10 @@
+CONFIG += qtestlib
+TEMPLATE = app
+TARGET = pixmap 
+DEPENDPATH += .
+INCLUDEPATH += . \
+    ../../../src/
+
+SOURCES += testpixmap.cpp \
+       ../../../src/ui/pixmap.cpp
+HEADERS += ../../../src/ui/pixmap.h