|
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: Mocked classes for testing CalenDayItem class |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef HBMAINWINDOW_H |
|
19 #define HBMAINWINDOW_H |
|
20 |
|
21 #include <HbView> |
|
22 |
|
23 // Test variables |
|
24 extern QRectF gTestWindowRect; |
|
25 extern Qt::Orientation gTestOrientation; |
|
26 |
|
27 /*! |
|
28 Mocked class HbMainWindow (simulating window in unittests) |
|
29 */ |
|
30 class HbMainWindow |
|
31 { |
|
32 public: |
|
33 HbMainWindow() { |
|
34 mView = new HbView(); |
|
35 } |
|
36 |
|
37 ~HbMainWindow() { |
|
38 if (mView) { |
|
39 delete mView; |
|
40 mView = 0; |
|
41 } |
|
42 } |
|
43 |
|
44 QRectF layoutRect() const { |
|
45 return gTestWindowRect; |
|
46 } |
|
47 |
|
48 Qt::Orientation orientation() const { |
|
49 return gTestOrientation; |
|
50 } |
|
51 |
|
52 HbView *HbMainWindow::currentView() const { |
|
53 return mView; |
|
54 } |
|
55 |
|
56 HbView *mView; |
|
57 }; |
|
58 |
|
59 #endif // HBMAINWINDOW_H |
|
60 |
|
61 #ifndef HBINSTANCE_H |
|
62 #define HBINSTANCE_H |
|
63 |
|
64 #include <QList> |
|
65 |
|
66 /*! |
|
67 Mocked class HbInstance (simulating hbinstance in unittests) |
|
68 */ |
|
69 class HbInstance |
|
70 { |
|
71 public: |
|
72 |
|
73 static HbInstance *instance() { |
|
74 return new HbInstance(); |
|
75 } |
|
76 |
|
77 QList<HbMainWindow *> allMainWindows() const { |
|
78 return mMainWindows; |
|
79 } |
|
80 |
|
81 HbInstance() { |
|
82 HbMainWindow* window = new HbMainWindow(); |
|
83 mMainWindows.append(window); |
|
84 } |
|
85 |
|
86 ~HbInstance() { |
|
87 for (int i = 0; i < mMainWindows.count(); i++) { |
|
88 delete mMainWindows[i]; |
|
89 } |
|
90 mMainWindows.clear(); |
|
91 } |
|
92 |
|
93 QList<HbMainWindow *> mMainWindows; |
|
94 }; |
|
95 |
|
96 #endif // HBINSTANCE_H |
|
97 |
|
98 // End of File |