Generic button and testbench for it created.
[situare] / tests / ui / buttonitem / testbuttonitem.cpp
diff --git a/tests/ui/buttonitem/testbuttonitem.cpp b/tests/ui/buttonitem/testbuttonitem.cpp
new file mode 100644 (file)
index 0000000..a90cebe
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+     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/buttonitem.h"
+#include <QDebug>
+
+class TestButtonItem: public QObject
+{
+    Q_OBJECT
+private slots:
+    void constructorTest();
+    void buttonSizeHintTest();
+};
+
+/**
+* @brief Tests that the button constructor works.
+*/
+void TestButtonItem::constructorTest()
+{
+    ButtonItem *myButton = new ButtonItem();
+    QVERIFY(myButton);
+    delete myButton;
+    myButton = NULL;
+    QVERIFY(!myButton);
+}
+
+/**
+* @brief Tests that the button size is correct.
+*/
+void TestButtonItem::buttonSizeHintTest()
+{
+    ButtonItem *myButton = new ButtonItem();
+    myButton->setIcon(QIcon(QPixmap(":/resources/reload_icon.png")));
+}
+
+
+QTEST_MAIN(TestButtonItem)
+#include "testbuttonitem.moc"
+
+