messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/msgconversationwidgetheaders.h
changeset 56 f42d9a78f435
parent 55 5b3b2fa8c3ec
child 58 5401a102f08b
equal deleted inserted replaced
55:5b3b2fa8c3ec 56:f42d9a78f435
     1 /*
       
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef T_MSGCONVERSATIONWIDGET_HEADERS_H
       
    19 #define T_MSGCONVERSATIONWIDGET_HEADERS_H
       
    20 
       
    21 #include <QGraphicsWidget>
       
    22 
       
    23 #include "convergedmessage.h"
       
    24 #include "debugtraces.h"
       
    25 
       
    26 #define QCoreApplication QCoreApplication2
       
    27 
       
    28 /*
       
    29     Mocked HbEvent class.
       
    30  */
       
    31 class HbEvent : public QObject
       
    32 {
       
    33     Q_OBJECT
       
    34 public:
       
    35 	  enum Flags{
       
    36 	  	ThemeChanged
       
    37 	  	};
       
    38 	  	
       
    39     HbEvent(HbEvent::Flags flag)
       
    40     {
       
    41     }
       
    42     ~HbEvent()
       
    43     {        
       
    44     }
       
    45         
       
    46 private:
       
    47     Q_DISABLE_COPY(HbEvent)   
       
    48 };
       
    49 
       
    50 /*
       
    51     Mocked QCoreApplication class.
       
    52  */
       
    53  class MSG;
       
    54  
       
    55 class QCoreApplication2 : public QObject
       
    56 {
       
    57     Q_OBJECT
       
    58 public:
       
    59 	enum EventFilter
       
    60 	{
       
    61 		CodecForTr, UnicodeUTF8, DefaultCodec 
       
    62 	};
       
    63 		
       
    64     QCoreApplication ( int & argc, char ** argv )  {}
       
    65     ~QCoreApplication ()  {}
       
    66     bool filterEvent ( void * message, long * result ) {}
       
    67     virtual bool notify ( QObject * receiver, QEvent * event ) {}
       
    68     EventFilter setEventFilter ( EventFilter filter ) {}
       
    69     virtual bool winEventFilter ( MSG * msg, long * result ) {}
       
    70     static void postEvent(QObject* ref, HbEvent* ob) {}
       
    71 
       
    72 private:
       
    73     Q_DISABLE_COPY(QCoreApplication)   
       
    74 };
       
    75 
       
    76 /*
       
    77     Mocked Hb class.
       
    78  */
       
    79 class Hb : public QObject
       
    80 {
       
    81     Q_OBJECT
       
    82 public:
       
    83 	enum Flags{
       
    84 		TextCursorHidden
       
    85 		
       
    86 	};
       
    87 	
       
    88     Hb(QObject *parent = NULL)
       
    89     {
       
    90     }
       
    91     ~Hb()
       
    92     {        
       
    93     }
       
    94         
       
    95 private:
       
    96     Q_DISABLE_COPY(Hb)   
       
    97 };
       
    98 
       
    99 /*
       
   100     Mocked HbIcon class.
       
   101  */
       
   102 class HbIcon
       
   103 {
       
   104   
       
   105 public:
       
   106   
       
   107     HbIcon (const QString &iconName)  {}
       
   108     HbIcon (const QIcon &icon) {}
       
   109     HbIcon (const HbIcon &other) {}
       
   110 
       
   111     QSizeF size() const {}
       
   112 private:
       
   113     //Q_DISABLE_COPY(HbIcon)
       
   114 };
       
   115 
       
   116 /*
       
   117     Mocked HbIconItem class.
       
   118  */
       
   119 
       
   120 class HbIconItem : public QGraphicsWidget
       
   121 {
       
   122     Q_OBJECT
       
   123 public:
       
   124     HbIconItem(QGraphicsWidget *parent = NULL)
       
   125     {
       
   126     }
       
   127     ~HbIconItem()
       
   128     {        
       
   129     }
       
   130         void setAlignment(Qt::Alignment alignment) {}
       
   131         void setIcon(const HbIcon &icon) {}
       
   132         void setPreferredSize(QSizeF size) {}
       
   133         void show(){}
       
   134         void setIconName(const QString& name) {}
       
   135 private:
       
   136     Q_DISABLE_COPY(HbIconItem)
       
   137 private:    
       
   138 };
       
   139 
       
   140 /*
       
   141     Mocked HbTextItem class.
       
   142  */
       
   143 class HbTextItem : public QGraphicsWidget
       
   144 {
       
   145     Q_OBJECT
       
   146 public:
       
   147     HbTextItem(QGraphicsWidget *parent = NULL)
       
   148     {
       
   149     }
       
   150     ~HbTextItem()
       
   151     {        
       
   152     }
       
   153     void setText(const QString &timeStamp){}
       
   154     void show(){}
       
   155 private:
       
   156     Q_DISABLE_COPY(HbTextItem)
       
   157 private:    
       
   158 };
       
   159 
       
   160 /*
       
   161     Mocked HbIconItem class.
       
   162  */
       
   163 extern int hbtextedit_setsmileysenabled_callcount;
       
   164 extern int hbtextedit_setreadonly_callcount;
       
   165  
       
   166 class HbTextEdit : public QGraphicsWidget
       
   167 {
       
   168     Q_OBJECT
       
   169 public:
       
   170     HbTextEdit(QGraphicsWidget *parent = NULL)
       
   171     {
       
   172     }
       
   173     ~HbTextEdit()
       
   174     {        
       
   175     }
       
   176         void setReadOnly(bool status) {
       
   177         	hbtextedit_setreadonly_callcount++;
       
   178         	}
       
   179         void setBackgroundItem(int back) {}
       
   180         void setSmileysEnabled(bool status) {
       
   181         	hbtextedit_setsmileysenabled_callcount++;
       
   182         	}
       
   183         void setFlag(QGraphicsWidget::GraphicsItemFlag flag,bool status) {}
       
   184         void setPlainText(QString text) {}
       
   185         void show() {}
       
   186         void setCursorVisibility(Hb::Flags flag) {}
       
   187 private:
       
   188     Q_DISABLE_COPY(HbTextEdit)
       
   189 private:    
       
   190 };
       
   191 
       
   192 /*
       
   193     Mocked HbStyle class.
       
   194  */
       
   195 extern int hbstyle_setitemname_callcount;
       
   196 
       
   197 class HbStyle: public QObject
       
   198 {
       
   199     Q_OBJECT
       
   200 public:
       
   201 	enum{
       
   202 		P_None
       
   203 	};
       
   204     HbStyle(QObject *parent = NULL)
       
   205     {
       
   206     }
       
   207     
       
   208     void static setItemName(QGraphicsWidget* bubbleFrameItem, QString type)
       
   209     {
       
   210     	hbstyle_setitemname_callcount++;
       
   211     }
       
   212     
       
   213 private:
       
   214     Q_DISABLE_COPY(HbStyle)
       
   215 };
       
   216 
       
   217 /*
       
   218     Mocked HbFrameDrawer class.
       
   219  */
       
   220  extern int hbframedrawer_setframetype_callcount;
       
   221  
       
   222 class HbFrameDrawer: public QObject
       
   223 {
       
   224     Q_OBJECT
       
   225 public:
       
   226 		enum PieceSize{
       
   227 		OnePieces,
       
   228 		TwoPieces,
       
   229 		ThreePiecesVertical,
       
   230 		FourPieces,
       
   231 		NinePieces
       
   232 	};
       
   233     HbFrameDrawer(QObject *parent = NULL)
       
   234     {
       
   235     }
       
   236     void setFrameType(HbFrameDrawer::PieceSize piece)
       
   237     	{
       
   238     		hbframedrawer_setframetype_callcount++;
       
   239     	}
       
   240     	
       
   241     	void setFrameGraphicsName(const QString name) {}
       
   242     	
       
   243 private:
       
   244     Q_DISABLE_COPY(HbFrameDrawer)
       
   245 };
       
   246 
       
   247 /*
       
   248     Mocked HbFrameItem class.
       
   249  */
       
   250 extern int hbframeitem_framedrawer_callcount;
       
   251  
       
   252 class HbFrameItem : public QGraphicsWidget
       
   253 {
       
   254     Q_OBJECT
       
   255     
       
   256 public:
       
   257 	
       
   258     HbFrameItem(QGraphicsWidget *parent = NULL)
       
   259     {
       
   260     }
       
   261     ~HbFrameItem()
       
   262     {        
       
   263     }
       
   264     
       
   265 HbFrameDrawer& frameDrawer  ( )  
       
   266 {
       
   267 	hbframeitem_framedrawer_callcount++;
       
   268 	return frameDraw;
       
   269 }
       
   270     
       
   271 private:
       
   272     Q_DISABLE_COPY(HbFrameItem)
       
   273 private:
       
   274     HbFrameDrawer frameDraw;    
       
   275 };
       
   276 
       
   277 /*
       
   278     Include the header file of the class under test.
       
   279  */
       
   280 #include "../../../inc/msgconversationwidget.h"
       
   281 
       
   282 #endif /* T_MSGCONVERSATIONWIDGET_HEADERS_H */