License conversion from Flora to Apache 2.0
[platform/core/uifw/dali-toolkit.git] / automated-tests / TET / dali-test-suite / utc-MODULE-CLASS.cpp.in
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 <iostream>
19
20 #include <stdlib.h>
21 #include <tet_api.h>
22
23 #include <dali/public-api/dali-core.h>
24 #include <dali-toolkit/dali-toolkit.h>
25
26 #include <dali-toolkit-test-suite-utils.h>
27
28 using namespace Dali;
29 using namespace Dali::Toolkit;
30
31 static void Startup();
32 static void Cleanup();
33
34 extern "C" {
35   void (*tet_startup)() = Startup;
36   void (*tet_cleanup)() = Cleanup;
37 }
38
39 static void Utc@MODULE@@CLASS@Method01();
40 static void Utc@MODULE@@CLASS@Method02();
41
42 enum {
43   POSITIVE_TC_IDX = 0x01,
44   NEGATIVE_TC_IDX,
45 };
46
47 // Add test functionality for all APIs in the class (Positive and Negative)
48 extern "C" {
49   struct tet_testlist tet_testlist[] = {
50     { Utc@MODULE@@CLASS@Method01, POSITIVE_TC_IDX },
51     { Utc@MODULE@@CLASS@Method02, NEGATIVE_TC_IDX },
52     { NULL, 0 }
53   };
54 }
55
56 // Called only once before first test is run.
57 static void Startup()
58 {
59 }
60
61 // Called only once after last test is run
62 static void Cleanup()
63 {
64 }
65
66
67 // Positive test case for a method
68 static void Utc@MODULE@@CLASS@Method01()
69 {
70   ToolkitTestApplication application;
71
72   tet_infoline("Journaled printf Output");
73   tet_result(TET_FAIL);
74 #if 0
75   tet_result(TET_PASS);
76 #endif
77 }
78
79
80 // Negative test case for a method
81 static void Utc@MODULE@@CLASS@Method02()
82 {
83   ToolkitTestApplication application;  // Exceptions require ToolkitTestApplication
84
85   try
86   {
87     /* My test code and results */
88     DALI_TEST_EQUALS(myVar, expectedValue, TEST_LOCATION);
89   }
90   catch (Dali::DaliException& e)
91   {
92     // Tests that a negative test of an assertion succeeds
93     tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
94     DALI_TEST_EQUALS(e.mCondition, "assert conditional", TEST_LOCATION);
95   }
96 }
97