Add test case for Window
[platform/core/uifw/dali-adaptor.git] / automated-tests / src / dali-adaptor / utc-Dali-Window.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include <dali/dali.h>
19 #include <Ecore_X.h>
20 #include <dali-test-suite-utils.h>
21
22 using namespace Dali;
23
24 void utc_dali_window_startup(void)
25 {
26   test_return_value = TET_UNDEF;
27 }
28
29 void utc_dali_window_cleanup(void)
30 {
31   test_return_value = TET_PASS;
32 }
33
34 namespace
35 {
36
37 intptr_t screenId = 0; // intptr_t has the same size as a pointer and is platform independent so this can be returned as a pointer in ecore_x_default_screen_get below without compilation warnings
38
39 } // unnamed namespace
40
41 extern "C"
42 {
43
44 Ecore_X_Screen* ecore_x_default_screen_get(void)
45 {
46   screenId += 8;
47   return (Ecore_X_Screen*)screenId;
48 }
49
50 void ecore_x_screen_size_get(const Ecore_X_Screen *screen, int *w, int *h)
51 {
52  *w = 100;
53  *h = 100;
54 }
55
56 Ecore_X_Window ecore_x_window_argb_new(Ecore_X_Window parent, int x, int y, int w, int h)
57 {
58   return 0;
59 }
60
61 }
62
63 int UtcDaliToolkitWindowConstructorP(void)
64 {
65   Dali::Window window;
66   DALI_TEST_CHECK( !window );
67   END_TEST;
68 }
69
70 int UtcDaliToolkitWindowCopyConstructorP(void)
71 {
72   Dali::Window window;
73   Dali::Window copy( window );
74   DALI_TEST_CHECK( copy == window );
75
76   END_TEST;
77 }
78
79 int UtcDaliToolkitWindowAssignmentOperatorP(void)
80 {
81   Dali::Window window;
82   Dali::Window copy = window;
83   DALI_TEST_CHECK( copy == window );
84
85   END_TEST;
86 }
87
88 int UtcDaliWindowDestructorP(void)
89 {
90   Dali::Window* window = new Dali::Window();
91   delete window;
92
93   DALI_TEST_CHECK( true );
94   END_TEST;
95 }
96
97 int UtcDaliWindowNewN(void)
98 {
99   // Attempt to create a new window
100   try
101   {
102     PositionSize windowPosition(0, 0, 0, 0);
103     Dali::Window window = Dali::Window::New( windowPosition, "test-window", true );
104
105     tet_result( TET_FAIL );
106   }
107   catch ( DaliException& e )
108   {
109     DALI_TEST_ASSERT( e, "Failed to create X window", TEST_LOCATION );
110   }
111
112   END_TEST;
113 }
114
115
116
117
118