From: Kaj Wallin Date: Fri, 21 May 2010 07:24:39 +0000 (+0300) Subject: Fixed naming convention and started writing unit tests X-Git-Tag: v0.5~28^2~8 X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=2c10cad408be49e159a320c80cea5aee0c5da077;p=situare Fixed naming convention and started writing unit tests Reviewed by: --- diff --git a/src/ui/friendlistpanel.cpp b/src/ui/friendlistpanel.cpp index ca7bac1..69c1a2d 100644 --- a/src/ui/friendlistpanel.cpp +++ b/src/ui/friendlistpanel.cpp @@ -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 &friendList) diff --git a/src/ui/panelsliderbar.cpp b/src/ui/panelsliderbar.cpp index 4add008..267608a 100644 --- a/src/ui/panelsliderbar.cpp +++ b/src/ui/panelsliderbar.cpp @@ -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 { diff --git a/src/ui/sidepanel.cpp b/src/ui/sidepanel.cpp index c4129a7..84a7ac6 100644 --- a/src/ui/sidepanel.cpp +++ b/src/ui/sidepanel.cpp @@ -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"); diff --git a/src/ui/sidepanel.h b/src/ui/sidepanel.h index 7d2dbd9..f8fd98f 100644 --- a/src/ui/sidepanel.h +++ b/src/ui/sidepanel.h @@ -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 index 0000000..a239af5 --- /dev/null +++ b/tests/ui/sidepanel/testsidepanel.cpp @@ -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 + +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 index 0000000..55268ea --- /dev/null +++ b/tests/ui/sidepanel/testsidepanel.pro @@ -0,0 +1,9 @@ + +SOURCES += \ + testsidepanel.cpp + +HEADERS += \ + ../../../src/ui/sidepanel.h \ + ../../../src/ui/panelsliderbar.h \ + ../../../src/ui/panelcommon.h \ + ../../../src/map/mapcommon.h