Adding new test harness
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-unmanaged / utc-Dali-OverlayEffect.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 #include <iostream>
18 #include <stdlib.h>
19 #include <dali-toolkit-test-suite-utils.h>
20 #include <dali-toolkit/dali-toolkit.h>
21
22
23 using namespace Dali;
24 using namespace Dali::Toolkit;
25
26 void overlay_effect_startup(void)
27 {
28   test_return_value = TET_UNDEF;
29 }
30
31 void overlay_effect_cleanup(void)
32 {
33   test_return_value = TET_PASS;
34 }
35
36
37 int UtcDaliOverlayConstructor(void)
38 {
39   ToolkitTestApplication application;
40
41   BitmapImage image = CreateBitmapImage();
42
43   Toolkit::OverlayEffect effect = Toolkit::OverlayEffect::New( image );
44   DALI_TEST_CHECK( effect );
45
46   ImageActor actor = ImageActor::New( image );
47   actor.SetSize( 100.0f, 100.0f );
48   actor.SetShaderEffect( effect );
49   Stage::GetCurrent().Add( actor );
50
51   application.SendNotification();
52   application.Render();
53
54   END_TEST;
55 }
56
57 int UtcDaliOverlayUninitializedEffect(void)
58 {
59   ToolkitTestApplication application;
60
61   Toolkit::OverlayEffect effect;
62
63   try
64   {
65     BitmapImage image = CreateBitmapImage();
66
67     // New() must be called to create a OverlayEffect or it wont be valid.
68     effect.SetEffectImage( image );
69     DALI_TEST_CHECK( false );
70   }
71   catch (Dali::DaliException& e)
72   {
73     // Tests that a negative test of an assertion succeeds
74     tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
75     DALI_TEST_CHECK(!effect);
76   }
77   END_TEST;
78 }