2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #include <dali-toolkit-test-suite-utils.h>
21 #include <dali-toolkit/dali-toolkit.h>
22 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
23 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-toolbar.h>
26 using namespace Toolkit;
28 void dali_textselectionpopup_startup(void)
30 test_return_value = TET_UNDEF;
33 void dali_textselectionpopup_cleanup(void)
35 test_return_value = TET_PASS;
38 int UtcDaliToolkitTextSelectionPopupNewP(void)
40 ToolkitTestApplication application;
41 TextSelectionPopup textSelectionPopup;
43 DALI_TEST_CHECK( !textSelectionPopup );
45 textSelectionPopup = TextSelectionPopup::New( NULL );
47 DALI_TEST_CHECK( textSelectionPopup );
51 int UtcDaliToolkitTextSelectionPopupConstructorP(void)
53 TextSelectionPopup textSelectionPopup;
55 DALI_TEST_CHECK( !textSelectionPopup );
60 int UtcDaliToolkitTextSelectionPopupCopyConstructorP(void)
62 ToolkitTestApplication application;
63 TextSelectionPopup textSelectionPopup;
65 textSelectionPopup = TextSelectionPopup::New( NULL );
66 TextSelectionPopup copy( textSelectionPopup );
68 DALI_TEST_CHECK( copy == textSelectionPopup );
74 int UtcDaliToolkitTextSelectionPopupDestructorP(void)
76 ToolkitTestApplication application;
77 TextSelectionPopup* textSelectionPopup = new TextSelectionPopup;
78 delete textSelectionPopup;
80 DALI_TEST_CHECK( true );
85 int UtcDaliToolkitTextSelectionPopupAssignmentOperatorP(void)
87 ToolkitTestApplication application;
88 TextSelectionPopup textSelectionPopup;
89 textSelectionPopup = TextSelectionPopup::New( NULL );
90 TextSelectionPopup copy;
91 copy = textSelectionPopup;
93 DALI_TEST_CHECK( copy == textSelectionPopup );
97 int UtcDaliToolkitTextSelectionPopupDownCastP(void)
99 ToolkitTestApplication application;
100 TextSelectionPopup textSelectionPopup;
101 textSelectionPopup = TextSelectionPopup::New( NULL );
103 TextSelectionPopup cast = TextSelectionPopup::DownCast( textSelectionPopup );
105 DALI_TEST_CHECK( cast );
110 // TextSelectionToolBar is used TextSelectionPopup, below tests it individually
112 int UtcDaliToolkitTextSelectionToolBarP(void)
115 // Creates Toolbar, adds 2 options and a divider then resizes divider
116 ToolkitTestApplication application;
118 TextSelectionToolbar toolbar = TextSelectionToolbar::New();
120 toolbar.SetProperty( Toolkit::TextSelectionToolbar::Property::MAX_SIZE, Size( 100.0f, 60.0f) );
122 Toolkit::PushButton option = Toolkit::PushButton::New();
123 option.SetName( "test-option" );
124 option.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
125 toolbar.AddOption( option );
127 Toolkit::Control divider = Toolkit::Control::New();
128 divider.SetSize( 2.0f, 0.0f );
129 divider.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT );
130 toolbar.AddDivider( divider );
132 Toolkit::PushButton option2 = Toolkit::PushButton::New();
133 option2.SetName( "test-option-2" );
134 option2.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
135 toolbar.AddOption( option2 );
137 Size newSize = Size(3.0f, 0.0f);
138 toolbar.ResizeDividers( newSize );
140 DALI_TEST_CHECK( toolbar );