Fixed naming convention and started writing unit tests
authorKaj Wallin <kaj.wallin@ixonos.com>
Fri, 21 May 2010 07:24:39 +0000 (10:24 +0300)
committerKaj Wallin <kaj.wallin@ixonos.com>
Fri, 21 May 2010 07:24:39 +0000 (10:24 +0300)
Reviewed by:

src/ui/friendlistpanel.cpp
src/ui/panelsliderbar.cpp
src/ui/sidepanel.cpp
src/ui/sidepanel.h
tests/ui/sidepanel/testsidepanel.cpp [new file with mode: 0644]
tests/ui/sidepanel/testsidepanel.pro [new file with mode: 0644]

index ca7bac1..69c1a2d 100644 (file)
@@ -29,7 +29,7 @@ FriendListPanel::FriendListPanel(QWidget *parent)
     : SidePanel(parent)
 {
     qDebug() << __PRETTY_FUNCTION__;
-    setType(SidePanel::FriendsPanel);
+    setType(SidePanel::FriendPanel);
 
     m_friendListView = new FriendListView(this);
     QScrollArea *friendListScroll = new QScrollArea(this);
@@ -39,7 +39,7 @@ FriendListPanel::FriendListPanel(QWidget *parent)
     friendListScroll->widget()->setAutoFillBackground(false);
     m_panelVBox->addWidget(friendListScroll);
 
-    setObjectName("FriendsPanel");
+    setObjectName("FriendPanel");
 }
 
 void FriendListPanel::friendInfoReceived(QList<User *> &friendList)
index 4add008..267608a 100644 (file)
@@ -33,9 +33,9 @@ PanelSliderBar::PanelSliderBar(QWidget *parent, Side side)
         setMask(QPixmap(":/res/images/sliding_bar_left_test.png").mask());
     }
     else if(side == RIGHT) {
-        setObjectName("FriendsPanelSlidingBar");
+        setObjectName("FriendPanelSlidingBar");
         setStyleSheet(QString(
-                "#FriendsPanelSlidingBar{background-image: url(:/res/images/sliding_bar_right_test.png)}"));
+                "#FriendPanelSlidingBar{background-image: url(:/res/images/sliding_bar_right_test.png)}"));
         setMask(QPixmap(":/res/images/sliding_bar_right_test.png").mask());
     }
     else {
index c4129a7..84a7ac6 100644 (file)
@@ -89,7 +89,7 @@ void SidePanel::screenResized(const QSize &size)
         m_panelBase->resize(USERPANEL_WIDTH, SLIDINGBAR_HEIGHT + MARGIN_CORRECTION);
         resize(USERPANEL_WIDTH + SLIDINGBAR_WIDTH,SLIDINGBAR_HEIGHT + MARGIN_CORRECTION);
     }
-    else if(currentType == SidePanel::FriendsPanel)
+    else if(currentType == SidePanel::FriendPanel)
     {
         resize(FRIENDPANEL_WIDTH + SLIDINGBAR_WIDTH, size.height() + MARGIN_CORRECTION);
         m_panelBase->resize(FRIENDPANEL_WIDTH, size.height() + MARGIN_CORRECTION);
@@ -126,8 +126,9 @@ void SidePanel::setType(SidePanel::PanelType type)
                 USERPANEL_CLOSED_X, PANEL_TOP_Y));
         m_panelStateOpened->assignProperty(this, "pos", QPoint(
                 USERPANEL_OPENED_X, PANEL_TOP_Y));
+        setObjectName("UserPanel");
     }
-    else if (type == SidePanel::FriendsPanel) {
+    else if (type == SidePanel::FriendPanel) {
         currentType = type;
         m_panelBase->move(TOP_CORNER_X + SLIDINGBAR_WIDTH,PANEL_TOP_Y);
         m_panelBase->resize(FRIENDPANEL_WIDTH, FRIENDPANEL_HEIGHT);
@@ -142,6 +143,7 @@ void SidePanel::setType(SidePanel::PanelType type)
                 FRIENDPANEL_CLOSED_X, PANEL_TOP_Y));
         m_panelStateOpened->assignProperty(this, "pos", QPoint(
                 FRIENDPANEL_OPENED_X, PANEL_TOP_Y));
+        setObjectName("FriendPanel");
     }
     else {
         qFatal("Illegal type set for SidePanel::setType");
index 7d2dbd9..f8fd98f 100644 (file)
@@ -49,11 +49,11 @@ public:
 
     /**
     * @brief Enumerator for the panel type
-    * Defines values: UserPanel, FriendsPanel
+    * Defines values: UserPanel, FriendPanel
     *
     * @sa setType
     */
-    enum PanelType {UserPanel, FriendsPanel};
+    enum PanelType {UserPanel, FriendPanel};
 /******************************************************************************
  * MEMBER FUNCTIONS AND SLOTS
  ******************************************************************************/
@@ -78,11 +78,11 @@ public slots:
     /**
     * @brief Type setter for the panel. Also sets panel visible
     *
-    * Use to set panel type as UserPanel or FriendsPanel. Panel type determines
+    * Use to set panel type as UserPanel or FriendPanel. Panel type determines
     * which side the panel will be rendered. UserPanel will always be rendered
-    * on the left side of the screen and FriendsPanel on the right side.
+    * on the left side of the screen and FriendPanel on the right side.
     *
-    * @param type Type of the panel, either UserPanel or FriendsPanel
+    * @param type Type of the panel, either UserPanel or FriendPanel
     * @sa PanelType
     */
     void setType(SidePanel::PanelType type);
diff --git a/tests/ui/sidepanel/testsidepanel.cpp b/tests/ui/sidepanel/testsidepanel.cpp
new file mode 100644 (file)
index 0000000..a239af5
--- /dev/null
@@ -0,0 +1,33 @@
+ /*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+        Kaj Wallin - kaj.wallin@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/QtTest>
+
+class TestSidePanel : public QObject
+{
+    Q_OBJECT
+
+private slots:
+    void testPanelTypes();
+    void testPanelToggling();
+};
diff --git a/tests/ui/sidepanel/testsidepanel.pro b/tests/ui/sidepanel/testsidepanel.pro
new file mode 100644 (file)
index 0000000..55268ea
--- /dev/null
@@ -0,0 +1,9 @@
+
+SOURCES += \
+    testsidepanel.cpp
+
+HEADERS += \
+    ../../../src/ui/sidepanel.h \
+    ../../../src/ui/panelsliderbar.h \
+    ../../../src/ui/panelcommon.h \
+    ../../../src/map/mapcommon.h