2 * Copyright (c) 2020 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.
21 #include <dali-toolkit-test-suite-utils.h>
22 #include <dali-toolkit/dali-toolkit.h>
24 #include <dali-toolkit/internal/controls/text-controls/text-editor-impl.h>
25 #include <dali-toolkit/internal/text/text-controller.h>
26 #include <dali-toolkit/internal/text/text-controller-impl.h>
29 using namespace Toolkit;
32 int UtcDaliTextEditorSelectText(void)
34 ToolkitTestApplication application;
35 tet_infoline( "UtcDaliTextEditorSelectText" );
37 // Create a text editor
38 TextEditor textEditor = TextEditor::New();
39 textEditor.SetProperty( Actor::Property::SIZE, Vector2( 400.f, 60.f ) );
40 textEditor.SetProperty( TextEditor::Property::TEXT, "Hello World" );
42 // Add the text editor to the stage
43 application.GetScene().Add( textEditor );
45 application.SendNotification();
48 Toolkit::Internal::TextEditor& textEditorImpl = GetImpl( textEditor );
50 application.SendNotification();
53 // Highlight the whole text
54 textEditorImpl.SelectWholeText();
56 application.SendNotification();
59 std::string selectedText = textEditorImpl.GetSelectedText();
60 DALI_TEST_CHECK( selectedText == "Hello World" );
63 textEditorImpl.SelectNone();
65 application.SendNotification();
68 selectedText = textEditorImpl.GetSelectedText();
69 DALI_TEST_CHECK( selectedText == "" );