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