From 63f98c6a1839a4cebdffc66a7462048f9fb0267f Mon Sep 17 00:00:00 2001
From: Paul Wisbey
Date: Mon, 15 Dec 2014 13:14:04 +0000
Subject: [PATCH] Initial removal of Text features
Change-Id: I1fcc7ce7000a6e18bccc93126afb57f439ba9409
---
automated-tests/src/dali-internal/CMakeLists.txt | 4 -
.../dali-internal/utc-Dali-Internal-Character.cpp | 52 -
.../src/dali-internal/utc-Dali-Internal-Font.cpp | 147 --
.../dali-internal/utc-Dali-Internal-Handles.cpp | 3 +-
.../utc-Dali-Internal-Text-Culling.cpp | 573 -----
.../src/dali-internal/utc-Dali-Internal-Text.cpp | 113 -
automated-tests/src/dali-unmanaged/CMakeLists.txt | 1 -
.../test-platform-abstraction.cpp | 304 ---
.../test-platform-abstraction.h | 119 -
.../dali-unmanaged/utc-Dali-HitTestAlgorithm.cpp | 2 +-
.../src/dali-unmanaged/utc-Dali-ObjectRegistry.cpp | 43 -
.../src/dali-unmanaged/utc-Dali-Scripting.cpp | 20 +-
.../src/dali-unmanaged/utc-Dali-TypeRegistry.cpp | 11 +-
.../src/dali-unmanaged/utc-Dali-Utf8.cpp | 44 -
automated-tests/src/dali/CMakeLists.txt | 6 -
.../dali-test-suite-utils/dali-test-suite-utils.h | 35 -
.../test-platform-abstraction.cpp | 319 +--
.../test-platform-abstraction.h | 119 -
automated-tests/src/dali/utc-Dali-Character.cpp | 215 --
automated-tests/src/dali/utc-Dali-Font.cpp | 545 -----
.../src/dali/utc-Dali-FontParameters.cpp | 136 --
.../src/dali/utc-Dali-HoverProcessing.cpp | 8 +-
automated-tests/src/dali/utc-Dali-ImageActor.cpp | 2 +-
automated-tests/src/dali/utc-Dali-Layer.cpp | 4 +-
.../src/dali/utc-Dali-RenderableActor.cpp | 47 +-
automated-tests/src/dali/utc-Dali-ShaderEffect.cpp | 24 -
automated-tests/src/dali/utc-Dali-Text.cpp | 503 ----
automated-tests/src/dali/utc-Dali-TextActor.cpp | 1079 ---------
automated-tests/src/dali/utc-Dali-TextStyle.cpp | 1500 ------------
.../src/dali/utc-Dali-TouchProcessing.cpp | 8 +-
dali/integration-api/file.list | 5 +-
dali/integration-api/glyph-set.cpp | 88 -
dali/integration-api/glyph-set.h | 186 --
dali/integration-api/platform-abstraction.h | 211 +-
dali/integration-api/profiling.cpp | 12 -
dali/integration-api/resource-cache.h | 1 -
dali/integration-api/resource-types.h | 147 +-
dali/integration-api/text-array.h | 42 -
dali/internal/common/bitmap-upload.h | 2 +-
dali/internal/common/core-impl.cpp | 23 -
dali/internal/common/core-impl.h | 16 -
dali/internal/common/text-parameters.cpp | 305 ---
dali/internal/common/text-parameters.h | 264 --
dali/internal/common/text-vertex-buffer.h | 50 -
.../actor-attachment-declarations.h | 2 -
.../actor-attachments/text-attachment-impl.cpp | 631 -----
.../event/actor-attachments/text-attachment-impl.h | 409 ----
dali/internal/event/actors/actor-declarations.h | 2 -
dali/internal/event/actors/text-actor-impl.cpp | 1075 ---------
dali/internal/event/actors/text-actor-impl.h | 416 ----
.../internal/event/common/thread-local-storage.cpp | 10 -
dali/internal/event/common/thread-local-storage.h | 14 -
dali/internal/event/effects/shader-declarations.h | 10 +-
dali/internal/event/effects/shader-effect-impl.cpp | 18 +-
dali/internal/event/effects/shader-factory.cpp | 15 -
dali/internal/event/images/emoji-factory.cpp | 109 -
dali/internal/event/images/emoji-factory.h | 86 -
dali/internal/event/resources/resource-client.cpp | 30 -
dali/internal/event/resources/resource-client.h | 31 -
.../event/resources/resource-type-path.cpp | 36 -
.../event/text/atlas/atlas-rank-generator.cpp | 100 -
.../event/text/atlas/atlas-rank-generator.h | 52 -
dali/internal/event/text/atlas/atlas-ranking.cpp | 118 -
dali/internal/event/text/atlas/atlas-ranking.h | 157 --
dali/internal/event/text/atlas/atlas-size.cpp | 110 -
dali/internal/event/text/atlas/atlas-size.h | 68 -
.../internal/event/text/atlas/atlas-uv-interface.h | 78 -
dali/internal/event/text/atlas/atlas.cpp | 328 ---
dali/internal/event/text/atlas/atlas.h | 253 --
.../event/text/atlas/debug/atlas-debug.cpp | 141 --
dali/internal/event/text/atlas/debug/atlas-debug.h | 94 -
.../text/atlas/glyph-atlas-manager-interface.h | 141 --
.../event/text/atlas/glyph-atlas-manager.cpp | 341 ---
.../event/text/atlas/glyph-atlas-manager.h | 202 --
dali/internal/event/text/atlas/glyph-atlas.cpp | 409 ----
dali/internal/event/text/atlas/glyph-atlas.h | 286 ---
dali/internal/event/text/character-impl.cpp | 517 ----
dali/internal/event/text/character-impl.h | 148 --
dali/internal/event/text/font-declarations.h | 35 -
dali/internal/event/text/font-factory.cpp | 150 --
dali/internal/event/text/font-factory.h | 135 --
dali/internal/event/text/font-impl.cpp | 401 ----
dali/internal/event/text/font-impl.h | 320 ---
dali/internal/event/text/font-layout.cpp | 117 -
dali/internal/event/text/font-layout.h | 148 --
dali/internal/event/text/font-metrics-interface.h | 173 --
dali/internal/event/text/font-metrics.cpp | 458 ----
dali/internal/event/text/font-metrics.h | 323 ---
.../event/text/generator/text-vertex-generator.cpp | 428 ----
.../event/text/generator/text-vertex-generator.h | 71 -
dali/internal/event/text/glyph-metric.cpp | 88 -
dali/internal/event/text/glyph-metric.h | 110 -
.../debug/glyph-status-container-debug.cpp | 112 -
.../debug/glyph-status-container-debug.h | 79 -
.../text/glyph-status/glyph-status-container.cpp | 424 ----
.../text/glyph-status/glyph-status-container.h | 241 --
.../event/text/glyph-status/glyph-status.cpp | 192 --
.../event/text/glyph-status/glyph-status.h | 255 --
.../text/resource/debug/glyph-resource-debug.cpp | 66 -
.../text/resource/debug/glyph-resource-debug.h | 41 -
dali/internal/event/text/resource/font-id.h | 40 -
.../event/text/resource/font-lookup-interface.h | 83 -
.../event/text/resource/glyph-load-observer.h | 83 -
.../event/text/resource/glyph-resource-manager.cpp | 415 ----
.../event/text/resource/glyph-resource-manager.h | 236 --
.../event/text/resource/glyph-resource-observer.h | 143 --
.../event/text/resource/glyph-resource-request.cpp | 92 -
.../event/text/resource/glyph-resource-request.h | 118 -
.../event/text/resource/glyph-texture-observer.h | 83 -
dali/internal/event/text/special-characters.h | 38 -
dali/internal/event/text/text-format.cpp | 117 -
dali/internal/event/text/text-format.h | 135 --
dali/internal/event/text/text-impl.cpp | 227 --
dali/internal/event/text/text-impl.h | 162 --
dali/internal/event/text/text-observer.h | 76 -
dali/internal/event/text/text-request-helper.cpp | 148 --
dali/internal/event/text/text-request-helper.h | 128 -
dali/internal/event/text/utf8-impl.cpp | 158 --
dali/internal/event/text/utf8-impl.h | 67 -
dali/internal/file.list | 31 -
.../render/renderers/scene-graph-text-renderer.cpp | 544 -----
.../render/renderers/scene-graph-text-renderer.h | 202 --
.../shader-source/text-distance-field-glow.txt | 58 -
.../text-distance-field-outline-glow.txt | 68 -
.../shader-source/text-distance-field-outline.txt | 57 -
.../shader-source/text-distance-field-shadow.txt | 80 -
.../render/shader-source/text-distance-field.txt | 69 -
dali/internal/render/shaders/program.cpp | 14 +-
dali/internal/render/shaders/program.h | 21 +-
dali/internal/render/shaders/shader.cpp | 6 +-
.../update/manager/prepare-render-instructions.cpp | 2 +-
dali/internal/update/manager/update-algorithms.cpp | 2 +-
.../scene-graph-text-attachment.cpp | 278 ---
.../node-attachments/scene-graph-text-attachment.h | 298 ---
.../update/resources/atlas-request-status.cpp | 148 --
.../update/resources/atlas-request-status.h | 113 -
.../internal/update/resources/resource-manager.cpp | 112 -
dali/internal/update/resources/resource-manager.h | 69 -
dali/public-api/actors/mesh-actor.cpp | 1 +
dali/public-api/actors/text-actor.cpp | 236 --
dali/public-api/actors/text-actor.h | 417 ----
dali/public-api/dali-core.h | 9 -
dali/public-api/file.list | 20 -
dali/public-api/images/glyph-image.cpp | 162 --
dali/public-api/images/glyph-image.h | 121 -
dali/public-api/scripting/scripting.h | 4 -
dali/public-api/shader-effects/shader-effect.cpp | 34 -
dali/public-api/shader-effects/shader-effect.h | 77 +-
dali/public-api/text/character.cpp | 92 -
dali/public-api/text/character.h | 173 --
dali/public-api/text/font-parameters.cpp | 141 --
dali/public-api/text/font-parameters.h | 203 --
dali/public-api/text/font.cpp | 230 --
dali/public-api/text/font.h | 370 ---
dali/public-api/text/text-actor-parameters.cpp | 110 -
dali/public-api/text/text-actor-parameters.h | 105 -
dali/public-api/text/text-style.cpp | 2512 --------------------
dali/public-api/text/text-style.h | 523 ----
dali/public-api/text/text.cpp | 288 ---
dali/public-api/text/text.h | 237 --
dali/public-api/text/utf8.cpp | 31 -
dali/public-api/text/utf8.h | 37 -
162 files changed, 56 insertions(+), 28940 deletions(-)
delete mode 100644 automated-tests/src/dali-internal/utc-Dali-Internal-Character.cpp
delete mode 100644 automated-tests/src/dali-internal/utc-Dali-Internal-Font.cpp
delete mode 100644 automated-tests/src/dali-internal/utc-Dali-Internal-Text-Culling.cpp
delete mode 100644 automated-tests/src/dali-internal/utc-Dali-Internal-Text.cpp
delete mode 100644 automated-tests/src/dali-unmanaged/utc-Dali-Utf8.cpp
delete mode 100644 automated-tests/src/dali/utc-Dali-Character.cpp
delete mode 100644 automated-tests/src/dali/utc-Dali-Font.cpp
delete mode 100644 automated-tests/src/dali/utc-Dali-FontParameters.cpp
delete mode 100644 automated-tests/src/dali/utc-Dali-Text.cpp
delete mode 100644 automated-tests/src/dali/utc-Dali-TextActor.cpp
delete mode 100644 automated-tests/src/dali/utc-Dali-TextStyle.cpp
delete mode 100644 dali/integration-api/glyph-set.cpp
delete mode 100644 dali/integration-api/glyph-set.h
delete mode 100644 dali/integration-api/text-array.h
delete mode 100644 dali/internal/common/text-parameters.cpp
delete mode 100644 dali/internal/common/text-parameters.h
delete mode 100644 dali/internal/common/text-vertex-buffer.h
delete mode 100644 dali/internal/event/actor-attachments/text-attachment-impl.cpp
delete mode 100644 dali/internal/event/actor-attachments/text-attachment-impl.h
delete mode 100644 dali/internal/event/actors/text-actor-impl.cpp
delete mode 100644 dali/internal/event/actors/text-actor-impl.h
delete mode 100644 dali/internal/event/images/emoji-factory.cpp
delete mode 100644 dali/internal/event/images/emoji-factory.h
delete mode 100644 dali/internal/event/text/atlas/atlas-rank-generator.cpp
delete mode 100644 dali/internal/event/text/atlas/atlas-rank-generator.h
delete mode 100644 dali/internal/event/text/atlas/atlas-ranking.cpp
delete mode 100644 dali/internal/event/text/atlas/atlas-ranking.h
delete mode 100644 dali/internal/event/text/atlas/atlas-size.cpp
delete mode 100644 dali/internal/event/text/atlas/atlas-size.h
delete mode 100644 dali/internal/event/text/atlas/atlas-uv-interface.h
delete mode 100644 dali/internal/event/text/atlas/atlas.cpp
delete mode 100644 dali/internal/event/text/atlas/atlas.h
delete mode 100644 dali/internal/event/text/atlas/debug/atlas-debug.cpp
delete mode 100644 dali/internal/event/text/atlas/debug/atlas-debug.h
delete mode 100644 dali/internal/event/text/atlas/glyph-atlas-manager-interface.h
delete mode 100644 dali/internal/event/text/atlas/glyph-atlas-manager.cpp
delete mode 100644 dali/internal/event/text/atlas/glyph-atlas-manager.h
delete mode 100644 dali/internal/event/text/atlas/glyph-atlas.cpp
delete mode 100644 dali/internal/event/text/atlas/glyph-atlas.h
delete mode 100644 dali/internal/event/text/character-impl.cpp
delete mode 100644 dali/internal/event/text/character-impl.h
delete mode 100644 dali/internal/event/text/font-declarations.h
delete mode 100644 dali/internal/event/text/font-factory.cpp
delete mode 100644 dali/internal/event/text/font-factory.h
delete mode 100644 dali/internal/event/text/font-impl.cpp
delete mode 100644 dali/internal/event/text/font-impl.h
delete mode 100644 dali/internal/event/text/font-layout.cpp
delete mode 100644 dali/internal/event/text/font-layout.h
delete mode 100644 dali/internal/event/text/font-metrics-interface.h
delete mode 100644 dali/internal/event/text/font-metrics.cpp
delete mode 100644 dali/internal/event/text/font-metrics.h
delete mode 100644 dali/internal/event/text/generator/text-vertex-generator.cpp
delete mode 100644 dali/internal/event/text/generator/text-vertex-generator.h
delete mode 100644 dali/internal/event/text/glyph-metric.cpp
delete mode 100644 dali/internal/event/text/glyph-metric.h
delete mode 100644 dali/internal/event/text/glyph-status/debug/glyph-status-container-debug.cpp
delete mode 100644 dali/internal/event/text/glyph-status/debug/glyph-status-container-debug.h
delete mode 100644 dali/internal/event/text/glyph-status/glyph-status-container.cpp
delete mode 100644 dali/internal/event/text/glyph-status/glyph-status-container.h
delete mode 100644 dali/internal/event/text/glyph-status/glyph-status.cpp
delete mode 100644 dali/internal/event/text/glyph-status/glyph-status.h
delete mode 100644 dali/internal/event/text/resource/debug/glyph-resource-debug.cpp
delete mode 100644 dali/internal/event/text/resource/debug/glyph-resource-debug.h
delete mode 100644 dali/internal/event/text/resource/font-id.h
delete mode 100644 dali/internal/event/text/resource/font-lookup-interface.h
delete mode 100644 dali/internal/event/text/resource/glyph-load-observer.h
delete mode 100644 dali/internal/event/text/resource/glyph-resource-manager.cpp
delete mode 100644 dali/internal/event/text/resource/glyph-resource-manager.h
delete mode 100644 dali/internal/event/text/resource/glyph-resource-observer.h
delete mode 100644 dali/internal/event/text/resource/glyph-resource-request.cpp
delete mode 100644 dali/internal/event/text/resource/glyph-resource-request.h
delete mode 100644 dali/internal/event/text/resource/glyph-texture-observer.h
delete mode 100644 dali/internal/event/text/special-characters.h
delete mode 100644 dali/internal/event/text/text-format.cpp
delete mode 100644 dali/internal/event/text/text-format.h
delete mode 100644 dali/internal/event/text/text-impl.cpp
delete mode 100644 dali/internal/event/text/text-impl.h
delete mode 100644 dali/internal/event/text/text-observer.h
delete mode 100644 dali/internal/event/text/text-request-helper.cpp
delete mode 100644 dali/internal/event/text/text-request-helper.h
delete mode 100644 dali/internal/event/text/utf8-impl.cpp
delete mode 100644 dali/internal/event/text/utf8-impl.h
delete mode 100644 dali/internal/render/renderers/scene-graph-text-renderer.cpp
delete mode 100644 dali/internal/render/renderers/scene-graph-text-renderer.h
delete mode 100644 dali/internal/render/shader-source/text-distance-field-glow.txt
delete mode 100644 dali/internal/render/shader-source/text-distance-field-outline-glow.txt
delete mode 100644 dali/internal/render/shader-source/text-distance-field-outline.txt
delete mode 100644 dali/internal/render/shader-source/text-distance-field-shadow.txt
delete mode 100644 dali/internal/render/shader-source/text-distance-field.txt
delete mode 100644 dali/internal/update/node-attachments/scene-graph-text-attachment.cpp
delete mode 100644 dali/internal/update/node-attachments/scene-graph-text-attachment.h
delete mode 100644 dali/internal/update/resources/atlas-request-status.cpp
delete mode 100644 dali/internal/update/resources/atlas-request-status.h
delete mode 100644 dali/public-api/actors/text-actor.cpp
delete mode 100644 dali/public-api/actors/text-actor.h
delete mode 100644 dali/public-api/images/glyph-image.cpp
delete mode 100644 dali/public-api/images/glyph-image.h
delete mode 100644 dali/public-api/text/character.cpp
delete mode 100644 dali/public-api/text/character.h
delete mode 100644 dali/public-api/text/font-parameters.cpp
delete mode 100644 dali/public-api/text/font-parameters.h
delete mode 100644 dali/public-api/text/font.cpp
delete mode 100644 dali/public-api/text/font.h
delete mode 100644 dali/public-api/text/text-actor-parameters.cpp
delete mode 100644 dali/public-api/text/text-actor-parameters.h
delete mode 100644 dali/public-api/text/text-style.cpp
delete mode 100644 dali/public-api/text/text-style.h
delete mode 100644 dali/public-api/text/text.cpp
delete mode 100644 dali/public-api/text/text.h
delete mode 100644 dali/public-api/text/utf8.cpp
delete mode 100644 dali/public-api/text/utf8.h
diff --git a/automated-tests/src/dali-internal/CMakeLists.txt b/automated-tests/src/dali-internal/CMakeLists.txt
index 0b53213..e85f4ea 100644
--- a/automated-tests/src/dali-internal/CMakeLists.txt
+++ b/automated-tests/src/dali-internal/CMakeLists.txt
@@ -6,15 +6,11 @@ SET(RPM_NAME "core-${PKG_NAME}-tests")
SET(CAPI_LIB "dali-internal")
SET(TC_SOURCES
- utc-Dali-Internal-Character.cpp
- utc-Dali-Internal-Font.cpp
utc-Dali-Internal-Handles.cpp
utc-Dali-Internal-ImageFactory.cpp
utc-Dali-Internal-Mesh.cpp
- utc-Dali-Internal-Text.cpp
utc-Dali-Internal-ResourceClient.cpp
utc-Dali-Internal-Image-Culling.cpp
- utc-Dali-Internal-Text-Culling.cpp
utc-Dali-Internal-Constraint.cpp
)
diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-Character.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-Character.cpp
deleted file mode 100644
index e884843..0000000
--- a/automated-tests/src/dali-internal/utc-Dali-Internal-Character.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include
-
-#include
-#include
-#include
-
-using namespace Dali;
-
-void utc_dali_character_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_character_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-int UtcDaliCharacterGetImplementation(void)
-{
- TestApplication application;
-
- Text text( std::string( "Hello world" ) );
- Character c = text[0];
-
- const Internal::Character& characterImpl1 = c.GetImplementation();
-
- DALI_TEST_CHECK( NULL != &characterImpl1 );
-
- Internal::Character& characterImpl2 = c.GetImplementation();
-
- DALI_TEST_CHECK( NULL != &characterImpl2 );
-
- END_TEST;
-}
diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-Font.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-Font.cpp
deleted file mode 100644
index 23b3099..0000000
--- a/automated-tests/src/dali-internal/utc-Dali-Internal-Font.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include
-
-#include
-#include
-#include
-
-#include
-
-// Internal headers are allowed here
-
-#include
-#include
-#include
-
-using namespace Dali;
-
-// Called only once before first test is run.
-void utc_dali_internal_font_startup()
-{
- test_return_value = TET_UNDEF;
-}
-
-// Called only once after last test is run
-void utc_dali_internal_font_cleanup()
-{
- test_return_value = TET_PASS;
-}
-
-
-namespace
-{
-
-static const char* TestText = "Some text";
-
-
-Integration::GlyphMetrics characters[] =
- {
- {' ', 1, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f},
- {'S', 1, 10.0f, 20.0f, 0.0f, 1.0f, 12.0f},
- {'o', 1, 11.0f, 20.0f, 0.0f, 1.0f, 13.0f},
- {'m', 1, 12.0f, 20.0f, 0.0f, 1.0f, 14.0f},
- {'e', 1, 13.0f, 20.0f, 0.0f, 1.0f, 15.0f},
- {'t', 1, 14.0f, 20.0f, 0.0f, 1.0f, 16.0f},
- {'x', 1, 15.0f, 20.0f, 0.0f, 1.0f, 17.0f} };
-
-static Integration::GlyphSet* BuildGlyphSet()
-{
- Integration::GlyphSet* set = new Integration::GlyphSet();
- Integration::BitmapPtr bitmapData;
-
- for (unsigned int index = 0; index < sizeof(characters)/sizeof(characters[0]); index++)
- {
- set->AddCharacter(bitmapData, characters[index]);
- }
-
- set->mLineHeight = 20.0f;
- set->mUnitsPerEM = 2048.0f/64.0f;
-
- return set;
-}
-
-static Font CreateFont(TestApplication& application)
-{
- Integration::GlyphSet* glyphSet = BuildGlyphSet();
- Integration::ResourcePointer resourcePtr(glyphSet); // reference it
-
- // Don't use a font which could be cached otherwise cached values will be used making measure text test to fail.
- Font font = Font::New(FontParameters("TET-FreeSans", "Book", PointSize(8)));
- application.SendNotification(); // Send to update thread
- application.Render(16); // Process request
- application.Render(16); // Resource complete
- application.SendNotification(); // Update event objects
- application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
- return font;
-}
-
-} //anonymous namespace
-
-
-int UtcDaliFontMeasureTextWidth(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::MeasureTextWidth()");
-
- Font testFont = CreateFont(application);
- float width = testFont.MeasureTextWidth(TestText, 30.0f);
-
- DALI_TEST_EQUALS(width, 270.0f, 0.001f, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliFontMeasureTextWidthNegative(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::MeasureTextWidth() with negative height");
-
- Font testFont = CreateFont(application);
- float width = testFont.MeasureTextWidth(TestText, -30.0f);
-
- DALI_TEST_EQUALS(width, 0.0f, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliFontMeasureTextHeight(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::MeasureTextHeight()");
-
- Font testFont = CreateFont(application);
- float height = testFont.MeasureTextHeight(TestText, 200.0f);
-
- DALI_TEST_EQUALS(height, 22.2222f, 0.001f, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliFontMeasureTextHeightNegative(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::MeasureTextHeight() with negative width");
-
- Font testFont = CreateFont(application);
- float height = testFont.MeasureTextHeight(TestText, -200.0f);
-
- DALI_TEST_EQUALS(height, 0.0f, TEST_LOCATION);
- END_TEST;
-}
diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-Handles.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-Handles.cpp
index cb1ae63..36f2f54 100644
--- a/automated-tests/src/dali-internal/utc-Dali-Internal-Handles.cpp
+++ b/automated-tests/src/dali-internal/utc-Dali-Internal-Handles.cpp
@@ -19,7 +19,6 @@
#include
#include
-#include
#include
@@ -101,7 +100,7 @@ int UtcDaliTextActorConstructorRefObject(void)
{
TestApplication application;
tet_infoline("Testing Dali::TextActor::TextActor(Internal::TextActor*)");
- TextActor actor(NULL);
+ ImageActor actor(NULL);
DALI_TEST_CHECK(!actor);
END_TEST;
}
diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-Text-Culling.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-Text-Culling.cpp
deleted file mode 100644
index 3077397..0000000
--- a/automated-tests/src/dali-internal/utc-Dali-Internal-Text-Culling.cpp
+++ /dev/null
@@ -1,573 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include
-
-#include
-#include
-
-#include
-
-using namespace Dali;
-
-void utc_dali_internal_text_culling_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_internal_text_culling_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-
-namespace
-{
-#define NUM_ROWS 9
-#define NUM_COLS 9
-#define NUM_ROWS_PER_PANE 3
-#define NUM_COLS_PER_PANE 3
-
-
-TextActor CreateOnStageActor(TestApplication& application, Text text, int width, int height, bool testDraw)
-{
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TestPlatformAbstraction& platform = application.GetPlatform();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
-
- TextActor textActor = TextActor::New(text);
- textActor.SetParentOrigin(ParentOrigin::CENTER);
- textActor.SetSize(width, height);
- Stage::GetCurrent().Add(textActor);
-
- application.SendNotification();
- application.Render(16);
-
- Integration::ResourceRequest* request = platform.GetRequest();
- DALI_TEST_CHECK( request != NULL );
- DALI_TEST_CHECK( request->GetType() != NULL );
- DALI_TEST_CHECK( request->GetType()->id == Integration::ResourceText );
-
- Integration::TextResourceType* textRequest = static_cast(request->GetType());
-
- std::string font("Font");
- Integration::GlyphSet* set = platform.GetGlyphData(*textRequest, font, true);
- platform.SetResourceLoaded( request->GetId(), Integration::ResourceText, Integration::ResourcePointer(set) );
-
- application.SendNotification();
- application.Render(16);
-
- platform.ClearReadyResources();
-
- if(testDraw)
- {
- DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
- }
- return textActor;
-}
-
-
-void TestTextInside( TestApplication& application, int width, int height )
-{
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable(true);
-
- std::string text("Text");
-
- TextActor textActor = CreateOnStageActor(application, text, width, height, true);
- textActor.SetPosition(0.0f, 0.0f, 0.0f);
-
- Vector3 textSize = textActor.GetCurrentSize();
- DALI_TEST_EQUALS( textSize, Vector3(width, height, std::min(width, height)), TEST_LOCATION);
-
- drawTrace.Reset();
- textActor.SetParentOrigin(ParentOrigin::TOP_LEFT);
- application.SendNotification();
- application.Render(16);
- DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
-
- drawTrace.Reset();
- textActor.SetParentOrigin(ParentOrigin::TOP_RIGHT);
- application.SendNotification();
- application.Render(16);
- DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
-
- drawTrace.Reset();
- textActor.SetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
- application.SendNotification();
- application.Render(16);
- DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
-
- drawTrace.Reset();
- textActor.SetParentOrigin(ParentOrigin::BOTTOM_LEFT);
- application.SendNotification();
- application.Render(16);
- DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
-}
-
-
-bool RepositionActor(TestApplication& application, Actor actor, float x, float y, bool inside)
-{
- TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
-
- drawTrace.Reset();
- actor.SetPosition( x, y, 0.0f);
- application.SendNotification();
- application.Render(16);
-
- bool found = drawTrace.FindMethod( "DrawElements" );
- bool result = (inside && found) || (!inside && !found);
- return result;
-}
-
-
-void RepositionActorWithAngle(TestApplication& application, Actor actor, float x, float y, float angle, bool inside)
-{
- TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
-
- drawTrace.Reset();
- actor.SetPosition( x, y, 0.0f);
- actor.SetRotation( Degree(angle), Vector3::ZAXIS );
- application.SendNotification();
- application.Render(16);
- if( inside )
- {
- bool found = drawTrace.FindMethod( "DrawElements" );
- if( ! found ) tet_printf( "Not drawn: Position:(%3.0f, %3.0f)\n", x, y );
- DALI_TEST_CHECK( found );
- }
- else
- {
- bool found = drawTrace.FindMethod( "DrawElements" );
- if( found ) tet_printf( "Drawn when not needed: Position:(%3.0f, %3.0f)\n", x, y );
- DALI_TEST_CHECK( ! found );
- }
-}
-
-void RepositionActorOutside(TestApplication& application, Actor actor, float x, float y, bool drawn )
-{
- TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
-
- drawTrace.Reset();
- actor.SetPosition( x, y, 0.0f);
- application.SendNotification();
- application.Render(16);
- if( drawn )
- {
- bool found = drawTrace.FindMethod( "DrawElements" );
- if( ! found ) tet_printf( "Not drawn: Position:(%3.0f, %3.0f)\n", x, y );
- DALI_TEST_CHECK( found );
- }
- else
- {
- bool found = drawTrace.FindMethod( "DrawElements" );
- if( found ) tet_printf( "Drawn unnecessarily: Position:(%3.0f, %3.0f)\n", x, y );
- DALI_TEST_CHECK( ! found );
- }
-}
-
-void OBBTestTextAtBoundary( TestApplication& application, int width, int height )
-{
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable(true);
-
- Vector2 stageSize = Stage::GetCurrent().GetSize();
-
- std::string text("Text");
- TextActor textActor = CreateOnStageActor(application, text, width, height, true);
-
- Vector3 textSize = textActor.GetCurrentSize();
- DALI_TEST_EQUALS( textSize, Vector3(width, height, std::min(width, height)), TEST_LOCATION);
-
- textSize.z = 0.0f;
- tet_printf("Testing Stage Size: (%3.0f, %3.0f) text size:(%3.0f, %3.0f) \n",
- stageSize.x, stageSize.y, textSize.x, textSize.y);
-
- int successCount = 0;
- int totalCount = 0;
- for( int i=0; i<100; i++ )
- {
- float x1 = -stageSize.x/2.0f - textSize.x*i/200.0f;
- float x2 = stageSize.x/2.0f + textSize.x*i/200.0f;
- float y1 = -stageSize.y/2.0f - textSize.y*i/200.0f;
- float y2 = stageSize.y/2.0f + textSize.y*i/200.0f;
-
- //tet_printf("Testing i=%d\n",i);
-
- // Test paths marked with dots
- // + . . . . . .
- // .\_ ^
- // . \_ | within radius
- // . \ v
- // . +-----
- // . | Stage
-
- for( int j=-10; j<=10; j++ )
- {
- float x = ((stageSize.x+textSize.x/2.0f)/21.0f) * j;
- float y = ((stageSize.y+textSize.y/2.0f)/21.0f) * j;
-
- if(RepositionActor( application, textActor, x1, y, true )) successCount++;
- if(RepositionActor( application, textActor, x2, y, true )) successCount++;
- if(RepositionActor( application, textActor, x, y1, true )) successCount++;
- if(RepositionActor( application, textActor, x, y2, true )) successCount++;
-
- totalCount += 4;
- }
- }
- DALI_TEST_EQUALS(successCount, totalCount, TEST_LOCATION);
- tet_printf( "Test succeeded with %d passes out of %d tests\n", successCount, totalCount);
-}
-
-
-void OBBTestTextOutsideBoundary( TestApplication& application, int width, int height )
-{
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable(true);
-
- Vector2 stageSize = Stage::GetCurrent().GetSize();
-
- std::string text("Text");
-
- TextActor textActor = CreateOnStageActor(application, text, width, height, true);
- Vector3 textSize = textActor.GetCurrentSize();
- DALI_TEST_EQUALS( textSize, Vector3(width, height, std::min(width, height)), TEST_LOCATION);
-
- textSize.z = 0.0f;
- tet_printf("Testing Stage Size: (%3.0f, %3.0f) text size:(%3.0f, %3.0f)\n",
- stageSize.x, stageSize.y, textSize.x, textSize.y);
-
- int successCount=0;
- int totalCount=0;
-
- for( int i=0; i<=100; i++ )
- {
- float x1 = -stageSize.x/2.0f - textSize.x * (1.5f + i/100.0f);
- float x2 = stageSize.x/2.0f + textSize.x * (1.5f + i/100.0f);
- float y1 = -stageSize.y/2.0f - textSize.y * (1.5f + i/100.0f);
- float y2 = stageSize.y/2.0f + textSize.y * (1.5f + i/100.0f);
-
- for( int j=-10; j<=10; j++ )
- {
- float x = (stageSize.x/17.0f) * j; // use larger intervals to test more area
- float y = (stageSize.y/17.0f) * j;
-
- if(RepositionActor( application, textActor, x1, y, false )) successCount++;
- if(RepositionActor( application, textActor, x2, y, false )) successCount++;
- if(RepositionActor( application, textActor, x, y1, false )) successCount++;
- if(RepositionActor( application, textActor, x, y2, false )) successCount++;
- totalCount+=4;
- }
- }
- DALI_TEST_EQUALS(successCount, totalCount, TEST_LOCATION);
- tet_printf( "Test succeeded with %d passes out of %d tests\n", successCount, totalCount);
-}
-
-
-} // namespace
-
-int UtcDaliTextCulling_Inside01(void)
-{
- tet_infoline( "Testing that 80x80 text positioned inside the stage is drawn\n");
-
- TestApplication application;
-
- TestTextInside(application, 80, 80);
-
- END_TEST;
-}
-
-int UtcDaliTextCulling_Inside02(void)
-{
- tet_infoline( "Testing that 120x40 text positioned inside the stage is drawn\n");
-
- TestApplication application;
-
- TestTextInside(application, 120, 40);
-
- END_TEST;
-}
-
-int UtcDaliTextCulling_Inside03(void)
-{
- tet_infoline( "Testing that 40x120 text positioned inside the stage is drawn\n");
-
- TestApplication application;
-
- TestTextInside(application, 40, 120);
-
- END_TEST;
-}
-
-int UtcDaliTextCulling_Inside04(void)
-{
- tet_infoline( "Testing that 500x2 text positioned inside the stage is drawn\n");
- TestApplication application;
- TestTextInside(application, 500, 2);
- END_TEST;
-}
-
-int UtcDaliTextCulling_Inside05(void)
-{
- tet_infoline( "Testing that 2x500 text positioned inside the stage is drawn\n");
- TestApplication application;
- TestTextInside(application, 2, 500);
- END_TEST;
-}
-
-
-int UtcDaliTextCulling_WithinBoundary01(void)
-{
- tet_infoline("Test that 80x80 text positioned outside the stage but with bounding box intersecting the stage is drawn\n");
-
- TestApplication application;
- OBBTestTextAtBoundary( application, 80, 80);
- END_TEST;
-}
-int UtcDaliTextCulling_WithinBoundary02(void)
-{
- tet_infoline("Test that 120x40 text positioned outside the stage but with bounding box intersecting the stage is drawn\n");
-
- TestApplication application;
- OBBTestTextAtBoundary( application, 120, 40 );
- END_TEST;
-}
-int UtcDaliTextCulling_WithinBoundary03(void)
-{
- tet_infoline("Test that 40x120 text positioned outside the stage but with bounding box intersecting the stage is drawn\n");
-
- TestApplication application;
- OBBTestTextAtBoundary( application, 40, 120);
- END_TEST;
-}
-
-int UtcDaliTextCulling_WithinBoundary04(void)
-{
- tet_infoline("Test that 500x2 texts positioned outside the stage but with bounding box intersecting the stage is drawn\n");
-
- TestApplication application;
- OBBTestTextAtBoundary( application, 500, 2 );
- END_TEST;
-}
-
-int UtcDaliTextCulling_WithinBoundary05(void)
-{
- tet_infoline("Test that 2x500 texts positioned outside the stage but with bounding box intersecting the stage is drawn\n");
-
- TestApplication application;
- OBBTestTextAtBoundary( application, 2, 500 );
- END_TEST;
-}
-
-int UtcDaliTextCulling_OutsideBoundary01(void)
-{
- tet_infoline("Test that 80x80 text positioned outside the stage by more than 2 times\n"
- "the radius of the bounding circle is not drawn\n");
-
- TestApplication application;
- OBBTestTextOutsideBoundary( application, 80, 80 );
- END_TEST;
-}
-
-int UtcDaliTextCulling_OutsideBoundary02(void)
-{
- tet_infoline("Test that 120x40 text positioned outside the stage by more than 2 times\n"
- "the radius of the bounding circle is not drawn\n");
-
- TestApplication application;
- OBBTestTextOutsideBoundary( application, 120, 40 );
- END_TEST;
-}
-int UtcDaliTextCulling_OutsideBoundary03(void)
-{
- tet_infoline("Test that 40x120 text positioned outside the stage by more than 2 times\n"
- "the radius of the bounding circle is not drawn\n");
-
- TestApplication application;
- OBBTestTextOutsideBoundary( application, 40, 120 );
- END_TEST;
-}
-
-int UtcDaliTextCulling_OutsideBoundary04(void)
-{
- tet_infoline("Test that 500x2 text positioned outside the stage by more than 2 times\n"
- "the radius of the bounding circle is not drawn\n");
-
- TestApplication application;
- OBBTestTextOutsideBoundary( application, 500, 2 );
- END_TEST;
-}
-
-int UtcDaliTextCulling_OutsideBoundary05(void)
-{
- tet_infoline("Test that 2x500 text positioned outside the stage by more than 2 times\n"
- "the radius of the bounding circle is not drawn\n");
-
- TestApplication application;
- OBBTestTextOutsideBoundary( application, 2, 500 );
- END_TEST;
-}
-
-int UtcDaliTextCulling_OutsideIntersect01(void)
-{
- TestApplication application;
-
- tet_infoline("Test that actors positioned outside the stage with bounding boxes also\n"
- "outside the stage but intersecting it are still drawn");
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable(true);
- Vector2 stageSize = Stage::GetCurrent().GetSize();
-
- float width = stageSize.x*5.0f;
- float height = stageSize.y*0.2f;
- std::string text("Text");
- TextActor textActor = CreateOnStageActor(application, text, width, height, true);
-
- RepositionActor( application, textActor, stageSize.x*1.2f, 0.0f, true);
- RepositionActor( application, textActor, stageSize.x*1.2f, -stageSize.y*0.55f, true);
- RepositionActor( application, textActor, stageSize.x*1.2f, stageSize.y*0.55f, true);
- END_TEST;
-}
-
-int UtcDaliTextCulling_OutsideIntersect02(void)
-{
- TestApplication application;
-
- tet_infoline("Test that actors positioned outside the stage with bounding boxes also\n"
- "outside the stage that cross planes are not drawn");
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable(true);
- Vector2 stageSize = Stage::GetCurrent().GetSize();
-
- float width = stageSize.x*5.0f;
- float height = stageSize.y*0.2f;
- std::string text("Text");
- TextActor textActor = CreateOnStageActor(application, text, width, height, true);
-
- RepositionActor( application, textActor, stageSize.x*10.0f, stageSize.y*0.5f, false);
- RepositionActor( application, textActor, -stageSize.x*10.0f, stageSize.y*0.5f, false);
- RepositionActor( application, textActor, stageSize.x*10.0f, -stageSize.y*0.5f, false);
- RepositionActor( application, textActor, -stageSize.x*10.0f, -stageSize.y*0.5f, false);
- END_TEST;
-}
-
-int UtcDaliTextCulling_OutsideIntersect03(void)
-{
- TestApplication application;
-
- tet_infoline("Test that text actor larger than the stage, positioned outside the stage \n"
- "with bounding boxes also outside the stage but intersecting it is still drawn\n");
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable(true);
- Vector2 stageSize = Stage::GetCurrent().GetSize();
-
- // Try an actor bigger than the stage, with center outside stage
- float width = stageSize.x*5.0f;
- float height = stageSize.y*5.0f;
- std::string text("Text");
- TextActor textActor = CreateOnStageActor(application, text, width, height, true);
-
- RepositionActor( application, textActor, stageSize.x*1.2f, 0.0f, true);
- RepositionActor( application, textActor, stageSize.x*1.2f, -stageSize.y*1.1f, true);
- RepositionActor( application, textActor, stageSize.x*1.2f, stageSize.y*1.1f, true);
-
- END_TEST;
-}
-
-int UtcDaliTextCulling_OutsideIntersect04(void)
-{
- TestApplication application;
-
- tet_infoline("Test that text actors positioned outside the stage, with bounding boxes\n"
- "also outside the stage but intersecting it, and angled at 45 degrees to\n"
- "the corners are still drawn\n");
-
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable(true);
- Vector2 stageSize = Stage::GetCurrent().GetSize();
-
- // Test text at 45 degrees outside corners of stage
- float width = 400.0f;
- float height = 200.0f;
- std::string text("Text");
- TextActor textActor = CreateOnStageActor(application, text, width, height, true);
-
- RepositionActorWithAngle( application, textActor, -stageSize.x*0.55f, -stageSize.y*0.55, 135.0f, true);
- RepositionActorWithAngle( application, textActor, -stageSize.x*0.55f, stageSize.y*0.55, 225.0f, true);
- RepositionActorWithAngle( application, textActor, stageSize.x*0.55f, -stageSize.y*0.55, 45.0f, true);
- RepositionActorWithAngle( application, textActor, stageSize.x*0.55f, stageSize.y*0.55, 315.0f, true);
-
- END_TEST;
-}
-
-
-int UtcDaliTextCulling_Disable(void)
-{
- tet_infoline("Test that culling can be disabled");
-
- TestApplication application;
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable(true);
-
- Vector2 stageSize = Stage::GetCurrent().GetSize();
- float width=80;
- float height=80;
- std::string text("Text");
-
-
- TextActor textActor = CreateOnStageActor(application, text, width, height, true);
- Vector3 textSize = textActor.GetCurrentSize();
- DALI_TEST_EQUALS( textSize, Vector3(width, height, std::min(width, height)), TEST_LOCATION);
-
- textSize.z = 0.0f;
-
- tet_infoline("Setting cull mode to false\n");
- Stage::GetCurrent().GetRenderTaskList().GetTask(0).SetCullMode(false);
-
- float x1 = -stageSize.x - textSize.x;
- float x2 = stageSize.x + textSize.x;
- float y1 = -stageSize.y - textSize.y;
- float y2 = stageSize.y + textSize.y;
-
- // Positioning actors outside stage, with no culling, they should still be drawn.
- RepositionActorOutside( application, textActor, x1, y1, true );
- RepositionActorOutside( application, textActor, x2, y1, true );
- RepositionActorOutside( application, textActor, x1, y2, true );
- RepositionActorOutside( application, textActor, x2, y2, true );
-
- tet_infoline("Setting cull mode to true\n");
- Stage::GetCurrent().GetRenderTaskList().GetTask(0).SetCullMode(true);
-
- RepositionActorOutside( application, textActor, x1, y1, false );
- RepositionActorOutside( application, textActor, x2, y1, false );
- RepositionActorOutside( application, textActor, x1, y2, false );
- RepositionActorOutside( application, textActor, x2, y2, false );
-
- END_TEST;
-}
diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-Text.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-Text.cpp
deleted file mode 100644
index f482755..0000000
--- a/automated-tests/src/dali-internal/utc-Dali-Internal-Text.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include
-
-#include
-#include
-#include
-#include
-
-// Internal headers are allowed here
-
-#include
-
-using namespace Dali;
-
-void utc_dali_internal_text_startup()
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_internal_text_cleanup()
-{
- test_return_value = TET_PASS;
-}
-
-int UtcDaliTextGetImplementation01(void)
-{
- TestApplication application;
-
- Text text( std::string( "Hello world" ) );
-
- const Internal::Text& textImpl1 = text.GetImplementation();
-
- DALI_TEST_CHECK( NULL != &textImpl1 );
-
- Internal::Text& textImpl2 = text.GetImplementation();
-
- DALI_TEST_CHECK( NULL != &textImpl2 );
-
- END_TEST;
-}
-
-int UtcDaliTextGetImplementation02(void)
-{
- TestApplication application;
-
- Text text;
-
- bool assert1 = false;
- bool assert2 = false;
-
- try // const GetImpl
- {
- const Internal::Text& impl = text.GetImplementation();
- (void)impl; // Avoid unused variable warning
- }
- catch( DaliException& e )
- {
- tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
- DALI_TEST_EQUALS( e.mCondition, "NULL != mImpl && \"Text::GetImplementation: Text is uninitialized\"", TEST_LOCATION );
-
- assert1 = true;
- }
-
- try // non const getImp
- {
- Internal::Text& impl = text.GetImplementation();
- (void)impl; // Avoid unused variable warning
- }
- catch( DaliException& e )
- {
- tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
- DALI_TEST_EQUALS( e.mCondition, "NULL != mImpl && \"Text::GetImplementation: Text is uninitialized\"", TEST_LOCATION );
-
- assert2 = true;
- }
-
- if( assert1 && assert2 )
- {
- tet_result( TET_PASS );
- }
- else
- {
- tet_result( TET_FAIL );
- }
- END_TEST;
-}
-
-int UtcDaliTextGetTextArray(void)
-{
- TestApplication application;
-
- Text text( std::string( "Hello world" ) );
-
- DALI_TEST_EQUALS( text.GetImplementation().GetTextArray().Count(), 11u, TEST_LOCATION );
-
- END_TEST;
-}
diff --git a/automated-tests/src/dali-unmanaged/CMakeLists.txt b/automated-tests/src/dali-unmanaged/CMakeLists.txt
index e83d442..008b18c 100644
--- a/automated-tests/src/dali-unmanaged/CMakeLists.txt
+++ b/automated-tests/src/dali-unmanaged/CMakeLists.txt
@@ -32,7 +32,6 @@ SET(TC_SOURCES
utc-Dali-Scripting.cpp
utc-Dali-Spline.cpp
utc-Dali-TypeRegistry.cpp
- utc-Dali-Utf8.cpp
utc-Dali-Vector.cpp
)
diff --git a/automated-tests/src/dali-unmanaged/dali-test-suite-utils/test-platform-abstraction.cpp b/automated-tests/src/dali-unmanaged/dali-test-suite-utils/test-platform-abstraction.cpp
index d5f24ab..e149301 100644
--- a/automated-tests/src/dali-unmanaged/dali-test-suite-utils/test-platform-abstraction.cpp
+++ b/automated-tests/src/dali-unmanaged/dali-test-suite-utils/test-platform-abstraction.cpp
@@ -160,148 +160,6 @@ bool TestPlatformAbstraction::IsLoading()
}
/**
- * @copydoc PlatformAbstraction::GetDefaultFontFamily()
- */
-const std::string& TestPlatformAbstraction::GetDefaultFontFamily() const
-{
- mTrace.PushCall("GetDefaultFontFamily", "");
- return mGetDefaultFontFamilyResult;
-}
-
-/**
- * @copydoc PlatformAbstraction::GetDefaultFontSize()
- */
-float TestPlatformAbstraction::GetDefaultFontSize() const
-{
- mTrace.PushCall("GetDefaultFontSize", "");
- return mGetDefaultFontSizeResult;
-}
-
-PixelSize TestPlatformAbstraction::GetFontLineHeightFromCapsHeight(const std::string& fontFamily, const std::string& fontStyle, CapsHeight capsHeight) const
-{
- mTrace.PushCall("GetFontLineHeightFromCapsHeight", "");
- // LineHeight will be bigger than CapsHeight, so return capsHeight + 1
- return PixelSize(capsHeight + 1);
-}
-
-/**
- * @copydoc PlatformAbstraction::GetGlyphData()
- */
-
-Integration::GlyphSet* TestPlatformAbstraction::GetGlyphData ( const Integration::TextResourceType& textRequest,
- const std::string& fontFamily,
- bool getBitmap) const
-{
- if( getBitmap )
- {
- mTrace.PushCall("GetGlyphData", "getBitmap:true");
- }
- else
- {
- mTrace.PushCall("GetGlyphData", "getBitmap:false");
- }
-
- // It creates fake metrics for the received characters.
-
- Integration::GlyphSet* set = new Dali::Integration::GlyphSet();
- Integration::BitmapPtr bitmapData;
-
- std::set characters;
-
- for( Integration::TextResourceType::CharacterList::const_iterator it = textRequest.mCharacterList.begin(), endIt = textRequest.mCharacterList.end(); it != endIt; ++it )
- {
- if( characters.find( it->character ) == characters.end() )
- {
- characters.insert( it->character );
- Integration::GlyphMetrics character = {it->character, Integration::GlyphMetrics::LOW_QUALITY, 10.0f, 10.0f, 9.0f, 1.0f, 10.0f, it->xPosition, it->yPosition };
-
- if( getBitmap )
- {
- bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD);
- bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64);
- PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
- memset( pixelBuffer, it->character, 64*64 );
- }
-
- set->AddCharacter(bitmapData, character);
- }
- }
-
- set->mLineHeight = 10.0f;
- set->mAscender = 9.0f;
- set->mUnitsPerEM = 2048.0f/64.0f;
- set->SetAtlasResourceId( textRequest.mTextureAtlasId );
- set->mFontHash = textRequest.mFontHash;
-
- return set;
-}
-
-/**
- * @copydoc PlatformAbstraction::GetCachedGlyphData()
- */
-
-Integration::GlyphSet* TestPlatformAbstraction::GetCachedGlyphData( const Integration::TextResourceType& textRequest,
- const std::string& fontFamily ) const
-{
- mTrace.PushCall("GetCachedGlyphData", "");
-
- // It creates fake metrics and bitmap for received numeric characters '0' through '9'.
- Integration::GlyphSet* set = new Dali::Integration::GlyphSet();
- Integration::BitmapPtr bitmapData;
-
- std::set characters;
-
- for( Integration::TextResourceType::CharacterList::const_iterator it = textRequest.mCharacterList.begin(), endIt = textRequest.mCharacterList.end(); it != endIt; ++it )
- {
- if( it->character >= '0' && it->character <= '9' && characters.find( it->character ) == characters.end() )
- {
- characters.insert( it->character );
- Integration::GlyphMetrics character = {it->character, Integration::GlyphMetrics::HIGH_QUALITY, 10.0f, 10.0f, 9.0f, 1.0f, 10.0f, it->xPosition, it->yPosition };
-
- bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD);
- bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64);
- PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
- memset( pixelBuffer, it->character, 64*64 );
- set->AddCharacter(bitmapData, character);
- }
- }
-
- set->mLineHeight = 10.0f;
- set->mAscender = 9.0f;
- set->mUnitsPerEM = 2048.0f/64.0f;
- set->SetAtlasResourceId( textRequest.mTextureAtlasId );
- set->mFontHash = textRequest.mFontHash;
-
- return set;
-}
-
-
-/**
- * @copydoc PlatformAbstraction::GetGlobalMetrics()
- */
-void TestPlatformAbstraction::GetGlobalMetrics( const std::string& fontFamily,
- const std::string& fontStyle,
- Integration::GlobalMetrics& globalMetrics ) const
-{
- globalMetrics.lineHeight = 10.0f;
- globalMetrics.ascender = 9.0f;
- globalMetrics.unitsPerEM = 2048.0f/64.0f;
- globalMetrics.underlineThickness = 2.f;
- globalMetrics.underlinePosition = 1.f;
-}
-
-/**
- * @copydoc PlatformAbstraction::GetFontPath()
- */
-std::string TestPlatformAbstraction::GetFontPath(const std::string& family, bool bold, bool italic) const
-{
- mTrace.PushCall("GetFontPath", "");
- return mGetFontPathResult;
-
- // Do nothing with arguments
-}
-
-/**
* @copydoc PlatformAbstraction::SetDpi()
*/
void TestPlatformAbstraction::SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical)
@@ -310,42 +168,6 @@ void TestPlatformAbstraction::SetDpi (unsigned int dpiHorizontal, unsigned int d
}
/**
- * @copydoc PlatformAbstraction::GetFontFamilyForChars()
- */
-const std::string& TestPlatformAbstraction::GetFontFamilyForChars(const Integration::TextArray& charsRequested) const
-{
- mTrace.PushCall("GetFontFamilyForChars", "");
- return mGetDefaultFontFamilyResult;
-}
-
-/**
- * @copydoc PlatformAbstraction::AllGlyphsSupported()
- */
-bool TestPlatformAbstraction::AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const Integration::TextArray& text) const
-{
- mTrace.PushCall("AllGlyphsSupported", "");
- return true;
-}
-
-/**
- * @copydoc PlatformAbstraction::ValidateFontFamilyName()
- */
-bool TestPlatformAbstraction::ValidateFontFamilyName(const std::string& fontFamily, const std::string& fontStyle, bool& isDefaultSystemFont, std::string& closestMatch, std::string& closestStyleMatch) const
-{
- mTrace.PushCall("ValidateFontFamilyName", "");
- return true;
-}
-
-/**
- * @copydoc PlatformAbstraction::GetFontList()
- */
-void TestPlatformAbstraction::GetFontList( PlatformAbstraction::FontListMode mode, std::vector& fontList ) const
-{
- mFontListMode = mode;
- mTrace.PushCall("ValidateGetFontList", "");
-}
-
-/**
* @copydoc PlatformAbstraction::LoadFile()
*/
bool TestPlatformAbstraction::LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const
@@ -373,12 +195,6 @@ void TestPlatformAbstraction::JoinLoaderThreads()
mTrace.PushCall("JoinLoaderThreads", "");
}
-void TestPlatformAbstraction::UpdateDefaultsFromDevice()
-{
- mTrace.PushCall("UpdateDefaultsFromDevice", "");
- mGetDefaultFontFamilyResult+=1.0f;
-}
-
Integration::DynamicsFactory* TestPlatformAbstraction::GetDynamicsFactory()
{
mTrace.PushCall("GetDynamicsFactory", "");
@@ -389,87 +205,15 @@ Integration::DynamicsFactory* TestPlatformAbstraction::GetDynamicsFactory()
return mDynamicsFactory;
}
-bool TestPlatformAbstraction::ReadGlobalMetricsFromCache( const std::string& fontFamily,
- const std::string& fontStyle,
- Integration::GlobalMetrics& globalMetrics )
-{
- mTrace.PushCall("ReadGlobalMetricsFromCacheFile", "");
- globalMetrics = mReadGlobalMetrics; // Want to copy contents...
- return mReadGlobalMetricsResult; // Default false (will be set to true on subsequent write)
-}
-
-void TestPlatformAbstraction::WriteGlobalMetricsToCache( const std::string& fontFamily,
- const std::string& fontStyle,
- const Integration::GlobalMetrics& globalMetrics )
-{
- // Copy so next read uses written values. TODO: Could add method
- // to turn this behaviour off for more extensive testing.
- mReadGlobalMetrics = globalMetrics;
- mReadGlobalMetricsResult = true;
-
- mTrace.PushCall("WriteGlobalMetricsToCacheFile", "");
-}
-
-bool TestPlatformAbstraction::ReadMetricsFromCache( const std::string& fontFamily,
- const std::string& fontStyle,
- std::vector& glyphMetricsContainer )
-{
- mTrace.PushCall("ReadMetricsFromCacheFile", "");
- glyphMetricsContainer = mReadMetrics;
- return mReadMetricsResult; // Default false (will be set to true on subsequent write)
-}
-
-void TestPlatformAbstraction::WriteMetricsToCache( const std::string& fontFamily,
- const std::string& fontStyle,
- const Integration::GlyphSet& glyphSet )
-{
- // Copy so next read uses written values. TODO: Could add method
- // to turn this behaviour off for more extensive testing.
- const Integration::GlyphSet::CharacterList& charList = glyphSet.GetCharacterList();
- mReadMetrics.clear();
- for(std::size_t i=0, end=charList.size(); i& fileNames )
-{
- fileNames.push_back( std::string( "u1f004.png" ) );
- fileNames.push_back( std::string( "u1f0cf.png" ) );
- fileNames.push_back( std::string( "u1f170.png" ) );
- fileNames.push_back( std::string( "u1f601.png" ) );
-}
-
-Integration::BitmapPtr TestPlatformAbstraction::GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const
-{
- Integration::BitmapPtr image = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
- image->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 1, 1 );
-
- mTrace.PushCall("GetGlyphImage", "");
-
- return image;
-}
-
/** Call this every test */
void TestPlatformAbstraction::Initialize()
{
mTrace.Reset();
mTrace.Enable(true);
memset(&mResources, 0, sizeof(Resources));
- memset(&mReadGlobalMetrics, 0, sizeof(Integration::GlobalMetrics));
mSeconds=0;
mMicroSeconds=0;
mIsLoadingResult=false;
- mGetDefaultFontFamilyResult = "HelveticaNeue";
- mGetDefaultFontSizeResult=12.0f;
- mGetFontPathResult="helvetica-12";
- mReadMetricsResult=false;
- mReadGlobalMetricsResult=false;
if(mRequest)
{
@@ -478,7 +222,6 @@ void TestPlatformAbstraction::Initialize()
}
}
-
bool TestPlatformAbstraction::WasCalled(TestFuncEnum func)
{
switch(func)
@@ -493,24 +236,9 @@ bool TestPlatformAbstraction::WasCalled(TestFuncEnum func)
case CancelLoadFunc: return mTrace.FindMethod("CancelLoad");
case GetResourcesFunc: return mTrace.FindMethod("GetResources");
case IsLoadingFunc: return mTrace.FindMethod("IsLoading");
- case GetDefaultFontFamilyFunc: return mTrace.FindMethod("GetDefaultFontFamily");
- case GetDefaultFontSizeFunc: return mTrace.FindMethod("GetDefaultFontSize");
- case GetFontLineHeightFromCapsHeightFunc: return mTrace.FindMethod("GetFontLineHeightFromCapsHeight");
- case GetGlyphDataFunc: return mTrace.FindMethod("GetGlyphData");
- case GetCachedGlyphDataFunc: return mTrace.FindMethod("GetCachedGlyphData");
- case GetFontPathFunc: return mTrace.FindMethod("GetFontPath");
case SetDpiFunc: return mTrace.FindMethod("SetDpi");
case JoinLoaderThreadsFunc: return mTrace.FindMethod("JoinLoaderThreads");
- case GetFontFamilyForCharsFunc: return mTrace.FindMethod("GetFontFamilyForChars");
- case AllGlyphsSupportedFunc: return mTrace.FindMethod("AllGlyphsSupported");
- case ValidateFontFamilyNameFunc: return mTrace.FindMethod("ValidateFontFamilyName");
- case UpdateDefaultsFromDeviceFunc: return mTrace.FindMethod("UpdateDefaultsFromDevice");
case GetDynamicsFactoryFunc: return mTrace.FindMethod("GetDynamicsFactory");
- case ValidateGetFontListFunc: return mTrace.FindMethod("ValidateGetFontList");
- case ReadGlobalMetricsFromCacheFileFunc: return mTrace.FindMethod("ReadGlobalMetricsFromCacheFile");
- case WriteGlobalMetricsToCacheFileFunc: return mTrace.FindMethod("WriteGlobalMetricsToCacheFile");
- case ReadMetricsFromCacheFileFunc: return mTrace.FindMethod("ReadMetricsFromCacheFile");
- case WriteMetricsToCacheFileFunc: return mTrace.FindMethod("WriteMetricsToCacheFile");
}
return false;
}
@@ -535,21 +263,6 @@ void TestPlatformAbstraction::SetIsLoadingResult(bool result)
mIsLoadingResult = result;
}
-void TestPlatformAbstraction::SetGetDefaultFontFamilyResult(std::string result)
-{
- mGetDefaultFontFamilyResult = result;
-}
-
-void TestPlatformAbstraction::SetGetDefaultFontSizeResult(float result)
-{
- mGetDefaultFontSizeResult = result;
-}
-
-void TestPlatformAbstraction::SetGetFontPathResult(std::string& result)
-{
- mGetFontPathResult = result;
-}
-
void TestPlatformAbstraction::ClearReadyResources()
{
memset(&mResources, 0, sizeof(Resources));
@@ -619,21 +332,4 @@ void TestPlatformAbstraction::SetSaveFileResult( bool result )
mSaveFileResult = result;
}
-Integration::PlatformAbstraction::FontListMode TestPlatformAbstraction::GetLastFontListMode( )
-{
- return mFontListMode;
-}
-
-void TestPlatformAbstraction::SetReadGlobalMetricsResult( bool success, Integration::GlobalMetrics& globalMetrics )
-{
- mReadGlobalMetricsResult = success;
- mReadGlobalMetrics = globalMetrics;
-}
-
-void TestPlatformAbstraction::SetReadMetricsResult( bool success, std::vector& glyphMetricsContainer )
-{
- mReadMetricsResult = success;
- mReadMetrics = glyphMetricsContainer; // copy
-}
-
} // namespace Dali
diff --git a/automated-tests/src/dali-unmanaged/dali-test-suite-utils/test-platform-abstraction.h b/automated-tests/src/dali-unmanaged/dali-test-suite-utils/test-platform-abstraction.h
index e8614ec..8a9919a 100644
--- a/automated-tests/src/dali-unmanaged/dali-test-suite-utils/test-platform-abstraction.h
+++ b/automated-tests/src/dali-unmanaged/dali-test-suite-utils/test-platform-abstraction.h
@@ -26,7 +26,6 @@
#include
#include
-#include
#include "test-trace-call-stack.h"
#include "test-dynamics.h"
@@ -134,72 +133,11 @@ public:
virtual bool IsLoading();
/**
- * @copydoc PlatformAbstraction::GetDefaultFontFamily()
- */
- virtual const std::string& GetDefaultFontFamily() const;
-
- /**
- * @copydoc PlatformAbstraction::GetDefaultFontSize()
- */
- virtual float GetDefaultFontSize() const;
-
- /**
- * @copydoc PlatformAbstraction::GetFontLineHeightFromCapsHeight()
- */
- virtual PixelSize GetFontLineHeightFromCapsHeight(const std::string& fontFamily, const std::string& fontStyle, CapsHeight capsHeight) const;
-
- /**
- * @copydoc PlatformAbstraction::GetGlyphData()
- */
- virtual Integration::GlyphSet* GetGlyphData ( const Integration::TextResourceType& textRequest,
- const std::string& fontFamily,
- bool getBitmap) const;
-
- /**
- * @copydoc PlatformAbstraction::GetCachedGlyphData()
- */
- virtual Integration::GlyphSet* GetCachedGlyphData( const Integration::TextResourceType& textRequest,
- const std::string& fontFamily ) const;
-
-
- /**
- * @copydoc PlatformAbstraction::GetGlobalMetrics()
- */
- virtual void GetGlobalMetrics( const std::string& fontFamily,
- const std::string& fontStyle,
- Integration::GlobalMetrics& globalMetrics ) const;
-
- /**
- * @copydoc PlatformAbstraction::GetFontPath()
- */
- virtual std::string GetFontPath(const std::string& family, bool bold, bool italic) const;
-
- /**
* @copydoc PlatformAbstraction::SetDpi()
*/
virtual void SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical);
/**
- * @copydoc PlatformAbstraction::GetFontFamilyForChars()
- */
- virtual const std::string& GetFontFamilyForChars(const Integration::TextArray& charsRequested) const;
-
- /**
- * @copydoc PlatformAbstraction::AllGlyphsSupported()
- */
- virtual bool AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const Integration::TextArray& text) const;
-
- /**
- * @copydoc PlatformAbstraction::ValidateFontFamilyName()
- */
- virtual bool ValidateFontFamilyName(const std::string& fontFamily, const std::string& fontStyle, bool& isDefaultSystemFont, std::string& closestMatch, std::string& closestStyleMatch) const;
-
- /**
- * @copydoc PlatformAbstraction::GetFontList()
- */
- virtual void GetFontList( PlatformAbstraction::FontListMode mode, std::vector& fontList ) const;
-
- /**
* @copydoc PlatformAbstraction::LoadFile()
*/
virtual bool LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
@@ -211,30 +149,8 @@ public:
virtual void JoinLoaderThreads();
- virtual void UpdateDefaultsFromDevice();
-
virtual Integration::DynamicsFactory* GetDynamicsFactory();
- virtual bool ReadGlobalMetricsFromCache( const std::string& fontFamily,
- const std::string& fontStyle,
- Integration::GlobalMetrics& globalMetrics );
-
- virtual void WriteGlobalMetricsToCache( const std::string& fontFamily,
- const std::string& fontStyle,
- const Integration::GlobalMetrics& globalMetrics );
-
- virtual bool ReadMetricsFromCache( const std::string& fontFamily,
- const std::string& fontStyle,
- std::vector& glyphMetricsContainer );
- virtual void WriteMetricsToCache( const std::string& fontFamily,
- const std::string& fontStyle,
- const Integration::GlyphSet& glyphSet );
-
- virtual void GetFileNamesFromDirectory( const std::string& directoryName,
- std::vector& fileNames );
-
- virtual Integration::BitmapPtr GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const;
-
public: // TEST FUNCTIONS
// Enumeration of Platform Abstraction methods
@@ -250,24 +166,9 @@ public: // TEST FUNCTIONS
CancelLoadFunc,
GetResourcesFunc,
IsLoadingFunc,
- GetDefaultFontFamilyFunc,
- GetDefaultFontSizeFunc,
- GetFontLineHeightFromCapsHeightFunc,
- GetGlyphDataFunc,
- GetCachedGlyphDataFunc,
SetDpiFunc,
- GetFontPathFunc,
JoinLoaderThreadsFunc,
- GetFontFamilyForCharsFunc,
- AllGlyphsSupportedFunc,
- ValidateFontFamilyNameFunc,
- UpdateDefaultsFromDeviceFunc,
GetDynamicsFactoryFunc,
- ValidateGetFontListFunc,
- ReadGlobalMetricsFromCacheFileFunc,
- WriteGlobalMetricsToCacheFileFunc,
- ReadMetricsFromCacheFileFunc,
- WriteMetricsToCacheFileFunc,
} TestFuncEnum;
/** Call this every test */
@@ -285,12 +186,6 @@ public: // TEST FUNCTIONS
void SetIsLoadingResult(bool result);
- void SetGetDefaultFontFamilyResult(std::string result);
-
- void SetGetDefaultFontSizeResult(float result);
-
- void SetGetFontPathResult(std::string& result);
-
void ClearReadyResources();
void SetResourceLoaded(Integration::ResourceId loadedId,
@@ -316,32 +211,18 @@ public: // TEST FUNCTIONS
void SetSaveFileResult( bool result );
- PlatformAbstraction::FontListMode GetLastFontListMode( );
-
- void SetReadGlobalMetricsResult( bool success, Integration::GlobalMetrics& globalMetrics );
-
- void SetReadMetricsResult( bool success, std::vector& glyphMetricsContainer );
-
private:
mutable TraceCallStack mTrace;
size_t mSeconds;
size_t mMicroSeconds;
bool mIsLoadingResult;
- std::string mGetDefaultFontFamilyResult;
- float mGetDefaultFontSizeResult;
- std::string mGetFontPathResult;
Resources mResources;
Integration::ResourceRequest* mRequest;
Vector2 mSize;
Vector2 mClosestSize;
- bool mReadGlobalMetricsResult;
- bool mReadMetricsResult;
- Integration::GlobalMetrics mReadGlobalMetrics;
- std::vector mReadMetrics;
LoadFileResult mLoadFileResult;
bool mSaveFileResult;
- mutable FontListMode mFontListMode;
TestDynamicsFactory* mDynamicsFactory;
};
diff --git a/automated-tests/src/dali-unmanaged/utc-Dali-HitTestAlgorithm.cpp b/automated-tests/src/dali-unmanaged/utc-Dali-HitTestAlgorithm.cpp
index f6350c7..308fa67 100644
--- a/automated-tests/src/dali-unmanaged/utc-Dali-HitTestAlgorithm.cpp
+++ b/automated-tests/src/dali-unmanaged/utc-Dali-HitTestAlgorithm.cpp
@@ -387,7 +387,7 @@ int UtcDaliHitTestAlgorithmStencil(void)
layer.Add( stencil );
// Create a renderable actor and add that to the layer
- Actor layerHitActor = TextActor::New();
+ Actor layerHitActor = ImageActor::New();
layerHitActor.SetSize( 100.0f, 100.0f );
layerHitActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
layerHitActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
diff --git a/automated-tests/src/dali-unmanaged/utc-Dali-ObjectRegistry.cpp b/automated-tests/src/dali-unmanaged/utc-Dali-ObjectRegistry.cpp
index d772a3f..64ae73c 100644
--- a/automated-tests/src/dali-unmanaged/utc-Dali-ObjectRegistry.cpp
+++ b/automated-tests/src/dali-unmanaged/utc-Dali-ObjectRegistry.cpp
@@ -180,24 +180,6 @@ struct TestModelCallback
bool& mSignalVerified;
};
-struct TestTextActorCallback
-{
- TestTextActorCallback(bool& signalReceived)
- : mSignalVerified(signalReceived)
- {
- }
- void operator()(BaseHandle object)
- {
- tet_infoline("Verifying TestTextActorCallback()");
- TextActor actor = TextActor::DownCast(object);
- if(actor)
- {
- mSignalVerified = true;
- }
- }
- bool& mSignalVerified;
-};
-
struct TestAnimationCallback
{
TestAnimationCallback(bool& signalReceived)
@@ -438,31 +420,6 @@ int UtcDaliObjectRegistrySignalModelCreated(void)
END_TEST;
}
-int UtcDaliObjectRegistrySignalTextActorCreated(void)
-{
- TestApplication application;
- ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
-
- bool verified = false;
- TestTextActorCallback test(verified);
-
- Dali::RefObject* objectPointer = NULL;
- TestObjectDestroyedCallback test2(verified, objectPointer);
-
- registry.ObjectCreatedSignal().Connect(&application, test);
- registry.ObjectDestroyedSignal().Connect(&application, test2);
-
- {
- TextActor actor = TextActor::New("Hello");
- DALI_TEST_CHECK( test.mSignalVerified );
-
- verified = false;
- objectPointer = actor.GetObjectPtr();
- }
- DALI_TEST_CHECK( test.mSignalVerified );
- END_TEST;
-}
-
int UtcDaliObjectRegistrySignalAnimationCreated(void)
{
TestApplication application;
diff --git a/automated-tests/src/dali-unmanaged/utc-Dali-Scripting.cpp b/automated-tests/src/dali-unmanaged/utc-Dali-Scripting.cpp
index 1d3aa68..d39ac28 100644
--- a/automated-tests/src/dali-unmanaged/utc-Dali-Scripting.cpp
+++ b/automated-tests/src/dali-unmanaged/utc-Dali-Scripting.cpp
@@ -745,12 +745,6 @@ int UtcDaliScriptingNewActorChildren(void)
DALI_TEST_EQUALS( child1.GetCurrentPosition(), Vector3::YAXIS, TEST_LOCATION );
DALI_TEST_EQUALS( child1.GetChildCount(), 1u, TEST_LOCATION );
- Actor child2 = handle.GetChildAt(1);
- DALI_TEST_CHECK( child2 );
- DALI_TEST_CHECK( TextActor::DownCast( child2 ) );
- DALI_TEST_EQUALS( child2.GetCurrentPosition(), Vector3::ZAXIS, TEST_LOCATION );
- DALI_TEST_EQUALS( child2.GetChildCount(), 0u, TEST_LOCATION );
-
Actor grandChild = child1.GetChildAt( 0 );
DALI_TEST_CHECK( grandChild );
DALI_TEST_CHECK( LightActor::DownCast( grandChild ) );
@@ -860,11 +854,9 @@ int UtcDaliScriptingCreatePropertyMapActor(void)
{
Actor actor = Actor::New();
Actor child = ImageActor::New();
- Actor grandChild = TextActor::New();
- Actor grandChild2 = LightActor::New();
+ Actor grandChild = LightActor::New();
actor.Add( child );
child.Add( grandChild );
- child.Add( grandChild2 );
Stage::GetCurrent().Add( actor );
application.SendNotification();
@@ -889,19 +881,13 @@ int UtcDaliScriptingCreatePropertyMapActor(void)
DALI_TEST_CHECK( childValue.HasKey( "actors" ) );
Property::Array grandChildren( childValue.GetValue( "actors").Get< Property::Array >() );
- DALI_TEST_CHECK( grandChildren.size() == 2u );
+ DALI_TEST_CHECK( grandChildren.size() == 1u );
Property::Map grandChildMap( grandChildren[0].Get< Property::Map >() );
DALI_TEST_CHECK( !grandChildMap.Empty() );
Property::Value grandChildValue( grandChildMap );
DALI_TEST_CHECK( grandChildValue.HasKey( "type" ) );
- DALI_TEST_EQUALS( grandChildValue.GetValue( "type" ).Get< std::string >(), "TextActor", TEST_LOCATION );
-
- Property::Map grandChild2Map( grandChildren[1].Get< Property::Map >() );
- DALI_TEST_CHECK( !grandChild2Map.Empty() );
- Property::Value grandChild2Value( grandChild2Map );
- DALI_TEST_CHECK( grandChild2Value.HasKey( "type" ) );
- DALI_TEST_EQUALS( grandChild2Value.GetValue( "type" ).Get< std::string >(), "LightActor", TEST_LOCATION );
+ DALI_TEST_EQUALS( grandChildValue.GetValue( "type" ).Get< std::string >(), "LightActor", TEST_LOCATION );
Stage::GetCurrent().Remove( actor );
}
diff --git a/automated-tests/src/dali-unmanaged/utc-Dali-TypeRegistry.cpp b/automated-tests/src/dali-unmanaged/utc-Dali-TypeRegistry.cpp
index 0ecf8ce..5f2ff27 100644
--- a/automated-tests/src/dali-unmanaged/utc-Dali-TypeRegistry.cpp
+++ b/automated-tests/src/dali-unmanaged/utc-Dali-TypeRegistry.cpp
@@ -509,13 +509,6 @@ int UtcDaliTypeRegistryCreateDaliObjects(void)
Stage::GetCurrent().Add( ia );
application.Render();
- type = registry.GetTypeInfo( "TextActor" );
- DALI_TEST_CHECK( type );
- TextActor ta = TextActor::DownCast(type.CreateInstance());
- DALI_TEST_CHECK( ta );
- Stage::GetCurrent().Add( ta );
- application.Render();
-
type = registry.GetTypeInfo( "CameraActor" );
DALI_TEST_CHECK( type );
CameraActor ca = CameraActor::DownCast(type.CreateInstance());
@@ -607,8 +600,8 @@ int UtcDaliTypeRegistryNames(void)
// Check named and typeid are equivalent
int UtcDaliTypeRegistryNameEquivalence(void)
{
- TypeInfo named_type = TypeRegistry::Get().GetTypeInfo( "TextActor" );
- TypeInfo typeinfo_type = TypeRegistry::Get().GetTypeInfo( typeid(Dali::TextActor) );
+ TypeInfo named_type = TypeRegistry::Get().GetTypeInfo( "ImageActor" );
+ TypeInfo typeinfo_type = TypeRegistry::Get().GetTypeInfo( typeid(Dali::ImageActor) );
DALI_TEST_CHECK( named_type );
DALI_TEST_CHECK( typeinfo_type );
diff --git a/automated-tests/src/dali-unmanaged/utc-Dali-Utf8.cpp b/automated-tests/src/dali-unmanaged/utc-Dali-Utf8.cpp
deleted file mode 100644
index 851d758..0000000
--- a/automated-tests/src/dali-unmanaged/utc-Dali-Utf8.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include
-
-#include
-#include
-#include
-
-using namespace Dali;
-
-
-// Positive test case for a method
-int UtcDaliUtf8SequenceLength(void)
-{
- tet_infoline("UtcDaliUtf8SequenceLength ");
- TestApplication application;
-
- std::string latinText( "amazing" );
- std::string japaneseText( "ããã" );
- std::string accent("é");
-
- tet_infoline("utf8 1 byte Test ");
- DALI_TEST_EQUALS( Utf8SequenceLength( latinText[0] ), 1u, TEST_LOCATION );
- tet_infoline("utf8 3 byte Test ");
- DALI_TEST_EQUALS( Utf8SequenceLength( japaneseText[0] ), 3u, TEST_LOCATION );
- tet_infoline("utf8 2 byte Test ");
- DALI_TEST_EQUALS( Utf8SequenceLength( accent[0] ), 2u, TEST_LOCATION );
- END_TEST;
-}
diff --git a/automated-tests/src/dali/CMakeLists.txt b/automated-tests/src/dali/CMakeLists.txt
index b023c1d..532237e 100644
--- a/automated-tests/src/dali/CMakeLists.txt
+++ b/automated-tests/src/dali/CMakeLists.txt
@@ -16,12 +16,9 @@ SET(TC_SOURCES
utc-Dali-BaseHandle.cpp
utc-Dali-BitmapImage.cpp
utc-Dali-CameraActor.cpp
- utc-Dali-Character.cpp
utc-Dali-Constraint.cpp
utc-Dali-CustomActor.cpp
utc-Dali-Degree.cpp
- utc-Dali-Font.cpp
- utc-Dali-FontParameters.cpp
utc-Dali-FrameBufferImage.cpp
utc-Dali-Gesture.cpp
utc-Dali-GestureDetector.cpp
@@ -59,9 +56,6 @@ SET(TC_SOURCES
utc-Dali-Stage.cpp
utc-Dali-TapGesture.cpp
utc-Dali-TapGestureDetector.cpp
- utc-Dali-Text.cpp
- utc-Dali-TextActor.cpp
- utc-Dali-TextStyle.cpp
utc-Dali-TouchEventCombiner.cpp
utc-Dali-TouchProcessing.cpp
utc-Dali-Vector2.cpp
diff --git a/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.h b/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.h
index 375fb90..44be6c4 100644
--- a/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.h
+++ b/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.h
@@ -296,41 +296,6 @@ void DALI_TEST_EQUALS( const std::string &str1, const char* str2, const char* lo
void DALI_TEST_EQUALS( const char* str1, const std::string &str2, const char* location);
/**
- * Test whether two UTF32 strings are equal.
- * @param[in] str1 The first string
- * @param[in] str2 The second string
- * @param[in] location The TEST_LOCATION macro should be used here
- */
-template<>
-inline void DALI_TEST_EQUALS( const Integration::TextArray& str1, const Integration::TextArray& str2, const char* location)
-{
- if( !std::equal( str1.Begin(), str1.End(), str2.Begin() ) )
- {
- fprintf(stderr, "%s, checking '", location);
-
- for( unsigned int i = 0; i < str1.Count(); ++i )
- {
- fprintf(stderr, "%c", str1[i]);
- }
-
- fprintf(stderr, "' == '");
-
- for( unsigned int i = 0; i < str2.Count(); ++i )
- {
- fprintf(stderr, "%c", str2[i]);
- }
-
- fprintf(stderr, "'\n");
-
- tet_result(TET_FAIL);
- }
- else
- {
- tet_result(TET_PASS);
- }
-}
-
-/**
* Test whether one unsigned integer value is greater than another.
* Test succeeds if value1 > value2
* @param[in] value1 The first value
diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.cpp
index 779fd2a..c64af4d 100644
--- a/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.cpp
+++ b/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.cpp
@@ -87,16 +87,7 @@ void TestPlatformAbstraction::GetClosestImageSize( Integration::ResourcePointer
void TestPlatformAbstraction::LoadResource(const Integration::ResourceRequest& request)
{
std::ostringstream out;
- out << "Type:";
- if( request.GetType()->id == Integration::ResourceText )
- {
- out << "Text";
- }
- else
- {
- out << request.GetType()->id;
- }
- out << ", Path: " << request.GetPath() << std::endl ;
+ out << "Type:" << request.GetType()->id << ", Path: " << request.GetPath() << std::endl ;
mTrace.PushCall("LoadResource", out.str());
if(mRequest != NULL)
@@ -170,148 +161,6 @@ bool TestPlatformAbstraction::IsLoading()
}
/**
- * @copydoc PlatformAbstraction::GetDefaultFontFamily()
- */
-const std::string& TestPlatformAbstraction::GetDefaultFontFamily() const
-{
- mTrace.PushCall("GetDefaultFontFamily", "");
- return mGetDefaultFontFamilyResult;
-}
-
-/**
- * @copydoc PlatformAbstraction::GetDefaultFontSize()
- */
-float TestPlatformAbstraction::GetDefaultFontSize() const
-{
- mTrace.PushCall("GetDefaultFontSize", "");
- return mGetDefaultFontSizeResult;
-}
-
-PixelSize TestPlatformAbstraction::GetFontLineHeightFromCapsHeight(const std::string& fontFamily, const std::string& fontStyle, CapsHeight capsHeight) const
-{
- mTrace.PushCall("GetFontLineHeightFromCapsHeight", "");
- // LineHeight will be bigger than CapsHeight, so return capsHeight + 1
- return PixelSize(capsHeight + 1);
-}
-
-/**
- * @copydoc PlatformAbstraction::GetGlyphData()
- */
-
-Integration::GlyphSet* TestPlatformAbstraction::GetGlyphData ( const Integration::TextResourceType& textRequest,
- const std::string& fontFamily,
- bool getBitmap) const
-{
- if( getBitmap )
- {
- mTrace.PushCall("GetGlyphData", "getBitmap:true");
- }
- else
- {
- mTrace.PushCall("GetGlyphData", "getBitmap:false");
- }
-
- // It creates fake metrics for the received characters.
-
- Integration::GlyphSet* set = new Dali::Integration::GlyphSet();
- Integration::BitmapPtr bitmapData;
-
- std::set characters;
-
- for( Integration::TextResourceType::CharacterList::const_iterator it = textRequest.mCharacterList.begin(), endIt = textRequest.mCharacterList.end(); it != endIt; ++it )
- {
- if( characters.find( it->character ) == characters.end() )
- {
- characters.insert( it->character );
- Integration::GlyphMetrics character = {it->character, Integration::GlyphMetrics::LOW_QUALITY, 10.0f, 10.0f, 9.0f, 1.0f, 10.0f, it->xPosition, it->yPosition };
-
- if( getBitmap )
- {
- bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD);
- bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64);
- PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
- memset( pixelBuffer, it->character, 64*64 );
- }
-
- set->AddCharacter(bitmapData, character);
- }
- }
-
- set->mLineHeight = 10.0f;
- set->mAscender = 9.0f;
- set->mUnitsPerEM = 2048.0f/64.0f;
- set->SetAtlasResourceId( textRequest.mTextureAtlasId );
- set->mFontHash = textRequest.mFontHash;
-
- return set;
-}
-
-/**
- * @copydoc PlatformAbstraction::GetCachedGlyphData()
- */
-
-Integration::GlyphSet* TestPlatformAbstraction::GetCachedGlyphData( const Integration::TextResourceType& textRequest,
- const std::string& fontFamily ) const
-{
- mTrace.PushCall("GetCachedGlyphData", "");
-
- // It creates fake metrics and bitmap for received numeric characters '0' through '9'.
- Integration::GlyphSet* set = new Dali::Integration::GlyphSet();
- Integration::BitmapPtr bitmapData;
-
- std::set characters;
-
- for( Integration::TextResourceType::CharacterList::const_iterator it = textRequest.mCharacterList.begin(), endIt = textRequest.mCharacterList.end(); it != endIt; ++it )
- {
- if( it->character >= '0' && it->character <= '9' && characters.find( it->character ) == characters.end() )
- {
- characters.insert( it->character );
- Integration::GlyphMetrics character = {it->character, Integration::GlyphMetrics::HIGH_QUALITY, 10.0f, 10.0f, 9.0f, 1.0f, 10.0f, it->xPosition, it->yPosition };
-
- bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD);
- bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64);
- PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
- memset( pixelBuffer, it->character, 64*64 );
- set->AddCharacter(bitmapData, character);
- }
- }
-
- set->mLineHeight = 10.0f;
- set->mAscender = 9.0f;
- set->mUnitsPerEM = 2048.0f/64.0f;
- set->SetAtlasResourceId( textRequest.mTextureAtlasId );
- set->mFontHash = textRequest.mFontHash;
-
- return set;
-}
-
-
-/**
- * @copydoc PlatformAbstraction::GetGlobalMetrics()
- */
-void TestPlatformAbstraction::GetGlobalMetrics( const std::string& fontFamily,
- const std::string& fontStyle,
- Integration::GlobalMetrics& globalMetrics ) const
-{
- globalMetrics.lineHeight = 10.0f;
- globalMetrics.ascender = 9.0f;
- globalMetrics.unitsPerEM = 2048.0f/64.0f;
- globalMetrics.underlineThickness = 2.f;
- globalMetrics.underlinePosition = 1.f;
-}
-
-/**
- * @copydoc PlatformAbstraction::GetFontPath()
- */
-std::string TestPlatformAbstraction::GetFontPath(const std::string& family, bool bold, bool italic) const
-{
- mTrace.PushCall("GetFontPath", "");
- return mGetFontPathResult;
-
- // Do nothing with arguments
-}
-
-/**
* @copydoc PlatformAbstraction::SetDpi()
*/
void TestPlatformAbstraction::SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical)
@@ -320,42 +169,6 @@ void TestPlatformAbstraction::SetDpi (unsigned int dpiHorizontal, unsigned int d
}
/**
- * @copydoc PlatformAbstraction::GetFontFamilyForChars()
- */
-const std::string& TestPlatformAbstraction::GetFontFamilyForChars(const Integration::TextArray& charsRequested) const
-{
- mTrace.PushCall("GetFontFamilyForChars", "");
- return mGetDefaultFontFamilyResult;
-}
-
-/**
- * @copydoc PlatformAbstraction::AllGlyphsSupported()
- */
-bool TestPlatformAbstraction::AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const Integration::TextArray& text) const
-{
- mTrace.PushCall("AllGlyphsSupported", "");
- return true;
-}
-
-/**
- * @copydoc PlatformAbstraction::ValidateFontFamilyName()
- */
-bool TestPlatformAbstraction::ValidateFontFamilyName(const std::string& fontFamily, const std::string& fontStyle, bool& isDefaultSystemFont, std::string& closestMatch, std::string& closestStyleMatch) const
-{
- mTrace.PushCall("ValidateFontFamilyName", "");
- return true;
-}
-
-/**
- * @copydoc PlatformAbstraction::GetFontList()
- */
-void TestPlatformAbstraction::GetFontList( PlatformAbstraction::FontListMode mode, std::vector& fonstList ) const
-{
- mFontListMode = mode;
- mTrace.PushCall("ValidateGetFontList", "");
-}
-
-/**
* @copydoc PlatformAbstraction::LoadFile()
*/
bool TestPlatformAbstraction::LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const
@@ -383,102 +196,21 @@ void TestPlatformAbstraction::JoinLoaderThreads()
mTrace.PushCall("JoinLoaderThreads", "");
}
-void TestPlatformAbstraction::UpdateDefaultsFromDevice()
-{
- mTrace.PushCall("UpdateDefaultsFromDevice", "");
- mGetDefaultFontFamilyResult+=1.0f;
-}
-
Integration::DynamicsFactory* TestPlatformAbstraction::GetDynamicsFactory()
{
mTrace.PushCall("GetDynamicsFactory", "");
return NULL;
}
-bool TestPlatformAbstraction::ReadGlobalMetricsFromCache( const std::string& fontFamily,
- const std::string& fontStyle,
- Integration::GlobalMetrics& globalMetrics )
-{
- mTrace.PushCall("ReadGlobalMetricsFromCacheFile", "");
- globalMetrics = mReadGlobalMetrics; // Want to copy contents...
- return mReadGlobalMetricsResult; // Default false (will be set to true on subsequent write)
-}
-
-void TestPlatformAbstraction::WriteGlobalMetricsToCache( const std::string& fontFamily,
- const std::string& fontStyle,
- const Integration::GlobalMetrics& globalMetrics )
-{
- // Copy so next read uses written values. TODO: Could add method
- // to turn this behaviour off for more extensive testing.
- mReadGlobalMetrics = globalMetrics;
- mReadGlobalMetricsResult = true;
-
- mTrace.PushCall("WriteGlobalMetricsToCacheFile", "");
-}
-
-bool TestPlatformAbstraction::ReadMetricsFromCache( const std::string& fontFamily,
- const std::string& fontStyle,
- std::vector& glyphMetricsContainer )
-{
- mTrace.PushCall("ReadMetricsFromCacheFile", "");
- glyphMetricsContainer = mReadMetrics;
- return mReadMetricsResult; // Default false (will be set to true on subsequent write)
-}
-
-void TestPlatformAbstraction::WriteMetricsToCache( const std::string& fontFamily,
- const std::string& fontStyle,
- const Integration::GlyphSet& glyphSet )
-{
- // Copy so next read uses written values. TODO: Could add method
- // to turn this behaviour off for more extensive testing.
- const Integration::GlyphSet::CharacterList& charList = glyphSet.GetCharacterList();
- mReadMetrics.clear();
- for(std::size_t i=0, end=charList.size(); i& fileNames )
-{
- fileNames.push_back( std::string( "u1f004.png" ) );
- fileNames.push_back( std::string( "u1f0cf.png" ) );
- fileNames.push_back( std::string( "u1f170.png" ) );
- fileNames.push_back( std::string( "u1f601.png" ) );
-}
-
-
-Integration::BitmapPtr TestPlatformAbstraction::GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const
-{
- Integration::BitmapPtr image = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
- image->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 1, 1 );
-
- mTrace.PushCall("GetGlyphImage", "");
-
- return image;
-}
-
-
/** Call this every test */
void TestPlatformAbstraction::Initialize()
{
mTrace.Reset();
mTrace.Enable(true);
memset(&mResources, 0, sizeof(Resources));
- memset(&mReadGlobalMetrics, 0, sizeof(Integration::GlobalMetrics));
mSeconds=0;
mMicroSeconds=0;
mIsLoadingResult=false;
- mGetDefaultFontFamilyResult = "HelveticaNeue";
- mGetDefaultFontSizeResult=12.0f;
- mGetFontPathResult="helvetica-12";
- mReadMetricsResult=false;
- mReadGlobalMetricsResult=false;
if(mRequest)
{
@@ -487,7 +219,6 @@ void TestPlatformAbstraction::Initialize()
}
}
-
bool TestPlatformAbstraction::WasCalled(TestFuncEnum func)
{
switch(func)
@@ -502,24 +233,9 @@ bool TestPlatformAbstraction::WasCalled(TestFuncEnum func)
case CancelLoadFunc: return mTrace.FindMethod("CancelLoad");
case GetResourcesFunc: return mTrace.FindMethod("GetResources");
case IsLoadingFunc: return mTrace.FindMethod("IsLoading");
- case GetDefaultFontFamilyFunc: return mTrace.FindMethod("GetDefaultFontFamily");
- case GetDefaultFontSizeFunc: return mTrace.FindMethod("GetDefaultFontSize");
- case GetFontLineHeightFromCapsHeightFunc: return mTrace.FindMethod("GetFontLineHeightFromCapsHeight");
- case GetGlyphDataFunc: return mTrace.FindMethod("GetGlyphData");
- case GetCachedGlyphDataFunc: return mTrace.FindMethod("GetCachedGlyphData");
- case GetFontPathFunc: return mTrace.FindMethod("GetFontPath");
case SetDpiFunc: return mTrace.FindMethod("SetDpi");
case JoinLoaderThreadsFunc: return mTrace.FindMethod("JoinLoaderThreads");
- case GetFontFamilyForCharsFunc: return mTrace.FindMethod("GetFontFamilyForChars");
- case AllGlyphsSupportedFunc: return mTrace.FindMethod("AllGlyphsSupported");
- case ValidateFontFamilyNameFunc: return mTrace.FindMethod("ValidateFontFamilyName");
- case UpdateDefaultsFromDeviceFunc: return mTrace.FindMethod("UpdateDefaultsFromDevice");
case GetDynamicsFactoryFunc: return mTrace.FindMethod("GetDynamicsFactory");
- case ValidateGetFontListFunc: return mTrace.FindMethod("ValidateGetFontList");
- case ReadGlobalMetricsFromCacheFileFunc: return mTrace.FindMethod("ReadGlobalMetricsFromCacheFile");
- case WriteGlobalMetricsToCacheFileFunc: return mTrace.FindMethod("WriteGlobalMetricsToCacheFile");
- case ReadMetricsFromCacheFileFunc: return mTrace.FindMethod("ReadMetricsFromCacheFile");
- case WriteMetricsToCacheFileFunc: return mTrace.FindMethod("WriteMetricsToCacheFile");
}
return false;
}
@@ -544,21 +260,6 @@ void TestPlatformAbstraction::SetIsLoadingResult(bool result)
mIsLoadingResult = result;
}
-void TestPlatformAbstraction::SetGetDefaultFontFamilyResult(std::string result)
-{
- mGetDefaultFontFamilyResult = result;
-}
-
-void TestPlatformAbstraction::SetGetDefaultFontSizeResult(float result)
-{
- mGetDefaultFontSizeResult = result;
-}
-
-void TestPlatformAbstraction::SetGetFontPathResult(std::string& result)
-{
- mGetFontPathResult = result;
-}
-
void TestPlatformAbstraction::ClearReadyResources()
{
memset(&mResources, 0, sizeof(Resources));
@@ -628,22 +329,4 @@ void TestPlatformAbstraction::SetSaveFileResult( bool result )
mSaveFileResult = result;
}
-Integration::PlatformAbstraction::FontListMode TestPlatformAbstraction::GetLastFontListMode( )
-{
- return mFontListMode;
-}
-
-void TestPlatformAbstraction::SetReadGlobalMetricsResult( bool success, Integration::GlobalMetrics& globalMetrics )
-{
- mReadGlobalMetricsResult = success;
- mReadGlobalMetrics = globalMetrics;
-}
-
-void TestPlatformAbstraction::SetReadMetricsResult( bool success, std::vector& glyphMetricsContainer )
-{
- mReadMetricsResult = success;
- mReadMetrics = glyphMetricsContainer; // copy
-}
-
-
} // namespace Dali
diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.h b/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.h
index f3f22ac..d7f1603 100644
--- a/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.h
+++ b/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.h
@@ -26,7 +26,6 @@
#include
#include
-#include
#include "test-trace-call-stack.h"
@@ -137,72 +136,11 @@ public:
virtual bool IsLoading();
/**
- * @copydoc PlatformAbstraction::GetDefaultFontFamily()
- */
- virtual const std::string& GetDefaultFontFamily() const;
-
- /**
- * @copydoc PlatformAbstraction::GetDefaultFontSize()
- */
- virtual float GetDefaultFontSize() const;
-
- /**
- * @copydoc PlatformAbstraction::GetFontLineHeightFromCapsHeight()
- */
- virtual Dali::PixelSize GetFontLineHeightFromCapsHeight(const std::string& fontFamily, const std::string& fontStyle, CapsHeight capsHeight) const;
-
- /**
- * @copydoc PlatformAbstraction::GetGlyphData()
- */
- virtual Integration::GlyphSet* GetGlyphData ( const Integration::TextResourceType& textRequest,
- const std::string& fontFamily,
- bool getBitmap) const;
-
- /**
- * @copydoc PlatformAbstraction::GetCachedGlyphData()
- */
- virtual Integration::GlyphSet* GetCachedGlyphData( const Integration::TextResourceType& textRequest,
- const std::string& fontFamily ) const;
-
-
- /**
- * @copydoc PlatformAbstraction::GetGlobalMetrics()
- */
- virtual void GetGlobalMetrics( const std::string& fontFamily,
- const std::string& fontStyle,
- Integration::GlobalMetrics& globalMetrics ) const;
-
- /**
- * @copydoc PlatformAbstraction::GetFontPath()
- */
- virtual std::string GetFontPath(const std::string& family, bool bold, bool italic) const;
-
- /**
* @copydoc PlatformAbstraction::SetDpi()
*/
virtual void SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical);
/**
- * @copydoc PlatformAbstraction::GetFontFamilyForChars()
- */
- virtual const std::string& GetFontFamilyForChars(const Integration::TextArray& charsRequested) const;
-
- /**
- * @copydoc PlatformAbstraction::AllGlyphsSupported()
- */
- virtual bool AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const Integration::TextArray& text) const;
-
- /**
- * @copydoc PlatformAbstraction::ValidateFontFamilyName()
- */
- virtual bool ValidateFontFamilyName(const std::string& fontFamily, const std::string& fontStyle, bool& isDefaultSystemFont, std::string& closestMatch, std::string& closestStyleMatch) const;
-
- /**
- * @copydoc PlatformAbstraction::GetFontList()
- */
- virtual void GetFontList( PlatformAbstraction::FontListMode mode, std::vector& fontList ) const;
-
- /**
* @copydoc PlatformAbstraction::LoadFile()
*/
virtual bool LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
@@ -214,31 +152,8 @@ public:
virtual void JoinLoaderThreads();
- virtual void UpdateDefaultsFromDevice();
-
virtual Integration::DynamicsFactory* GetDynamicsFactory();
- virtual bool ReadGlobalMetricsFromCache( const std::string& fontFamily,
- const std::string& fontStyle,
- Integration::GlobalMetrics& globalMetrics );
-
- virtual void WriteGlobalMetricsToCache( const std::string& fontFamily,
- const std::string& fontStyle,
- const Integration::GlobalMetrics& globalMetrics );
-
- virtual bool ReadMetricsFromCache( const std::string& fontFamily,
- const std::string& fontStyle,
- std::vector& glyphMetricsContainer );
- virtual void WriteMetricsToCache( const std::string& fontFamily,
- const std::string& fontStyle,
- const Integration::GlyphSet& glyphSet );
-
-
- virtual void GetFileNamesFromDirectory( const std::string& directoryName,
- std::vector& fileNames );
-
- virtual Integration::BitmapPtr GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const;
-
public: // TEST FUNCTIONS
// Enumeration of Platform Abstraction methods
@@ -254,24 +169,9 @@ public: // TEST FUNCTIONS
CancelLoadFunc,
GetResourcesFunc,
IsLoadingFunc,
- GetDefaultFontFamilyFunc,
- GetDefaultFontSizeFunc,
- GetFontLineHeightFromCapsHeightFunc,
- GetGlyphDataFunc,
- GetCachedGlyphDataFunc,
SetDpiFunc,
- GetFontPathFunc,
JoinLoaderThreadsFunc,
- GetFontFamilyForCharsFunc,
- AllGlyphsSupportedFunc,
- ValidateFontFamilyNameFunc,
- UpdateDefaultsFromDeviceFunc,
GetDynamicsFactoryFunc,
- ValidateGetFontListFunc,
- ReadGlobalMetricsFromCacheFileFunc,
- WriteGlobalMetricsToCacheFileFunc,
- ReadMetricsFromCacheFileFunc,
- WriteMetricsToCacheFileFunc,
} TestFuncEnum;
/** Call this every test */
@@ -289,12 +189,6 @@ public: // TEST FUNCTIONS
void SetIsLoadingResult(bool result);
- void SetGetDefaultFontFamilyResult(std::string result);
-
- void SetGetDefaultFontSizeResult(float result);
-
- void SetGetFontPathResult(std::string& result);
-
void ClearReadyResources();
void SetResourceLoaded(Integration::ResourceId loadedId,
@@ -320,31 +214,18 @@ public: // TEST FUNCTIONS
void SetSaveFileResult( bool result );
- PlatformAbstraction::FontListMode GetLastFontListMode( );
-
- void SetReadGlobalMetricsResult( bool success, Integration::GlobalMetrics& globalMetrics );
-
- void SetReadMetricsResult( bool success, std::vector& glyphMetricsContainer );
private:
mutable TraceCallStack mTrace;
size_t mSeconds;
size_t mMicroSeconds;
bool mIsLoadingResult;
- std::string mGetDefaultFontFamilyResult;
- float mGetDefaultFontSizeResult;
- std::string mGetFontPathResult;
Resources mResources;
Integration::ResourceRequest* mRequest;
Vector2 mSize;
Vector2 mClosestSize;
- bool mReadGlobalMetricsResult;
- bool mReadMetricsResult;
- Integration::GlobalMetrics mReadGlobalMetrics;
- std::vector mReadMetrics;
LoadFileResult mLoadFileResult;
bool mSaveFileResult;
- mutable FontListMode mFontListMode;
};
} // Dali
diff --git a/automated-tests/src/dali/utc-Dali-Character.cpp b/automated-tests/src/dali/utc-Dali-Character.cpp
deleted file mode 100644
index e7b9523..0000000
--- a/automated-tests/src/dali/utc-Dali-Character.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include
-
-#include
-#include
-#include
-
-using namespace Dali;
-
-void utc_dali_character_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_character_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-int UtcDaliCharacterCopyConstructor(void)
-{
- tet_infoline("UtcDaliCharacterCopyConstructor ");
- TestApplication application;
-
- Text text( std::string("12") );
-
- Character c1 = text[0];
- Character c2 = text[1];
-
- Character c3( c1 );
- Character c4 = c2;
-
- DALI_TEST_CHECK( (c1==c3) && (c2==c4) );
- END_TEST;
-}
-
-int UtcDaliCharacterComparissonOperators(void)
-{
- tet_infoline("UtcDaliCharacterComparissonOperators ");
- TestApplication application;
-
- Text text( std::string("12") );
-
- Character c1 = text[0];
- Character c2 = text[1];
-
- Character c3( c1 );
- Character c4 = c2;
-
- DALI_TEST_CHECK( (c1==c3) && (c2==c4) && (c1!=c2) && (c1!=c4) );
- END_TEST;
-}
-
-int UtcDaliCharacterAssignmentOperator(void)
-{
- tet_infoline("UtcDaliCharacterAssignmentOperator ");
- TestApplication application;
-
- Text text( std::string("12") );
- Character c1 = text[0];
- Character c2 = text[1];
- c1 = c2; //assign
- DALI_TEST_CHECK( c1 == c1);
-
- // this should do nothing
- c1 = c1;
- DALI_TEST_CHECK( c1 == c2);
-
- END_TEST;
-}
-
-int UtcDaliCharacterIsLeftToRight(void)
-{
- tet_infoline("UtcDaliCharacterIsLeftToRight ");
- TestApplication application;
-
- Text text( std::string("12××") );
-
- Character c1 = text[0];
- Character c2 = text[1];
- Character c3 = text[2];
- Character c4 = text[3];
-
- DALI_TEST_CHECK( c1.GetCharacterDirection() != Character::RightToLeft &&
- c2.GetCharacterDirection() != Character::RightToLeft &&
- c3.GetCharacterDirection() == Character::RightToLeft &&
- c4.GetCharacterDirection() == Character::RightToLeft );
- END_TEST;
-}
-
-int UtcDaliGetCharacterDirection(void)
-{
- tet_infoline("UtcDaliGetCharacterDirection ");
- TestApplication application;
-
- Text text( std::string("A×× ") );
-
- Character c1 = text[0];
- Character c2 = text[1];
- Character c3 = text[2];
- Character c4 = text[3];
-
- DALI_TEST_EQUALS( c1.GetCharacterDirection(), Character::LeftToRight, TEST_LOCATION );
- DALI_TEST_EQUALS( c2.GetCharacterDirection(), Character::RightToLeft, TEST_LOCATION );
- DALI_TEST_EQUALS( c3.GetCharacterDirection(), Character::RightToLeft, TEST_LOCATION );
- DALI_TEST_EQUALS( c4.GetCharacterDirection(), Character::Neutral, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliGetScript(void)
-{
- tet_infoline("UtcDaliGetScript ");
- TestApplication application;
-
- Text text( std::string("aá´âà¤à¦
à¨
àª
à¬
à®
à°
à²
à´
à¶
ض") );
-
- Character c0 = text[0];
- Character c1 = text[1];
- Character c2 = text[2];
-
- DALI_TEST_EQUALS( c0.GetScript(), Character::LATIN, TEST_LOCATION );
- DALI_TEST_EQUALS( c1.GetScript(), Character::LATIN, TEST_LOCATION );
- DALI_TEST_EQUALS( c2.GetScript(), Character::LATIN, TEST_LOCATION );
-
-
- Character c3 = text[3];
- DALI_TEST_EQUALS( c3.GetScript(), Character::DEVANAGARI, TEST_LOCATION );
-
- Character c4 = text[4];
- DALI_TEST_EQUALS( c4.GetScript(), Character::BENGALI, TEST_LOCATION );
-
- Character c5 = text[5];
- DALI_TEST_EQUALS( c5.GetScript(), Character::GURMUKHI, TEST_LOCATION );
-
- Character c6 = text[6];
- DALI_TEST_EQUALS( c6.GetScript(), Character::GUJARATI, TEST_LOCATION );
-
- Character c7 = text[7];
- DALI_TEST_EQUALS( c7.GetScript(), Character::ORIYA, TEST_LOCATION );
-
- Character c8 = text[8];
- DALI_TEST_EQUALS( c8.GetScript(), Character::TAMIL, TEST_LOCATION );
-
- Character c9 = text[9];
- DALI_TEST_EQUALS( c9.GetScript(), Character::TELUGU, TEST_LOCATION );
-
- Character c10 = text[10];
- DALI_TEST_EQUALS( c10.GetScript(), Character::KANNADA, TEST_LOCATION );
-
- Character c11 = text[11];
- DALI_TEST_EQUALS( c11.GetScript(), Character::MALAYALAM, TEST_LOCATION );
-
- Character c12 = text[12];
- DALI_TEST_EQUALS( c12.GetScript(), Character::SINHALA, TEST_LOCATION );
-
- Character c13 = text[13];
- DALI_TEST_EQUALS( c13.GetScript(), Character::ARABIC, TEST_LOCATION );
-
- // TODO : add more characters to cover all ranges.
- END_TEST;
-}
-
-int UtcDaliCharacterIsWhiteSpace(void)
-{
- tet_infoline("UtcDaliCharacterIsWhiteSpace ");
- TestApplication application;
-
- Text text( std::string("ab c\n\tdef") );
-
- DALI_TEST_CHECK(!text[0].IsWhiteSpace()); // 'a'
- DALI_TEST_CHECK(!text[1].IsWhiteSpace()); // 'b'
- DALI_TEST_CHECK(text[2].IsWhiteSpace()); // ' '
- DALI_TEST_CHECK(!text[3].IsWhiteSpace()); // 'c'
- DALI_TEST_CHECK(text[4].IsWhiteSpace()); // '\n'
- DALI_TEST_CHECK(text[5].IsWhiteSpace()); // '\t'
- DALI_TEST_CHECK(!text[6].IsWhiteSpace()); // 'd'
- DALI_TEST_CHECK(!text[7].IsWhiteSpace()); // 'e'
- DALI_TEST_CHECK(!text[8].IsWhiteSpace()); // 'f'
- END_TEST;
-}
-
-int UtcDaliCharacterIsNewLine(void)
-{
- tet_infoline("UtcDaliCharacterIsWhiteSpace ");
- TestApplication application;
-
- Text text( std::string("ab c\n\tdef") );
-
- DALI_TEST_CHECK(!text[0].IsNewLine()); // 'a'
- DALI_TEST_CHECK(!text[1].IsNewLine()); // 'b'
- DALI_TEST_CHECK(!text[2].IsNewLine()); // ' '
- DALI_TEST_CHECK(!text[3].IsNewLine()); // 'c'
- DALI_TEST_CHECK( text[4].IsNewLine()); // '\n'
- DALI_TEST_CHECK(!text[5].IsNewLine()); // '\t'
- DALI_TEST_CHECK(!text[6].IsNewLine()); // 'd'
- DALI_TEST_CHECK(!text[7].IsNewLine()); // 'e'
- DALI_TEST_CHECK(!text[8].IsNewLine()); // 'f'
- END_TEST;
-}
diff --git a/automated-tests/src/dali/utc-Dali-Font.cpp b/automated-tests/src/dali/utc-Dali-Font.cpp
deleted file mode 100644
index 1d1ea62..0000000
--- a/automated-tests/src/dali/utc-Dali-Font.cpp
+++ /dev/null
@@ -1,545 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include
-
-#include
-#include
-#include
-#include
-
-using namespace Dali;
-
-void utc_dali_font_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_font_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-namespace
-{
-
-const std::string FAMILY_NAME = "Arial";
-const std::string STYLE = "Bold";
-const unsigned int PIXEL_SIZE = 20;
-const unsigned int POINT_SIZE = 11.f;
-
-static Font CreateFont( PointSize size )
-{
- // Don't use a font which could be cached otherwise cached values will be used making measure text test to fail.
- return Font::New(FontParameters("TET-FreeSans", "Book", size));
-}
-
-static Font CreateFont( PixelSize size )
-{
- // Don't use a font which could be cached otherwise cached values will be used making measure text test to fail.
- return Font::New(FontParameters("TET-FreeSans", "Book", size));
-}
-
-static Font CreateFont( CapsHeight size )
-{
- // Don't use a font which could be cached otherwise cached values will be used making measure text test to fail.
- return Font::New(FontParameters("TET-FreeSans", "Book", size));
-}
-
-} //anon namespace
-
-int UtcDaliFontNew01(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::New() - with specific font family and pixel size");
-
- Font font; // invoke default constructor (creates an empty handle)
- font = CreateFont(PixelSize(25.0f)); // This does not call platform abstraction until some text is displayed or measured
-
- DALI_TEST_CHECK(font);
-
- tet_infoline("Testing Dali::Font::New() - with default font name and pixel size");
-
- Font font2 = Font::New(FontParameters("", "", PixelSize(0.0f)));
-
- DALI_TEST_CHECK(font2);
-
- Font* ptrFont = new Font;
- *ptrFont = Font::New(FontParameters("", "", PixelSize(0.0f)));
- delete ptrFont;
- END_TEST;
-}
-
-int UtcDaliFontNew02(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::New() - with specific font family and point size");
-
- Font font = CreateFont(PointSize(8));
-
- DALI_TEST_CHECK(font);
-
- tet_infoline("Testing Dali::Font::New() - with default font family and point size");
-
- Font font2;
- font2 = Font::New(FontParameters("", "", PointSize(0)));
-
- DALI_TEST_CHECK(font2);
- END_TEST;
-}
-
-int UtcDaliFontNew03(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::New() - with specific font family and caps-height");
-
- Font font = CreateFont(CapsHeight(8));
-
- DALI_TEST_CHECK(font);
- DALI_TEST_CHECK(font.GetPixelSize() > 8.0f); // Pixel size should be bigger than requested CapsHeight
-
- tet_infoline("Testing Dali::Font::New() - with default font family and point size");
-
- Font font2 = Font::New(FontParameters("", "", CapsHeight(0)));
-
- DALI_TEST_CHECK(font2);
- END_TEST;
-}
-
-int UtcDaliFontNew04(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::New() - with wrong font family or font style");
-
- Font font = Font::New(FontParameters("gfagag", "fgafgafga",PointSize(0)));
-
- DALI_TEST_CHECK(font);
- END_TEST;
-}
-
-int UtcDaliFontNew05(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::New() - with pixel size and weight");
-
- PixelSize pixelSize(PIXEL_SIZE);
- FontParameters fontParams(FAMILY_NAME, "", pixelSize);
- Font font = Font::New( fontParams );
-
- DALI_TEST_CHECK( font );
- DALI_TEST_CHECK( font.GetName() == FAMILY_NAME );
- DALI_TEST_CHECK( font.GetStyle().empty() );
- END_TEST;
-}
-
-int UtcDaliFontNew06(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::New() - with caps height");
-
- CapsHeight capsHeight(10.f);
- FontParameters fontParams(FAMILY_NAME, "", capsHeight);
- Font font = Font::New( fontParams );
-
- DALI_TEST_CHECK( font );
- DALI_TEST_CHECK( font.GetName() == FAMILY_NAME );
- DALI_TEST_CHECK( font.GetStyle().empty() );
- END_TEST;
-}
-
-
-int UtcDaliFontDownCast(void)
-{
- TestApplication application;
- tet_infoline("Testing Dali::Font::DownCast()");
-
- Font font = CreateFont(PixelSize(25.0f));
-
- BaseHandle object(font);
-
- Font font2 = Font::DownCast(object);
- DALI_TEST_CHECK(font2);
-
- Font font3 = DownCast< Font >(object);
- DALI_TEST_CHECK(font3);
-
- BaseHandle unInitializedObject;
- Font font4 = Font::DownCast(unInitializedObject);
- DALI_TEST_CHECK(!font4);
-
- Font font5 = DownCast< Font >(unInitializedObject);
- DALI_TEST_CHECK(!font5);
- END_TEST;
-}
-
-int UtcDaliFontGetPixelSize(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::GetPixelSize()");
-
- Font font = CreateFont(PixelSize(32));
-
- DALI_TEST_CHECK(32 == font.GetPixelSize());
- END_TEST;
-}
-
-int UtcDaliFontGetPointSize(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::GetPointSize)");
-
- Font font = CreateFont(PointSize(8.0f));
-
- DALI_TEST_EQUALS(8.f, font.GetPointSize(), Math::MACHINE_EPSILON_1000, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliFontPointsToPixels(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::PointsToPixels)");
-
- unsigned int points= Font::PointsToPixels( 12.0f );
-
- DALI_TEST_CHECK( points == 36 );
- END_TEST;
-}
-
-int UtcFontMeasureTextWidth(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::MeasureTextWidth()");
-
- TraceCallStack& trace = application.GetPlatform().GetTrace();
- trace.Enable(true);
-
- Font font = CreateFont(PointSize(8));
-
- float width = font.MeasureTextWidth("test me", 24.0f);
-
- // No cache
-
- DALI_TEST_CHECK(trace.FindMethod("ReadMetricsFromCacheFile"));
- DALI_TEST_CHECK(trace.FindMethod("WriteMetricsToCacheFile"));
- DALI_TEST_CHECK(trace.FindMethod("GetGlyphData"));
- trace.Reset();
-
- DALI_TEST_EQUALS(width, 168.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
- width = font.MeasureTextWidth(Text(std::string("test me")), 24.0f);
-
- // Should now be cached in memory
- DALI_TEST_CHECK( ! trace.FindMethod("ReadMetricsFromCacheFile"));
- DALI_TEST_CHECK( ! trace.FindMethod("WriteMetricsToCacheFile"));
- DALI_TEST_CHECK( ! trace.FindMethod("GetGlyphData"));
-
- DALI_TEST_EQUALS(width, 168.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
-
- Text text = Text(std::string("t"))[0];
- Character c = text[0];
- width = font.MeasureTextWidth(c, 24.0f);
- DALI_TEST_EQUALS(width, 24.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
-
- END_TEST;
-}
-
-int UtcFontMeasureTextHeight(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::MeasureTextHeight()");
-
- TraceCallStack& trace = application.GetPlatform().GetTrace();
- trace.Enable(true);
-
- Font font = CreateFont(PointSize(8));
-
- float height = font.MeasureTextHeight("test me", 48.0f);
-
- DALI_TEST_CHECK(trace.FindMethod("ReadMetricsFromCacheFile"));
- DALI_TEST_CHECK(trace.FindMethod("WriteMetricsToCacheFile"));
- DALI_TEST_CHECK(trace.FindMethod("GetGlyphData"));
- trace.Reset();
-
- DALI_TEST_EQUALS(height, 6.8571f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
-
- height = font.MeasureTextHeight(Text(std::string("test me")), 48.0f);
-
- DALI_TEST_CHECK( ! trace.FindMethod("ReadMetricsFromCacheFile"));
- DALI_TEST_CHECK( ! trace.FindMethod("WriteMetricsToCacheFile"));
- DALI_TEST_CHECK( ! trace.FindMethod("GetGlyphData"));
-
- DALI_TEST_EQUALS(height, 6.8571f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
-
- Text text = Text(std::string("t"))[0];
- Character c = text[0];
- height = font.MeasureTextHeight(c, 24.0f);
- DALI_TEST_EQUALS(height, 24.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
-
- END_TEST;
-}
-
-int UtcFontMeasureText(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::MeasureText()");
-
- TraceCallStack& trace = application.GetPlatform().GetTrace();
- trace.Enable(true);
-
- Font font = CreateFont(PointSize(8));
-
- Vector3 size = font.MeasureText("test me");
-
- DALI_TEST_CHECK(trace.FindMethod("ReadMetricsFromCacheFile"));
- DALI_TEST_CHECK(trace.FindMethod("WriteMetricsToCacheFile"));
- DALI_TEST_CHECK(trace.FindMethod("GetGlyphData"));
- trace.Reset();
-
- DALI_TEST_EQUALS(size.width, 53.1076f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
- DALI_TEST_EQUALS(size.height, 7.5868f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
-
- size = font.MeasureText(Text(std::string("test me")));
-
- DALI_TEST_CHECK( ! trace.FindMethod("ReadMetricsFromCacheFile"));
- DALI_TEST_CHECK( ! trace.FindMethod("WriteMetricsToCacheFile"));
- DALI_TEST_CHECK( ! trace.FindMethod("GetGlyphData"));
-
- DALI_TEST_EQUALS(size.width, 53.1076f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
- DALI_TEST_EQUALS(size.height, 7.5868f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
-
-
- Character c = Text(std::string("t"))[0];
- size = font.MeasureText(c);
-
- // character size is square
- DALI_TEST_EQUALS(size.width, 7.5868f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
- DALI_TEST_EQUALS(size.height, 7.5868f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
-
- END_TEST;
-}
-
-int UtcFontGetFamilyForText(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::GetFamilyForText()");
-
- std::string latinFont = Font::GetFamilyForText("Hello world");
- DALI_TEST_CHECK( latinFont.size() != 0 );
-
- latinFont = Font::GetFamilyForText( Text(std::string("Hello world")) );
- DALI_TEST_CHECK( latinFont.size() != 0 );
-
- std::string asianFont = Font::GetFamilyForText("ç¹é«ä¸æ");
- DALI_TEST_CHECK( asianFont.size() != 0 );
-
- asianFont = Font::GetFamilyForText(Text(std::string("ç¹é«ä¸æ")));
- DALI_TEST_CHECK( asianFont.size() != 0 );
-
- Text text = Text(std::string("ç¹é«ä¸æ"))[0];
- Character c = text[0];
-
- asianFont = Font::GetFamilyForText(c );
- DALI_TEST_CHECK( asianFont.size() != 0 );
-
- END_TEST;
-}
-
-int UtcFontGetFontLineHeightFromCapsHeight(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::GetLineHeightFromCapsHeight()");
-
- CapsHeight capsHeight(10);
- PixelSize pixelSize = Font::GetLineHeightFromCapsHeight("", "", capsHeight);
- DALI_TEST_CHECK( capsHeight < pixelSize );
-
- pixelSize = Font::GetLineHeightFromCapsHeight(Font::GetFamilyForText("Hello world"), "", capsHeight);
- DALI_TEST_CHECK( capsHeight < pixelSize );
-
- pixelSize = Font::GetLineHeightFromCapsHeight(Font::GetFamilyForText(Text(std::string("Hello world"))), "", capsHeight);
- DALI_TEST_CHECK( capsHeight < pixelSize );
- END_TEST;
-}
-
-int UtcFontAllGlyphsSupported(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::AllGlyphsSupported()");
-
- Font font = Font::New();
-
- font.AllGlyphsSupported("Hello World\n");
-
- DALI_TEST_CHECK(application.GetPlatform().WasCalled(TestPlatformAbstraction::AllGlyphsSupportedFunc));
- application.GetPlatform().ResetTrace();
-
- font.AllGlyphsSupported(Text(std::string("Hello World\n")));
-
- DALI_TEST_CHECK(application.GetPlatform().WasCalled(TestPlatformAbstraction::AllGlyphsSupportedFunc));
-
- application.GetPlatform().ResetTrace();
-
- Character c = Text(std::string("t"))[0];
- font.AllGlyphsSupported(c);
-
- DALI_TEST_CHECK(application.GetPlatform().WasCalled(TestPlatformAbstraction::AllGlyphsSupportedFunc));
- END_TEST;
-}
-
-int UtcFontGetMetrics(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::UtcFontGetMetrics()");
-
- Font font = Font::New();
- font.MeasureText(Text(std::string("Hello World"))); // Builds fake metrics in TestPlatformAbstraction.
-
- float lineHeight = font.GetLineHeight();
- float ascender = font.GetAscender();
- float underlineThickness = font.GetUnderlineThickness();
- float underlinePosition = font.GetUnderlinePosition();
- Font::Metrics metrics = font.GetMetrics( Text("H")[0] );
-
- // TODO VCC This TET case fails if there are some metrics cached.
-
- DALI_TEST_EQUALS( lineHeight, 11.380209f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( ascender, 10.242188f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( underlineThickness, 2.276042f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( underlinePosition, 9.104167f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( metrics.GetAdvance(), 11.380209f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( metrics.GetBearing(), 10.242188f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( metrics.GetWidth(), 11.380209f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcFontIsDefault(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::UtcFontIsDefault()");
-
- FontParameters fontParams("FreeSans", "", PointSize(10.f));
- Font font1 = Font::New(fontParams);
-
- DALI_TEST_CHECK( !font1.IsDefaultSystemFont() );
- DALI_TEST_CHECK( !font1.IsDefaultSystemSize() );
-
- DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::ValidateFontFamilyNameFunc ) );
- application.GetPlatform().ResetTrace();
-
- Font font2 = Font::New();
-
- DALI_TEST_CHECK( !font2.IsDefaultSystemFont() );
- DALI_TEST_CHECK( font2.IsDefaultSystemSize() );
-
- DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::ValidateFontFamilyNameFunc ) );
- END_TEST;
-}
-
-
-int UtcFontGetInstalledFonts(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::Font::GetInstalledFonts()");
-
- // the default should only get installed and downloaded fonts
- std::vector fontList;
-
- fontList = Font::GetInstalledFonts(Font::LIST_SYSTEM_FONTS);
- DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::ValidateGetFontListFunc ) );
- DALI_TEST_CHECK( application.GetPlatform().GetLastFontListMode() == Dali::Integration::PlatformAbstraction::LIST_SYSTEM_FONTS );
-
- fontList = Font::GetInstalledFonts(Font::LIST_ALL_FONTS);
- DALI_TEST_CHECK( application.GetPlatform().GetLastFontListMode() == Dali::Integration::PlatformAbstraction::LIST_ALL_FONTS );
-
- fontList = Font::GetInstalledFonts(Font::LIST_APPLICATION_FONTS);
- DALI_TEST_CHECK( application.GetPlatform().GetLastFontListMode() == Dali::Integration::PlatformAbstraction::LIST_APPLICATION_FONTS );
-
- END_TEST;
-}
-
-int UtcFontMetricsDefaultConstructor(void)
-{
- TestApplication application;
-
- tet_infoline("Testing UtcFontMetricsDefaultConstructor");
-
- Font::Metrics metrics;
-
- DALI_TEST_EQUALS( metrics.GetAdvance() , 0.f , Math::MACHINE_EPSILON_10000, TEST_LOCATION );
- DALI_TEST_EQUALS( metrics.GetBearing() , 0.f , Math::MACHINE_EPSILON_10000, TEST_LOCATION );
- DALI_TEST_EQUALS( metrics.GetWidth() , 0.f , Math::MACHINE_EPSILON_10000, TEST_LOCATION );
- DALI_TEST_EQUALS( metrics.GetHeight() , 0.f , Math::MACHINE_EPSILON_10000, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcFontMetricsCopyConstructor(void)
-{
- TestApplication application;
-
- tet_infoline("Testing UtcFontMetricsCopyConstructor");
-
- Font font = Font::New();
- font.MeasureText(Text(std::string("Hello World"))); // Builds fake metrics in TestPlatformAbstraction.
- Font::Metrics metrics = font.GetMetrics( Text("H")[0] );
- Font::Metrics metrics2( metrics );
-
- DALI_TEST_EQUALS( metrics.GetAdvance() , metrics2.GetAdvance() , Math::MACHINE_EPSILON_10000, TEST_LOCATION );
- DALI_TEST_EQUALS( metrics.GetBearing() , metrics2.GetBearing(), Math::MACHINE_EPSILON_10000, TEST_LOCATION );
- DALI_TEST_EQUALS( metrics.GetWidth() , metrics2.GetWidth() , Math::MACHINE_EPSILON_10000, TEST_LOCATION );
- DALI_TEST_EQUALS( metrics.GetHeight() , metrics2.GetHeight(), Math::MACHINE_EPSILON_10000, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcFontMetricsAssignmentOperator(void)
-{
- TestApplication application;
-
- tet_infoline("Testing UtcFontMetricsAssignmentOperator");
-
- Font font = Font::New();
- font.MeasureText(Text(std::string("Hello World"))); // Builds fake metrics in TestPlatformAbstraction.
- Font::Metrics metrics = font.GetMetrics( Text("H")[0] );
- Font::Metrics metrics2;
-
- metrics2 = metrics;
-
- DALI_TEST_EQUALS( metrics.GetAdvance() , metrics2.GetAdvance() , Math::MACHINE_EPSILON_10000, TEST_LOCATION );
- DALI_TEST_EQUALS( metrics.GetBearing() , metrics2.GetBearing(), Math::MACHINE_EPSILON_10000, TEST_LOCATION );
- DALI_TEST_EQUALS( metrics.GetWidth() , metrics2.GetWidth() , Math::MACHINE_EPSILON_10000, TEST_LOCATION );
- DALI_TEST_EQUALS( metrics.GetHeight() , metrics2.GetHeight(), Math::MACHINE_EPSILON_10000, TEST_LOCATION );
-
- END_TEST;
-}
diff --git a/automated-tests/src/dali/utc-Dali-FontParameters.cpp b/automated-tests/src/dali/utc-Dali-FontParameters.cpp
deleted file mode 100644
index fc80f91..0000000
--- a/automated-tests/src/dali/utc-Dali-FontParameters.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include
-
-#include
-#include
-#include
-
-#include
-
-using namespace Dali;
-
-void utc_dali_font_parameters_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_font_parameters_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-namespace
-{
-
-const std::string FAMILY_NAME = "Arial";
-const std::string STYLE = "Bold";
-const unsigned int PIXEL_SIZE = 20;
-const unsigned int POINT_SIZE = 11.f;
-
-} // anon namespace
-
-
-int UtcDaliFontParamsDefaultConstructor(void)
-{
- TestApplication application;
- tet_infoline("Testing UtcDaliFontParamsDefaultConstructor");
- FontParameters params;
-
- DALI_TEST_CHECK(params.GetFamilyName() == "" );
- DALI_TEST_CHECK(params.GetStyle() == "" );
- DALI_TEST_EQUALS( float(params.GetSize()) , 0.f , Math::MACHINE_EPSILON_10000, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliFontParamsPointSizeConstructor(void)
-{
- TestApplication application;
- tet_infoline("Testing UtcDaliFontParamsPointSizeConstructor");
-
- PointSize pointSize( POINT_SIZE );
- FontParameters params( FAMILY_NAME, STYLE, pointSize);
-
- DALI_TEST_CHECK(params.GetFamilyName() == FAMILY_NAME );
- DALI_TEST_CHECK(params.GetStyle() == STYLE );
- DALI_TEST_EQUALS( float(params.GetSize()), float(pointSize), Math::MACHINE_EPSILON_10000, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliFontParamsPixelSizeConstructor(void)
-{
- TestApplication application;
- tet_infoline("Testing UtcDaliFontParamsPixelSizeConstructor");
-
- PixelSize pixelSize( PIXEL_SIZE );
- FontParameters params( FAMILY_NAME, STYLE, pixelSize);
-
- DALI_TEST_CHECK(params.GetFamilyName() == FAMILY_NAME );
- DALI_TEST_CHECK(params.GetStyle() == STYLE );
- DALI_TEST_EQUALS( float(params.GetSize()), Font::PixelsToPoints( PIXEL_SIZE ) , Math::MACHINE_EPSILON_10000, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliFontParamsCopyConstructor(void)
-{
- TestApplication application;
- tet_infoline("Testing UtcDaliFontParamsCopyConstructor");
- PixelSize pixelSize( PIXEL_SIZE );
- FontParameters params( FAMILY_NAME, STYLE, pixelSize);
-
-
- FontParameters params2( params );
- DALI_TEST_CHECK(params2.GetFamilyName() == FAMILY_NAME );
- DALI_TEST_CHECK(params2.GetStyle() == STYLE );
- DALI_TEST_EQUALS( float(params2.GetSize()), Font::PixelsToPoints( PIXEL_SIZE ) , Math::MACHINE_EPSILON_10000, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliFontParamsAssignmentOperator(void)
-{
- TestApplication application;
- tet_infoline("Testing UtcDaliFontParamsAssignmentOperator");
- PixelSize pixelSize( PIXEL_SIZE );
- FontParameters params( FAMILY_NAME, STYLE, pixelSize);
-
- FontParameters params2;
- params2 = params;
- DALI_TEST_CHECK(params2.GetFamilyName() == FAMILY_NAME );
- DALI_TEST_CHECK(params2.GetStyle() == STYLE );
- DALI_TEST_EQUALS( float(params2.GetSize()) ,Font::PixelsToPoints( PIXEL_SIZE ) , Math::MACHINE_EPSILON_10000, TEST_LOCATION );
-
- // for coverage self assignment
- params2 = params2;
- DALI_TEST_CHECK(params2.GetFamilyName() == FAMILY_NAME );
-
- END_TEST;
-}
-
-int UtcDaliFontParamsPointSizeEqualityOperator(void)
-{
- TestApplication application;
- tet_infoline("Testing UtcDaliFontParamsPixelSizeConstructor");
- PointSize pointSize1(1.f);
- PointSize pointSize2(2.f);
- DALI_TEST_CHECK( pointSize1 != pointSize2 );
-
- END_TEST;
-}
diff --git a/automated-tests/src/dali/utc-Dali-HoverProcessing.cpp b/automated-tests/src/dali/utc-Dali-HoverProcessing.cpp
index efd4e34..cc8bc40 100644
--- a/automated-tests/src/dali/utc-Dali-HoverProcessing.cpp
+++ b/automated-tests/src/dali/utc-Dali-HoverProcessing.cpp
@@ -1244,7 +1244,7 @@ int UtcDaliHoverStencil(void)
TestApplication application;
Stage stage = Stage::GetCurrent();
- TextActor actor = TextActor::New();
+ Actor actor = ImageActor::New();
actor.SetSize(100.0f, 100.0f);
actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
stage.Add(actor);
@@ -1282,12 +1282,12 @@ int UtcDaliHoverStencilInActorHierarchy(void)
TestApplication application;
Stage stage = Stage::GetCurrent();
- TextActor parent = TextActor::New();
+ ImageActor parent = ImageActor::New();
parent.SetSize(100.0f, 100.0f);
parent.SetAnchorPoint(AnchorPoint::TOP_LEFT);
stage.Add(parent);
- TextActor child = TextActor::New();
+ ImageActor child = ImageActor::New();
child.SetSize(25.0f, 25.0f);
child.SetAnchorPoint(AnchorPoint::TOP_LEFT);
parent.Add(child);
@@ -1368,7 +1368,7 @@ int UtcDaliHoverMultipleStencils(void)
TestApplication application;
Stage stage = Stage::GetCurrent();
- TextActor actor = TextActor::New();
+ ImageActor actor = ImageActor::New();
actor.SetSize(100.0f, 100.0f);
actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
stage.Add(actor);
diff --git a/automated-tests/src/dali/utc-Dali-ImageActor.cpp b/automated-tests/src/dali/utc-Dali-ImageActor.cpp
index 5b7d430..95a4a15 100644
--- a/automated-tests/src/dali/utc-Dali-ImageActor.cpp
+++ b/automated-tests/src/dali/utc-Dali-ImageActor.cpp
@@ -182,7 +182,7 @@ int UtcDaliImageActorSetSize01(void)
BitmapImage img = BitmapImage::New( 1,1 );
ImageActor actor = ImageActor::New( img );
- ShaderEffect effect = ShaderEffect::New( " ", " ", " ", " ", ShaderEffect::HINT_GRID );
+ ShaderEffect effect = ShaderEffect::New( " ", " ", GEOMETRY_TYPE_IMAGE, ShaderEffect::HINT_GRID );
actor.SetShaderEffect( effect );
const float INVALID_SIZE = float(1u<<31);
diff --git a/automated-tests/src/dali/utc-Dali-Layer.cpp b/automated-tests/src/dali/utc-Dali-Layer.cpp
index 82ca140..4fa7fe1 100644
--- a/automated-tests/src/dali/utc-Dali-Layer.cpp
+++ b/automated-tests/src/dali/utc-Dali-Layer.cpp
@@ -547,8 +547,8 @@ int UtcDaliLayerClippingGLCalls(void)
layer.SetClippingBox( testBox );
// Add at least one renderable actor so the GL calls are actually made
- Actor textActor = TextActor::New("Hello");
- stage.Add( textActor );
+ Actor actor = ImageActor::New();
+ stage.Add( actor );
// flush the queue and render once
application.SendNotification();
diff --git a/automated-tests/src/dali/utc-Dali-RenderableActor.cpp b/automated-tests/src/dali/utc-Dali-RenderableActor.cpp
index 63830e8..6b0441e 100644
--- a/automated-tests/src/dali/utc-Dali-RenderableActor.cpp
+++ b/automated-tests/src/dali/utc-Dali-RenderableActor.cpp
@@ -38,7 +38,6 @@ void renderable_actor_cleanup(void)
namespace
{
-static const char* TestTextHelloWorld = "Hello World";
static bool gIsActor1SortModifierCorrect;
static bool gIsActor2SortModifierCorrect;
const float gActor1SortModifierValue = 96.0f;
@@ -63,10 +62,10 @@ int UtcDaliRenderableActorDownCast(void)
tet_infoline("Testing Dali::RenderableActor::DownCast()");
- TextActor textActor = TextActor::New(TestTextHelloWorld);
+ ImageActor imageActor = ImageActor::New();
Actor anActor = Actor::New();
- anActor.Add( textActor );
+ anActor.Add( imageActor );
Actor child = anActor.GetChildAt(0);
RenderableActor renderableActor = RenderableActor::DownCast( child );
@@ -98,7 +97,7 @@ int UtcDaliRenderableActorSetSortModifier(void)
float val = -500.0f;
- TextActor actor = TextActor::New(TestTextHelloWorld);
+ ImageActor actor = ImageActor::New();
Stage::GetCurrent().Add(actor);
actor.SetSortModifier( val );
@@ -149,7 +148,7 @@ int UtcDaliRenderableActorGetSortModifier(void)
tet_infoline("Testing Dali::RenderableActor::GetSortModifier()");
- TextActor actor = TextActor::New(TestTextHelloWorld);
+ ImageActor actor = ImageActor::New();
Stage::GetCurrent().Add(actor);
DALI_TEST_EQUALS(actor.GetSortModifier(), 0.0f, TEST_LOCATION);
@@ -164,7 +163,7 @@ int UtcDaliRenderableActorSetGetBlendMode(void)
tet_infoline("Testing Dali::RenderableActor::SetBlendMode() / Dali::RenderableActor::GetBlendMode()");
- TextActor actor = TextActor::New(TestTextHelloWorld);
+ ImageActor actor = ImageActor::New();
actor.SetBlendMode( BlendingMode::OFF );
DALI_TEST_CHECK( BlendingMode::OFF == actor.GetBlendMode() );
@@ -300,10 +299,6 @@ int UtcDaliRenderableActorGetCullFace(void)
tet_infoline("Testing Dali::RenderableActor::GetCullFace()");
- TextActor textActor = TextActor::New(TestTextHelloWorld);
-
- DALI_TEST_CHECK( CullNone == textActor.GetCullFace() );
-
ImageActor imageActor = ImageActor::New();
DALI_TEST_CHECK( CullNone == imageActor.GetCullFace() );
@@ -508,7 +503,7 @@ int UtcDaliRenderableActorSetGetFilterModes(void)
tet_infoline("Testing Dali::RenderableActor::SetFilterMode() / Dali::RenderableActor::GetFilterMode()");
- TextActor actor = TextActor::New(TestTextHelloWorld);
+ ImageActor actor = ImageActor::New();
FilterMode::Type minifyFilter = FilterMode::NEAREST;
FilterMode::Type magnifyFilter = FilterMode::NEAREST;
@@ -776,7 +771,7 @@ int UtcDaliRenderableActorSetShaderEffect(void)
int UtcDaliRenderableActorGetShaderEffect(void)
{
TestApplication application;
- TextActor actor = TextActor::New();
+ ImageActor actor = ImageActor::New();
ShaderEffect effect = ShaderEffect::New("UtcDaliRenderableActorGetShaderEffect-VertexSource", "UtcDaliRenderableActorGetShaderEffect-FragmentSource" );
actor.SetShaderEffect(effect);
@@ -788,7 +783,7 @@ int UtcDaliRenderableActorGetShaderEffect(void)
int UtcDaliRenderableActorRemoveShaderEffect01(void)
{
TestApplication application;
- TextActor actor = TextActor::New();
+ ImageActor actor = ImageActor::New();
ShaderEffect defaultEffect = actor.GetShaderEffect();
@@ -806,7 +801,7 @@ int UtcDaliRenderableActorRemoveShaderEffect01(void)
int UtcDaliRenderableActorRemoveShaderEffect02(void)
{
TestApplication application;
- TextActor actor = TextActor::New();
+ ImageActor actor = ImageActor::New();
ShaderEffect defaultEffect = actor.GetShaderEffect();
@@ -823,8 +818,8 @@ int UtcDaliSetShaderEffectRecursively(void)
* create a tree
* actor1
* actor2 actor4
- * actor3 textactor
- * imageactor
+ * actor3 imageactor1
+ * imageactor2
*/
BitmapImage img = BitmapImage::New( 1,1 );
ImageActor actor1 = ImageActor::New( img );
@@ -832,10 +827,10 @@ int UtcDaliSetShaderEffectRecursively(void)
actor1.Add( actor2 );
Actor actor3 = Actor::New();
actor2.Add( actor3 );
- TextActor textactor = TextActor::New( "Foo" );
- actor2.Add( textactor );
- ImageActor imageactor = ImageActor::New( img );
- actor3.Add( imageactor );
+ ImageActor imageactor1 = ImageActor::New( img );
+ actor2.Add( imageactor1 );
+ ImageActor imageactor2 = ImageActor::New( img );
+ actor3.Add( imageactor2 );
Actor actor4 = Actor::New();
actor1.Add( actor4 );
Stage::GetCurrent().Add( actor1 );
@@ -856,12 +851,12 @@ int UtcDaliSetShaderEffectRecursively(void)
effect = ShaderEffect::New(vertexShader, fragmentShader );
DALI_TEST_CHECK( effect != actor1.GetShaderEffect() );
- DALI_TEST_CHECK( effect != textactor.GetShaderEffect() );
- DALI_TEST_CHECK( effect != imageactor.GetShaderEffect() );
+ DALI_TEST_CHECK( effect != imageactor1.GetShaderEffect() );
+ DALI_TEST_CHECK( effect != imageactor2.GetShaderEffect() );
SetShaderEffectRecursively( actor1, effect );
- DALI_TEST_CHECK( effect == textactor.GetShaderEffect() );
- DALI_TEST_CHECK( effect == imageactor.GetShaderEffect() );
+ DALI_TEST_CHECK( effect == imageactor1.GetShaderEffect() );
+ DALI_TEST_CHECK( effect == imageactor2.GetShaderEffect() );
// flush the queue and render once
application.SendNotification();
@@ -882,8 +877,8 @@ int UtcDaliSetShaderEffectRecursively(void)
// remove partially
RemoveShaderEffectRecursively( actor3 );
- DALI_TEST_CHECK( effect == textactor.GetShaderEffect() );
- DALI_TEST_CHECK( effect != imageactor.GetShaderEffect() );
+ DALI_TEST_CHECK( effect == imageactor1.GetShaderEffect() );
+ DALI_TEST_CHECK( effect != imageactor2.GetShaderEffect() );
// test with empty actor just to check it does not crash
Actor empty;
diff --git a/automated-tests/src/dali/utc-Dali-ShaderEffect.cpp b/automated-tests/src/dali/utc-Dali-ShaderEffect.cpp
index ba2a30e..d6480dc 100644
--- a/automated-tests/src/dali/utc-Dali-ShaderEffect.cpp
+++ b/automated-tests/src/dali/utc-Dali-ShaderEffect.cpp
@@ -150,15 +150,6 @@ int UtcDaliShaderEffectMethodNew02(void)
END_TEST;
}
-int UtcDaliShaderEffectMethodNew03(void)
-{
- TestApplication application;
-
- ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource, VertexSource, FragmentSource, ShaderEffect::HINT_NONE );
- DALI_TEST_CHECK(effect);
- END_TEST;
-}
-
int UtcDaliShaderEffectMethodNew04(void)
{
TestApplication application;
@@ -233,21 +224,6 @@ int UtcDaliShaderEffectMethodNew05(void)
END_TEST;
}
-int UtcDaliShaderEffectMethodNew06(void)
-{
- TestApplication application;
- tet_infoline("Testing Dali::ShaderEffect::New() with shader sources for different geometry types");
-
- ShaderEffect effect = ShaderEffect::New( "imageVertexShader", "imageFragmentShader",
- "textVertexShader", "textFragmentShader",
- "texturedMeshVertexShader", "texturedMeshFragmentShader",
- "meshVertexShader", "meshFragmentShader",
- ShaderEffect::HINT_NONE );
- DALI_TEST_CHECK(effect);
- END_TEST;
-}
-
-
int UtcDaliShaderEffectMethodDownCast(void)
{
TestApplication application;
diff --git a/automated-tests/src/dali/utc-Dali-Text.cpp b/automated-tests/src/dali/utc-Dali-Text.cpp
deleted file mode 100644
index e9ebb97..0000000
--- a/automated-tests/src/dali/utc-Dali-Text.cpp
+++ /dev/null
@@ -1,503 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include
-
-#include
-#include
-#include
-
-using namespace Dali;
-
-void utc_dali_text_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_text_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-int UtcDaliTextConstructor(void)
-{
- TestApplication application;
-
- Text text;
-
- DALI_TEST_CHECK( text.IsEmpty() );
-
- Text someEmptyText1( "" );
-
- DALI_TEST_CHECK( someEmptyText1.IsEmpty() );
-
- Text someEmptyText2( std::string( "" ) );
-
- DALI_TEST_CHECK( someEmptyText2.IsEmpty() );
-
- Text someEmptyText3( text );
-
- DALI_TEST_CHECK( someEmptyText3.IsEmpty() );
-
- Text someText1( "Some text" );
-
- DALI_TEST_CHECK( !someText1.IsEmpty() );
-
- Text someText2( std::string( "Some text" ) );
-
- DALI_TEST_CHECK( !someText2.IsEmpty() );
-
- Text someText3( Text( std::string( "Some text" ) ) );
-
- DALI_TEST_CHECK( !someText3.IsEmpty() );
-
- Character c = someText1[0];
-
- Text cText( c );
-
- DALI_TEST_CHECK( !cText.IsEmpty() );
- END_TEST;
-}
-
-int UtcDaliTextCopyConstructor(void)
-{
- TestApplication application;
-
- Text someText1( std::string( "Some text1" ) );
- Text someText2( std::string( "Some text2" ) );
-
- Text someText3( someText1 );
- Text someText4 = someText2;
-
- DALI_TEST_CHECK( (someText1.GetText()==someText3.GetText()) && (someText2.GetText()==someText4.GetText()) );
- END_TEST;
-}
-
-int UtcDaliTextAssignmentOperator(void)
-{
- TestApplication application;
-
- // check for assignment when current is NULL
-
- Text someText1( std::string( "Some text1" ) );
- Text someText2;
- someText2 = someText1;
-
- DALI_TEST_CHECK( (someText1.GetText()==someText2.GetText()) );
-
- // check for assignment when current object already has text
- Text someText3( std::string( "Some text3" ) );
- someText2 = someText3;
- DALI_TEST_CHECK( (someText3.GetText()==someText2.GetText()) );
-
- Text someText4;
-
- // check for assignment of empty text
- someText2 = someText4;
- DALI_TEST_CHECK( someText2.IsEmpty() );
-
- // check for self assignment
- someText3 = someText3;
- DALI_TEST_CHECK( ! someText3.IsEmpty() );
-
-
- END_TEST;
-}
-
-int UtcDaliTextSetGetText(void)
-{
- TestApplication application;
-
- const char* someText = "Some text";
- const std::string someText2( "Some text2" );
-
- Text text;
- text.SetText( someText );
-
- DALI_TEST_EQUALS( someText, text.GetText(), TEST_LOCATION );
-
- text.SetText( someText2 );
-
- DALI_TEST_EQUALS( someText2, text.GetText(), TEST_LOCATION );
-
- Character c = text[0];
- text.SetText( c );
-
- DALI_TEST_EQUALS( std::string( "S" ), text.GetText(), TEST_LOCATION );
-
- Text text2;
- text2.SetText( text );
-
- DALI_TEST_EQUALS( text2.GetText(), text.GetText(), TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextAccessOperator01(void)
-{
- TestApplication application;
-
- std::string someText;
-
- Text text;
- text.SetText( someText );
-
- bool assert1 = false;
- bool assert2 = false;
- try
- {
- Character c = text[0];
- }
- catch( DaliException& e )
- {
- tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
- DALI_TEST_EQUALS( e.mCondition, "NULL != mImpl && \"Text::operator[]: Text is uninitialized\"", TEST_LOCATION );
-
- assert1 = true;
- }
-
- someText = std::string( "some text" );
- text.SetText( someText );
-
- try
- {
- Character c = text[100];
- }
- catch( DaliException& e )
- {
- tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
- DALI_TEST_EQUALS( e.mCondition, "position < mString.Count() && \"Text::operator[]: Character position is out of bounds\"", TEST_LOCATION );
-
- assert2 = true;
- }
-
- if( assert1 && assert2 )
- {
- tet_result( TET_PASS );
- }
- else
- {
- tet_result( TET_FAIL );
- }
- END_TEST;
-}
-
-int UtcDaliTextAccessOperator02(void)
-{
- TestApplication application;
-
- const std::string someText( "Some text");
-
- Text text;
- text.SetText( someText );
-
- DALI_TEST_CHECK( someText == text.GetText() );
-
- Character c = text[0];
- text.SetText( c );
-
- DALI_TEST_CHECK( std::string("S") == text.GetText() );
- END_TEST;
-}
-
-int UtcDaliTextIsEmpty(void)
-{
- TestApplication application;
-
- Text text;
-
- DALI_TEST_CHECK( text.IsEmpty() );
-
- text.SetText( std::string( "Some text") );
-
- DALI_TEST_CHECK( !text.IsEmpty() );
- END_TEST;
-}
-
-int UtcDaliTextGetLength(void)
-{
- TestApplication application;
-
- const std::string someText( "Some text");
-
- Text text( someText );
-
- DALI_TEST_CHECK( someText.size() == text.GetLength() );
- END_TEST;
-}
-
-int UtcDaliTextAppend(void)
-{
- TestApplication application;
-
- Text text( std::string( "Some text") );
-
- text.Append( "A" );
-
- DALI_TEST_CHECK( std::string( "Some textA" ) == text.GetText() );
-
- text.Append( std::string( "B" ) );
-
- DALI_TEST_CHECK( std::string( "Some textAB" ) == text.GetText() );
-
- Character c = text[0];
- text.Append( c );
-
- DALI_TEST_CHECK( std::string( "Some textABS" ) == text.GetText() );
-
- Text text2( std::string("C") );
- text.Append( text2 );
-
- DALI_TEST_CHECK( std::string( "Some textABSC" ) == text.GetText() );
-
- // append to a null text
-
- Text emptyText;
- emptyText.Append( text2 );
- DALI_TEST_CHECK( text2.GetText() == emptyText.GetText() );
-
- // append a null text
-
- Text emptyText2;
- emptyText.Append( emptyText2 );
- DALI_TEST_CHECK( text2.GetText() == emptyText.GetText() );
-
- END_TEST;
-}
-
-int UtcDaliTextRemove01(void)
-{
- TestApplication application;
-
- Text text( std::string( "Some text") );
-
- bool assert1 = false;
- bool assert2 = false;
- bool assert3 = false;
-
- try
- {
- text.Remove( 100, 3 );
- }
- catch( DaliException& e )
- {
- tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
- DALI_TEST_EQUALS( e.mCondition, "position < mString.Count() && \"Text::Remove: Character position is out of bounds\"", TEST_LOCATION );
- assert1 = true;
- }
-
- try
- {
- text.Remove( 1, 300 );
- }
- catch( DaliException& e )
- {
- tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
- DALI_TEST_EQUALS( e.mCondition, "position + numberOfCharacters <= mString.Count() && \"Text::Remove: Character position + numberOfCharacters is out of bounds\"", TEST_LOCATION );
- assert2 = true;
- }
-
- try
- {
- text.SetText( std::string( "" ) );
- text.Remove( 1, 300 );
- }
- catch( DaliException& e )
- {
- tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
- DALI_TEST_EQUALS( e.mCondition, "NULL != mImpl && \"Text::Remove: Text is uninitialized\"", TEST_LOCATION );
- assert3 = true;
- }
-
- if( assert1 && assert2 && assert3 )
- {
- tet_result( TET_PASS );
- }
- else
- {
- tet_result( TET_FAIL );
- }
- END_TEST;
-}
-
-int UtcDaliTextRemove02(void)
-{
- TestApplication application;
-
- Text text01( std::string( "Some text") );
- Text text02( std::string( "Somext") );
- Text text03( std::string( "" ) );
- Text text04( std::string( "Hello world" ) );
- Text text05( std::string( "world" ) );
-
- text01.Remove( 3u, 3u );
-
- DALI_TEST_EQUALS( text01.GetLength(), text02.GetLength(), TEST_LOCATION );
- DALI_TEST_EQUALS( text01.GetText(), text02.GetText(), TEST_LOCATION );
-
- text01.Remove( 0u, 0u );
-
- DALI_TEST_EQUALS( text01.GetLength(), text02.GetLength(), TEST_LOCATION );
- DALI_TEST_EQUALS( text01.GetText(), text02.GetText(), TEST_LOCATION );
-
- text01.Remove( 0u, 6u );
-
- DALI_TEST_EQUALS( text01.GetLength(), text03.GetLength(), TEST_LOCATION );
- DALI_TEST_EQUALS( text01.GetText(), text03.GetText(), TEST_LOCATION );
-
- text04.Remove( 0u, 6u );
-
- DALI_TEST_EQUALS( text04.GetLength(), text05.GetLength(), TEST_LOCATION );
- DALI_TEST_EQUALS( text04.GetText(), text05.GetText(), TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextFind(void)
-{
- TestApplication application;
-
- Text text;
- Character c1 = Text( std::string( "c" ) )[0u];
- Character c2 = Text( std::string( "o" ) )[0u];
- Vector positions;
-
- // Find in void text.
-
- positions.Clear();
- text.Find( c1, 0u, 0u, positions );
- DALI_TEST_EQUALS( positions.Count(), 0u, TEST_LOCATION );
-
- positions.Clear();
- text.Find( Text::WHITE_SPACE, 0u, 0u, positions );
- DALI_TEST_EQUALS( positions.Count(), 0u, TEST_LOCATION );
-
- positions.Clear();
- text.Find( Text::NEW_LINE, 0u, 0u, positions );
- DALI_TEST_EQUALS( positions.Count(), 0u, TEST_LOCATION );
-
- // Find in text.
-
- // Find 'c' and 'o'
- text.SetText( std::string( "Hello world" ) );
-
- positions.Clear();
- text.Find( c1, 0u, 11u, positions );
- DALI_TEST_EQUALS( positions.Count(), 0u, TEST_LOCATION );
-
- positions.Clear();
- text.Find( c2, 0u, 11u, positions );
- DALI_TEST_EQUALS( positions.Count(), 2u, TEST_LOCATION );
- DALI_TEST_EQUALS( positions[0u], 4u, TEST_LOCATION );
- DALI_TEST_EQUALS( positions[1u], 7u, TEST_LOCATION );
-
- // Find white space
- text.SetText( std::string( " Hello world \n" ) );
-
- positions.Clear();
- text.Find( Text::WHITE_SPACE, 0u, 17u, positions );
- DALI_TEST_EQUALS( positions.Count(), 8u, TEST_LOCATION );
- DALI_TEST_EQUALS( positions[0u], 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( positions[1u], 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( positions[2u], 2u, TEST_LOCATION );
- DALI_TEST_EQUALS( positions[3u], 8u, TEST_LOCATION );
- DALI_TEST_EQUALS( positions[4u], 9u, TEST_LOCATION );
- DALI_TEST_EQUALS( positions[5u], 15u, TEST_LOCATION );
- DALI_TEST_EQUALS( positions[6u], 16u, TEST_LOCATION );
- DALI_TEST_EQUALS( positions[7u], 17u, TEST_LOCATION );
-
- // Find new line character
- text.SetText( std::string( "\n\nHello\nworld\n\n" ) );
-
- positions.Clear();
- text.Find( Text::NEW_LINE, 0u, 14u, positions );
- DALI_TEST_EQUALS( positions.Count(), 5u, TEST_LOCATION );
- DALI_TEST_EQUALS( positions[0u], 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( positions[1u], 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( positions[2u], 7u, TEST_LOCATION );
- DALI_TEST_EQUALS( positions[3u], 13u, TEST_LOCATION );
- DALI_TEST_EQUALS( positions[4u], 14u, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextGetSubText(void)
-{
- TestApplication application;
-
- Text text;
- Text subText;
-
- // Get sub-text from a void text.
-
- subText.SetText( "Hello" );
- text.GetSubText( 0u, 1u, subText );
- DALI_TEST_EQUALS( subText.GetText(), std::string( "Hello" ), TEST_LOCATION );
-
- // Get sub-text.
-
- text.SetText( std::string( "Hello world" ) );
-
- // Access out of bounds
- subText.SetText( "Hello" );
- text.GetSubText( 30u, 31u, subText );
- DALI_TEST_EQUALS( subText.GetText(), std::string( "Hello" ), TEST_LOCATION );
- text.GetSubText( 0u, 31u, subText );
- DALI_TEST_EQUALS( subText.GetText(), std::string( "Hello" ), TEST_LOCATION );
- text.GetSubText( 30u, 1u, subText );
- DALI_TEST_EQUALS( subText.GetText(), std::string( "Hello" ), TEST_LOCATION );
-
- // Check it swaps the indices.
- text.GetSubText( 8u, 2u, subText );
- DALI_TEST_EQUALS( subText.GetText(), std::string( "row oll" ), TEST_LOCATION );
-
- // Normal access.
- subText.SetText( std::string( "" ) );
- text.GetSubText( 4u, 6u, subText );
- DALI_TEST_EQUALS( subText.GetText(), std::string( "o w" ), TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextIsWhiteSpaceNewLine(void)
-{
- TestApplication application;
-
- Text text;
-
- // Query a void text.
-
- DALI_TEST_CHECK( !text.IsWhiteSpace( 0u ) );
- DALI_TEST_CHECK( !text.IsNewLine( 0u ) );
-
- // Set a text
- text.SetText( "Hello world\n" );
-
- // Query out of bounds
-
- DALI_TEST_CHECK( !text.IsWhiteSpace( 30u ) );
- DALI_TEST_CHECK( !text.IsNewLine( 30u ) );
-
- // Normal query.
-
- DALI_TEST_CHECK( !text.IsWhiteSpace( 1u ) );
- DALI_TEST_CHECK( !text.IsNewLine( 1u ) );
- DALI_TEST_CHECK( text.IsWhiteSpace( 5u ) );
- DALI_TEST_CHECK( text.IsNewLine( 11u ) );
-
- END_TEST;
-}
diff --git a/automated-tests/src/dali/utc-Dali-TextActor.cpp b/automated-tests/src/dali/utc-Dali-TextActor.cpp
deleted file mode 100644
index a57b2aa..0000000
--- a/automated-tests/src/dali/utc-Dali-TextActor.cpp
+++ /dev/null
@@ -1,1079 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include
-#include
-
-#include
-#include
-
-using namespace Dali;
-
-void text_actor_test_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void text_actor_test_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-namespace
-{
-static const char* TestTextHello = "Hello";
-static const char* TestTextHelloWorld = "Hello World";
-static const char* LongTestText = "This is a very long piece of text, and is sure not to fit into any box presented to it";
-
-static const std::string DEFAULT_NAME_STYLE( "" );
-static const PointSize DEFAULT_FONT_POINT_SIZE( 0.f );
-
-static const std::string FONT_FAMILY( "Arial" );
-static const std::string FONT_STYLE( "Bold" );
-static const PointSize FONT_POINT_SIZE( 12.f );
-static const Vector4 TEXT_COLOR( Color::RED );
-
-static const TextStyle::Weight TEXT_WEIGHT( TextStyle::EXTRALIGHT );
-static const float SMOOTH_EDGE( 5.0f );
-
-static const bool ITALICS( true );
-static const Degree ITALICS_ANGLE( 10.f );
-static const Radian ITALICS_RADIAN_ANGLE(0.4f);
-
-static const bool UNDERLINE( true );
-static const float UNDERLINE_THICKNESS( 5.0f );
-static const float UNDERLINE_POSITION( 60.0f );
-
-static const bool SHADOW( true );
-static const Vector4 SHADOW_COLOR( Color::BLUE );
-static const Vector2 SHADOW_OFFSET( 2.f, 2.f );
-static const float SHADOW_SIZE( 55.f );
-
-static const bool GLOW( true );
-static const Vector4 GLOW_COLOR( Color::BLACK );
-static const float GLOW_INTENSITY( 10.0f );
-
-static const bool OUTLINE( true );
-static const Vector4 OUTLINE_COLOR( Color::MAGENTA );
-static const Vector2 OUTLINE_THICKNESS( 15.f, 14.f );
-
-static const bool GRADIENT( true );
-static const Vector4 GRADIENT_COLOR( Color::YELLOW );
-static const Vector2 GRADIENT_START_POINT( 1.f, 1.f );
-static const Vector2 GRADIENT_END_POINT( 2.f, 2.f );
-} // anon namespace
-
-int UtcDaliTextActorConstructorVoid(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::TextActor::TextActor()");
-
- TextActor actor;
-
- DALI_TEST_CHECK(!actor);
- END_TEST;
-}
-
-int UtcDaliTextActorNew01(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::TextActor::New()");
-
- TextActor actor = TextActor::New();
-
- DALI_TEST_CHECK(actor);
-
- END_TEST;
-}
-
-
-int UtcDaliTextActorNew02(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::TextActor::New(const Text& text)");
-
- TextActor actor1 = TextActor::New(TestTextHello);
-
- DALI_TEST_CHECK(actor1);
-
- TextActor actor2 = TextActor::New(std::string(TestTextHello));
-
- DALI_TEST_CHECK(actor2);
-
- TextActor actor3 = TextActor::New(Text(TestTextHello));
-
- DALI_TEST_CHECK(actor3);
-
- TextActor actor4 = TextActor::New(Text(std::string(TestTextHello)));
-
- DALI_TEST_CHECK(actor4);
-
- END_TEST;
-}
-
-int UtcDaliTextActorNew03(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::TextActor::New(const Text& text, const TextActorParameters& parameters)");
-
- TextActorParameters parameters;
-
- TextActor actor1 = TextActor::New(TestTextHello, parameters);
-
- DALI_TEST_CHECK(actor1);
- DALI_TEST_CHECK(actor1.IsFontDetectionAutomatic());
-
- TextStyle style;
- style.SetTextColor( Color::RED );
-
- parameters = TextActorParameters( style, TextActorParameters::FONT_DETECTION_OFF );
-
- TextActor actor2 = TextActor::New(std::string(TestTextHello), parameters);
-
- DALI_TEST_CHECK(actor2);
- DALI_TEST_CHECK(!actor2.IsFontDetectionAutomatic());
- DALI_TEST_CHECK( style.GetTextColor() == actor2.GetTextStyle().GetTextColor());
-
- TextActor actor3 = TextActor::New(Text(TestTextHello), parameters);
-
- DALI_TEST_CHECK(actor3);
-
- TextActor actor4 = TextActor::New(Text(std::string(TestTextHello)), parameters);
-
- DALI_TEST_CHECK(actor4);
-
- END_TEST;
-}
-
-int UtcDaliTextActorDownCast(void)
-{
- TestApplication application;
- tet_infoline("Testing Dali::TextActor::DownCast()");
-
- TextActor actor1 = TextActor::New("Hello, World!");
- Actor anActor = Actor::New();
- anActor.Add(actor1);
-
- Actor child = anActor.GetChildAt(0);
- TextActor textActor = TextActor::DownCast(child);
-
- DALI_TEST_CHECK(textActor);
- DALI_TEST_CHECK(!textActor.GetText().compare("Hello, World!"));
- END_TEST;
-}
-
-int UtcDaliTextActorDownCast2(void)
-{
- TestApplication application;
- tet_infoline("Testing Dali::TextActor::DownCast()");
-
- Actor actor1 = Actor::New();
- Actor anActor = Actor::New();
- anActor.Add(actor1);
-
- Actor child = anActor.GetChildAt(0);
- TextActor textActor = TextActor::DownCast(child);
- DALI_TEST_CHECK(!textActor);
-
- Actor unInitialzedActor;
- textActor = DownCast< TextActor >( unInitialzedActor );
- DALI_TEST_CHECK(!textActor);
- END_TEST;
-}
-
-int UtcDaliTextActorSetText(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::TextActor::SetText()");
-
- TextActor actor01 = TextActor::New(TestTextHello);
-
- actor01.SetText(TestTextHelloWorld);
-
- std::string text = actor01.GetText();
-
- DALI_TEST_EQUALS(text, TestTextHelloWorld, TEST_LOCATION);
-
- actor01.SetText(Text(std::string(TestTextHelloWorld)));
-
- text = actor01.GetText();
-
- DALI_TEST_EQUALS(text, TestTextHelloWorld, TEST_LOCATION);
-
- actor01.SetText("");
-
- text = actor01.GetText();
-
- DALI_TEST_EQUALS(text, "", TEST_LOCATION);
-
- TextActor actor02 = TextActor::New("");
-
- actor02.SetText( std::string() );
-
- text = actor02.GetText();
-
- DALI_TEST_EQUALS(text, "", TEST_LOCATION);
-
- actor02.SetText(TestTextHelloWorld);
- actor02.SetText( std::string() );
-
- text = actor02.GetText();
-
- DALI_TEST_EQUALS(text, "", TEST_LOCATION);
-
- TextActor actor03 = TextActor::New("");
- const Text voidText;
- actor03.SetText(voidText);
-
- text = actor03.GetText();
-
- DALI_TEST_EQUALS(text, "", TEST_LOCATION);
-
- actor03.SetText(TestTextHelloWorld);
- actor03.SetText(voidText);
-
- text = actor03.GetText();
-
- DALI_TEST_EQUALS(text, "", TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliTextActorSetFont(void)
-{
- TestApplication application;
-
- TextActor actor = TextActor::New(TestTextHello);
-
- Font defaultFont = actor.GetFont();
- DALI_TEST_EQUALS( defaultFont.GetName(), DEFAULT_NAME_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultFont.GetStyle(), DEFAULT_NAME_STYLE, TEST_LOCATION );
- DALI_TEST_CHECK( defaultFont.IsDefaultSystemSize() );
-
- TextStyle defaultStyle = actor.GetTextStyle();
- DALI_TEST_EQUALS( defaultStyle.GetFontName(), DEFAULT_NAME_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetFontStyle(), DEFAULT_NAME_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetFontPointSize(), DEFAULT_FONT_POINT_SIZE, TEST_LOCATION );
-
- FontParameters params( FONT_FAMILY, FONT_STYLE, FONT_POINT_SIZE );
-
- Font font = Font::New( params );
-
- actor.SetFont( font );
-
- Font font2 = actor.GetFont();
-
- DALI_TEST_EQUALS( font2.GetName(), FONT_FAMILY, TEST_LOCATION );
- DALI_TEST_EQUALS( font2.GetStyle(), FONT_STYLE, TEST_LOCATION );
- DALI_TEST_CHECK( !font2.IsDefaultSystemSize() );
- DALI_TEST_EQUALS( PointSize( font2.GetPointSize() ), FONT_POINT_SIZE, TEST_LOCATION );
-
- TextStyle style = actor.GetTextStyle();
- DALI_TEST_EQUALS( style.GetFontName(), FONT_FAMILY, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetFontStyle(), FONT_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetFontPointSize(), FONT_POINT_SIZE, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextActorSetFontDetection(void)
-{
- TestApplication application;
-
- TextActor actor = TextActor::New(TestTextHello);
-
- actor.SetFontDetectionAutomatic( true );
-
- DALI_TEST_CHECK( true == actor.IsFontDetectionAutomatic() );
-
- END_TEST;
-}
-
-int UtcDaliTextActorSetTextIndividualStyles(void)
-{
- TestApplication application;
-
- TextActor actor = TextActor::New(TestTextHello);
- TextStyle defaultStyle = actor.GetTextStyle();
-
- DALI_TEST_EQUALS( actor.GetTextColor(), TextStyle::DEFAULT_TEXT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetTextColor(), TextStyle::DEFAULT_TEXT_COLOR, TEST_LOCATION );
-
- DALI_TEST_EQUALS( actor.GetWeight(), TextStyle::DEFAULT_FONT_WEIGHT, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetWeight(), TextStyle::DEFAULT_FONT_WEIGHT, TEST_LOCATION );
-
- DALI_TEST_EQUALS( defaultStyle.GetSmoothEdge(), TextStyle::DEFAULT_SMOOTH_EDGE_DISTANCE_FIELD, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( !actor.GetItalics() );
- DALI_TEST_EQUALS( actor.GetItalicsAngle(), TextStyle::DEFAULT_ITALICS_ANGLE, TEST_LOCATION );
- DALI_TEST_CHECK( defaultStyle.IsItalicsDefault() );
- DALI_TEST_CHECK( !defaultStyle.IsItalicsEnabled() );
- DALI_TEST_EQUALS( defaultStyle.GetItalicsAngle(), TextStyle::DEFAULT_ITALICS_ANGLE, TEST_LOCATION );
-
- DALI_TEST_CHECK( !actor.GetUnderline() );
- DALI_TEST_CHECK( defaultStyle.IsUnderlineDefault() );
- DALI_TEST_CHECK( !defaultStyle.IsUnderlineEnabled() );
- DALI_TEST_EQUALS( defaultStyle.GetUnderlinePosition(), TextStyle::DEFAULT_UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetUnderlineThickness(), TextStyle::DEFAULT_UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( defaultStyle.IsShadowDefault() );
- DALI_TEST_CHECK( !defaultStyle.IsShadowEnabled() );
- DALI_TEST_EQUALS( defaultStyle.GetShadowColor(), TextStyle::DEFAULT_SHADOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetShadowOffset(), TextStyle::DEFAULT_SHADOW_OFFSET, TEST_LOCATION );
-
- DALI_TEST_CHECK( defaultStyle.IsGlowDefault() );
- DALI_TEST_CHECK( !defaultStyle.IsGlowEnabled() );
- DALI_TEST_EQUALS( defaultStyle.GetGlowColor(), TextStyle::DEFAULT_GLOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetGlowIntensity(), TextStyle::DEFAULT_GLOW_INTENSITY, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( defaultStyle.IsOutlineDefault() );
- DALI_TEST_CHECK( !defaultStyle.IsOutlineEnabled() );
- DALI_TEST_EQUALS( defaultStyle.GetOutlineColor(), TextStyle::DEFAULT_OUTLINE_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetOutlineThickness(), TextStyle::DEFAULT_OUTLINE_THICKNESS, TEST_LOCATION );
-
- DALI_TEST_CHECK( defaultStyle.IsGradientDefault() );
- DALI_TEST_CHECK( !defaultStyle.IsGradientEnabled() );
- DALI_TEST_EQUALS( defaultStyle.GetGradientColor(), TextStyle::DEFAULT_GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetGradientStartPoint(), TextStyle::DEFAULT_GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetGradientEndPoint(), TextStyle::DEFAULT_GRADIENT_END_POINT, TEST_LOCATION );
-
-
- actor.SetTextColor( TEXT_COLOR );
-
- actor.SetWeight( TEXT_WEIGHT );
- actor.SetSmoothEdge( SMOOTH_EDGE );
-
- actor.SetItalics( ITALICS, ITALICS_ANGLE );
- actor.SetUnderline( UNDERLINE );
-
- actor.SetShadow( SHADOW, SHADOW_COLOR, SHADOW_OFFSET, SHADOW_SIZE );
- actor.SetGlow( GLOW, GLOW_COLOR, GLOW_INTENSITY );
- actor.SetOutline( OUTLINE, OUTLINE_COLOR, OUTLINE_THICKNESS );
- actor.SetGradientColor( GRADIENT_COLOR );
- actor.SetGradientStartPoint( GRADIENT_START_POINT );
- actor.SetGradientEndPoint( GRADIENT_END_POINT );
-
-
- TextStyle style = actor.GetTextStyle();
-
- DALI_TEST_EQUALS( actor.GetTextColor(), TEXT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetTextColor(), TEXT_COLOR, TEST_LOCATION );
-
- DALI_TEST_EQUALS( actor.GetWeight(), TEXT_WEIGHT, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetWeight(), TEXT_WEIGHT, TEST_LOCATION );
-
- DALI_TEST_EQUALS( style.GetSmoothEdge(), SMOOTH_EDGE, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( actor.GetItalics() );
- DALI_TEST_EQUALS( actor.GetItalicsAngle(), ITALICS_ANGLE, TEST_LOCATION );
- DALI_TEST_CHECK( !style.IsItalicsDefault() );
- DALI_TEST_CHECK( style.IsItalicsEnabled() );
- DALI_TEST_EQUALS( style.GetItalicsAngle(), ITALICS_ANGLE, TEST_LOCATION );
-
- DALI_TEST_CHECK( actor.GetUnderline() );
- DALI_TEST_CHECK( !style.IsUnderlineDefault() );
- DALI_TEST_CHECK( style.IsUnderlineEnabled() );
- DALI_TEST_EQUALS( style.GetUnderlinePosition(), TextStyle::DEFAULT_UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetUnderlineThickness(), TextStyle::DEFAULT_UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style.IsShadowDefault() );
- DALI_TEST_CHECK( style.IsShadowEnabled() );
- DALI_TEST_EQUALS( style.GetShadowColor(), SHADOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetShadowOffset(), SHADOW_OFFSET, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style.IsGlowDefault() );
- DALI_TEST_CHECK( style.IsGlowEnabled() );
- DALI_TEST_EQUALS( style.GetGlowColor(), GLOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetGlowIntensity(), GLOW_INTENSITY, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style.IsOutlineDefault() );
- DALI_TEST_CHECK( style.IsOutlineEnabled() );
- DALI_TEST_EQUALS( style.GetOutlineColor(), OUTLINE_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetOutlineThickness(), OUTLINE_THICKNESS, TEST_LOCATION );
-
- DALI_TEST_EQUALS( actor.GetGradientColor(), GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetGradientStartPoint(), GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetGradientEndPoint(), GRADIENT_END_POINT, TEST_LOCATION );
- DALI_TEST_CHECK( !style.IsGradientDefault() );
- DALI_TEST_CHECK( style.IsGradientEnabled() );
- DALI_TEST_EQUALS( style.GetGradientColor(), GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetGradientStartPoint(), GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetGradientEndPoint(), GRADIENT_END_POINT, TEST_LOCATION );
-
- // Added to increase coverage.
-
- // Set a different color.
- actor.SetTextColor( TEXT_COLOR );
- actor.SetTextColor( Color::GREEN );
- DALI_TEST_EQUALS( actor.GetTextColor(), Color::GREEN, TEST_LOCATION );
-
- // Set a different weight
- actor.SetWeight( TEXT_WEIGHT );
- actor.SetWeight( TextStyle::BOLD );
- DALI_TEST_EQUALS( actor.GetWeight(), TextStyle::BOLD, TEST_LOCATION );
-
- // Set a different smooth edge
- actor.SetSmoothEdge( SMOOTH_EDGE );
- actor.SetSmoothEdge( 1.f );
- DALI_TEST_EQUALS( actor.GetTextStyle().GetSmoothEdge(), 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- // Set different italic parameters
- actor.SetItalics( true, ITALICS_ANGLE );
- actor.SetItalics( false );
- DALI_TEST_CHECK( !actor.GetItalics() );
- actor.SetItalics( true, Degree( 15.f ) );
- DALI_TEST_EQUALS( actor.GetItalicsAngle(), Degree( 15.f ), TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextActorChangingText(void)
-{
- TestApplication application;
-
- TextActor actor = TextActor::New(TestTextHello);
- actor.SetSize(Vector3(200, 20, 0.0f));
- actor.SetPosition(20.0f, 400.0f, 40.0f);
- Stage::GetCurrent().Add(actor);
-
- tet_infoline("Testing Dali::TextActor::SetText() & Dali::TextActor::GetText()");
- actor.SetText(LongTestText);
- std::string text = actor.GetText();
- DALI_TEST_EQUALS(text, LongTestText, TEST_LOCATION);
-
- // do a render
- application.SendNotification();
- application.Render();
-
- // check that the size did not change
- DALI_TEST_EQUALS( Vector3(200, 20, 0.0f), actor.GetCurrentSize(), TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliTextActorGetLoadingState(void)
-{
- TestApplication application;
-
- TextActor actor = TextActor::New(TestTextHello);
-
- DALI_TEST_CHECK( ResourceLoading == actor.GetLoadingState());
-
- application.SendNotification();
- application.Render();
-
- DALI_TEST_CHECK( ResourceLoadingSucceeded == actor.GetLoadingState());
-
- END_TEST;
-}
-
-int UtcDaliTextActorSetItalics(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::TextActor::New()");
-
- TextActor actor = TextActor::New(TestTextHello);
-
- DALI_TEST_CHECK(actor);
-
- actor.SetItalics( true );
-
- DALI_TEST_CHECK( actor.GetItalics() );
-
- DALI_TEST_EQUALS( static_cast( Degree( actor.GetItalicsAngle() ) ), static_cast(TextStyle::DEFAULT_ITALICS_ANGLE), 0.0001f, TEST_LOCATION );
-
- actor.SetItalics( false );
-
- DALI_TEST_CHECK( ! actor.GetItalics() );
-
- // TODO: Implement a why on the glAbstraction to check if the geometry was created correctly
- END_TEST;
-}
-
-int UtcDaliTextActorSetUnderline(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::TextActor::SetUnderline()");
-
- TextActor actor = TextActor::New(TestTextHello);
-
- DALI_TEST_CHECK(actor);
-
- actor.SetUnderline( true );
-
- DALI_TEST_CHECK( actor.GetUnderline() );
-
- actor.SetUnderline( false );
-
- DALI_TEST_CHECK( ! actor.GetUnderline() );
-
- // TODO: Implement a why on the glAbstraction to check if the geometry was created correctly
- END_TEST;
-}
-
-int UtcDaliTextActorSetWeight(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::TextActor::SetWeight()");
-
- TextActor actor = TextActor::New(TestTextHello);
-
- DALI_TEST_CHECK(actor);
-
- actor.SetWeight( TextStyle::EXTRABOLD );
-
- DALI_TEST_CHECK( TextStyle::EXTRABOLD == actor.GetWeight() );
-
- actor.SetWeight( TextStyle::BOLD );
-
- DALI_TEST_CHECK( TextStyle::BOLD == actor.GetWeight() );
- END_TEST;
-}
-
-int UtcDaliTextActorSetStyle(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::TextActor::SetTextStyle()");
-
- TextActor actor = TextActor::New(TestTextHello);
-
- const TextStyle defaultStyle = actor.GetTextStyle();
-
- DALI_TEST_EQUALS( defaultStyle.GetFontName(), DEFAULT_NAME_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetFontStyle(), DEFAULT_NAME_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetFontPointSize(), DEFAULT_FONT_POINT_SIZE, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetTextColor(), TextStyle::DEFAULT_TEXT_COLOR, TEST_LOCATION );
-
- DALI_TEST_EQUALS( defaultStyle.GetWeight(), TextStyle::DEFAULT_FONT_WEIGHT, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetSmoothEdge(), TextStyle::DEFAULT_SMOOTH_EDGE_DISTANCE_FIELD, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( defaultStyle.IsItalicsDefault() );
- DALI_TEST_CHECK( !defaultStyle.IsItalicsEnabled() );
- DALI_TEST_EQUALS( defaultStyle.GetItalicsAngle(), TextStyle::DEFAULT_ITALICS_ANGLE, TEST_LOCATION );
-
- DALI_TEST_CHECK( defaultStyle.IsUnderlineDefault() );
- DALI_TEST_CHECK( !defaultStyle.IsUnderlineEnabled() );
- DALI_TEST_EQUALS( defaultStyle.GetUnderlinePosition(), TextStyle::DEFAULT_UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetUnderlineThickness(), TextStyle::DEFAULT_UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( defaultStyle.IsShadowDefault() );
- DALI_TEST_CHECK( !defaultStyle.IsShadowEnabled() );
- DALI_TEST_EQUALS( defaultStyle.GetShadowColor(), TextStyle::DEFAULT_SHADOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetShadowOffset(), TextStyle::DEFAULT_SHADOW_OFFSET, TEST_LOCATION );
-
- DALI_TEST_CHECK( defaultStyle.IsGlowDefault() );
- DALI_TEST_CHECK( !defaultStyle.IsGlowEnabled() );
- DALI_TEST_EQUALS( defaultStyle.GetGlowColor(), TextStyle::DEFAULT_GLOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetGlowIntensity(), TextStyle::DEFAULT_GLOW_INTENSITY, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( defaultStyle.IsOutlineDefault() );
- DALI_TEST_CHECK( !defaultStyle.IsOutlineEnabled() );
- DALI_TEST_EQUALS( defaultStyle.GetOutlineColor(), TextStyle::DEFAULT_OUTLINE_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetOutlineThickness(), TextStyle::DEFAULT_OUTLINE_THICKNESS, TEST_LOCATION );
-
- DALI_TEST_CHECK( defaultStyle.IsGradientDefault() );
- DALI_TEST_CHECK( !defaultStyle.IsGradientEnabled() );
- DALI_TEST_EQUALS( defaultStyle.GetGradientColor(), TextStyle::DEFAULT_GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetGradientStartPoint(), TextStyle::DEFAULT_GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetGradientEndPoint(), TextStyle::DEFAULT_GRADIENT_END_POINT, TEST_LOCATION );
-
-
- // Set a non default style.
-
- TextStyle style;
- style.SetFontName( FONT_FAMILY );
- style.SetFontStyle( FONT_STYLE );
- style.SetFontPointSize( FONT_POINT_SIZE );
- style.SetTextColor( TEXT_COLOR );
-
- style.SetWeight( TEXT_WEIGHT );
- style.SetSmoothEdge( SMOOTH_EDGE );
-
- style.SetItalics( ITALICS, ITALICS_ANGLE );
- style.SetUnderline( UNDERLINE, UNDERLINE_THICKNESS, UNDERLINE_POSITION );
-
- style.SetShadow( SHADOW, SHADOW_COLOR, SHADOW_OFFSET, SHADOW_SIZE );
- style.SetGlow( GLOW, GLOW_COLOR, GLOW_INTENSITY );
- style.SetOutline( OUTLINE, OUTLINE_COLOR, OUTLINE_THICKNESS );
- style.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
-
- actor.SetTextStyle( style );
-
- // This is necessary since SetColor (via TextStyle) is asynchronous
- application.SendNotification();
- application.Render();
-
- TextStyle style2 = actor.GetTextStyle();
-
- DALI_TEST_CHECK( !style2.IsFontNameDefault() );
- DALI_TEST_CHECK( !style2.IsFontStyleDefault() );
- DALI_TEST_CHECK( !style2.IsFontSizeDefault() );
- DALI_TEST_CHECK( !style2.IsTextColorDefault() );
- DALI_TEST_CHECK( !style2.IsFontWeightDefault() );
- DALI_TEST_CHECK( !style2.IsSmoothEdgeDefault() );
- DALI_TEST_CHECK( !style2.IsItalicsDefault() );
- DALI_TEST_CHECK( !style2.IsUnderlineDefault() );
- DALI_TEST_CHECK( !style2.IsShadowDefault() );
- DALI_TEST_CHECK( !style2.IsGlowDefault() );
- DALI_TEST_CHECK( !style2.IsOutlineDefault() );
- DALI_TEST_CHECK( !style2.IsGradientDefault() );
-
- DALI_TEST_EQUALS( style2.GetFontName(), FONT_FAMILY, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetFontStyle(), FONT_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetFontPointSize(), FONT_POINT_SIZE, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetTextColor(), TEXT_COLOR, TEST_LOCATION );
-
- DALI_TEST_EQUALS( style2.GetWeight(), TEXT_WEIGHT, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetSmoothEdge(), SMOOTH_EDGE, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( style2.IsItalicsEnabled() );
- DALI_TEST_EQUALS( style2.GetItalicsAngle(), ITALICS_ANGLE, TEST_LOCATION );
-
- DALI_TEST_CHECK( style2.IsUnderlineEnabled() );
- DALI_TEST_EQUALS( style2.GetUnderlineThickness(), UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetUnderlinePosition(), UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( style2.IsShadowEnabled() );
- DALI_TEST_EQUALS( style2.GetShadowColor(), SHADOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetShadowOffset(), SHADOW_OFFSET, TEST_LOCATION );
-
- DALI_TEST_CHECK( style2.IsGlowEnabled() );
- DALI_TEST_EQUALS( style2.GetGlowColor(), GLOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGlowIntensity(), GLOW_INTENSITY, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( style2.IsOutlineEnabled() );
- DALI_TEST_EQUALS( style2.GetOutlineColor(), OUTLINE_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetOutlineThickness(), OUTLINE_THICKNESS, TEST_LOCATION );
-
- DALI_TEST_CHECK( style2.IsGradientEnabled() );
- DALI_TEST_EQUALS( style2.GetGradientColor(), GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGradientStartPoint(), GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGradientEndPoint(), GRADIENT_END_POINT, TEST_LOCATION );
-
-
- // Set a default style
- actor.SetTextStyle( defaultStyle );
-
- TextStyle style3 = actor.GetTextStyle();
-
- DALI_TEST_EQUALS( style3.GetFontName(), DEFAULT_NAME_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( style3.GetFontStyle(), DEFAULT_NAME_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( style3.GetFontPointSize(), DEFAULT_FONT_POINT_SIZE, TEST_LOCATION );
- DALI_TEST_EQUALS( style3.GetTextColor(), TextStyle::DEFAULT_TEXT_COLOR, TEST_LOCATION );
-
- DALI_TEST_EQUALS( style3.GetWeight(), TextStyle::DEFAULT_FONT_WEIGHT, TEST_LOCATION );
- DALI_TEST_EQUALS( style3.GetSmoothEdge(), TextStyle::DEFAULT_SMOOTH_EDGE_DISTANCE_FIELD, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( style3.IsItalicsDefault() );
- DALI_TEST_CHECK( !style3.IsItalicsEnabled() );
- DALI_TEST_EQUALS( style3.GetItalicsAngle(), TextStyle::DEFAULT_ITALICS_ANGLE, TEST_LOCATION );
-
- DALI_TEST_CHECK( style3.IsUnderlineDefault() );
- DALI_TEST_CHECK( !style3.IsUnderlineEnabled() );
- DALI_TEST_EQUALS( style3.GetUnderlinePosition(), TextStyle::DEFAULT_UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( style3.GetUnderlineThickness(), TextStyle::DEFAULT_UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( style3.IsShadowDefault() );
- DALI_TEST_CHECK( !style3.IsShadowEnabled() );
- DALI_TEST_EQUALS( style3.GetShadowColor(), TextStyle::DEFAULT_SHADOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style3.GetShadowOffset(), TextStyle::DEFAULT_SHADOW_OFFSET, TEST_LOCATION );
-
- DALI_TEST_CHECK( style3.IsGlowDefault() );
- DALI_TEST_CHECK( !style3.IsGlowEnabled() );
- DALI_TEST_EQUALS( style3.GetGlowColor(), TextStyle::DEFAULT_GLOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style3.GetGlowIntensity(), TextStyle::DEFAULT_GLOW_INTENSITY, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( style3.IsOutlineDefault() );
- DALI_TEST_CHECK( !style3.IsOutlineEnabled() );
- DALI_TEST_EQUALS( style3.GetOutlineColor(), TextStyle::DEFAULT_OUTLINE_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style3.GetOutlineThickness(), TextStyle::DEFAULT_OUTLINE_THICKNESS, TEST_LOCATION );
-
- DALI_TEST_CHECK( style3.IsGradientDefault() );
- DALI_TEST_CHECK( !style3.IsGradientEnabled() );
- DALI_TEST_EQUALS( style3.GetGradientColor(), TextStyle::DEFAULT_GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style3.GetGradientStartPoint(), TextStyle::DEFAULT_GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( style3.GetGradientEndPoint(), TextStyle::DEFAULT_GRADIENT_END_POINT, TEST_LOCATION );
-
- // Added to increase coverage.
- // Reset what is already reset.
-
- actor.SetTextStyle( style3 );
-
- TextStyle style4 = actor.GetTextStyle();
-
- DALI_TEST_EQUALS( style4.GetFontName(), DEFAULT_NAME_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( style4.GetFontStyle(), DEFAULT_NAME_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( style4.GetFontPointSize(), DEFAULT_FONT_POINT_SIZE, TEST_LOCATION );
- DALI_TEST_EQUALS( style4.GetTextColor(), TextStyle::DEFAULT_TEXT_COLOR, TEST_LOCATION );
-
- DALI_TEST_EQUALS( style4.GetWeight(), TextStyle::DEFAULT_FONT_WEIGHT, TEST_LOCATION );
- DALI_TEST_EQUALS( style4.GetSmoothEdge(), TextStyle::DEFAULT_SMOOTH_EDGE_DISTANCE_FIELD, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( style4.IsItalicsDefault() );
- DALI_TEST_CHECK( !style4.IsItalicsEnabled() );
- DALI_TEST_EQUALS( style4.GetItalicsAngle(), TextStyle::DEFAULT_ITALICS_ANGLE, TEST_LOCATION );
-
- DALI_TEST_CHECK( style4.IsUnderlineDefault() );
- DALI_TEST_CHECK( !style4.IsUnderlineEnabled() );
- DALI_TEST_EQUALS( style4.GetUnderlinePosition(), TextStyle::DEFAULT_UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( style4.GetUnderlineThickness(), TextStyle::DEFAULT_UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( style4.IsShadowDefault() );
- DALI_TEST_CHECK( !style4.IsShadowEnabled() );
- DALI_TEST_EQUALS( style4.GetShadowColor(), TextStyle::DEFAULT_SHADOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style4.GetShadowOffset(), TextStyle::DEFAULT_SHADOW_OFFSET, TEST_LOCATION );
-
- DALI_TEST_CHECK( style4.IsGlowDefault() );
- DALI_TEST_CHECK( !style4.IsGlowEnabled() );
- DALI_TEST_EQUALS( style4.GetGlowColor(), TextStyle::DEFAULT_GLOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style4.GetGlowIntensity(), TextStyle::DEFAULT_GLOW_INTENSITY, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( style4.IsOutlineDefault() );
- DALI_TEST_CHECK( !style4.IsOutlineEnabled() );
- DALI_TEST_EQUALS( style4.GetOutlineColor(), TextStyle::DEFAULT_OUTLINE_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style4.GetOutlineThickness(), TextStyle::DEFAULT_OUTLINE_THICKNESS, TEST_LOCATION );
-
- DALI_TEST_CHECK( style4.IsGradientDefault() );
- DALI_TEST_CHECK( !style4.IsGradientEnabled() );
- DALI_TEST_EQUALS( style4.GetGradientColor(), TextStyle::DEFAULT_GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style4.GetGradientStartPoint(), TextStyle::DEFAULT_GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( style4.GetGradientEndPoint(), TextStyle::DEFAULT_GRADIENT_END_POINT, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextActorDefaultProperties(void)
-{
- TestApplication application;
- tet_infoline("Testing Dali::TextActor DefaultProperties");
-
- TextActor actor = TextActor::New("@");
-
- std::vector indices ;
- indices.push_back(TextActor::TEXT );
- indices.push_back(TextActor::FONT );
- indices.push_back(TextActor::FONT_STYLE );
- indices.push_back(TextActor::OUTLINE_ENABLE );
- indices.push_back(TextActor::OUTLINE_COLOR );
- indices.push_back(TextActor::OUTLINE_THICKNESS_WIDTH );
- indices.push_back(TextActor::SMOOTH_EDGE );
- indices.push_back(TextActor::GLOW_ENABLE );
- indices.push_back(TextActor::GLOW_COLOR );
- indices.push_back(TextActor::GLOW_INTENSITY );
- indices.push_back(TextActor::SHADOW_ENABLE );
- indices.push_back(TextActor::SHADOW_COLOR );
- indices.push_back(TextActor::SHADOW_OFFSET );
- indices.push_back(TextActor::ITALICS_ANGLE );
- indices.push_back(TextActor::UNDERLINE );
- indices.push_back(TextActor::WEIGHT );
- indices.push_back(TextActor::FONT_DETECTION_AUTOMATIC );
- indices.push_back(TextActor::GRADIENT_COLOR );
- indices.push_back(TextActor::GRADIENT_START_POINT );
- indices.push_back(TextActor::GRADIENT_END_POINT );
- indices.push_back(TextActor::SHADOW_SIZE );
- indices.push_back(TextActor::TEXT_COLOR );
-
- DALI_TEST_CHECK(actor.GetPropertyCount() == ( Actor::New().GetPropertyCount() + indices.size() ) );
-
- for(std::vector::iterator iter = indices.begin(); iter != indices.end(); ++iter)
- {
- DALI_TEST_CHECK( *iter == actor.GetPropertyIndex(actor.GetPropertyName(*iter)) );
- DALI_TEST_CHECK( actor.IsPropertyWritable(*iter) );
- DALI_TEST_CHECK( !actor.IsPropertyAnimatable(*iter) );
- DALI_TEST_CHECK( actor.GetPropertyType(*iter) == actor.GetPropertyType(*iter) ); // just checking call succeeds
- }
-
- // set/get one of them
- actor.SetUnderline(false);
- DALI_TEST_CHECK(actor.GetUnderline() != true);
-
- actor.SetProperty(TextActor::UNDERLINE, Property::Value(true));
- Property::Value v = actor.GetProperty(TextActor::UNDERLINE);
- DALI_TEST_CHECK(v.GetType() == Property::BOOLEAN);
-
- DALI_TEST_CHECK(v.Get() == true);
- END_TEST;
-}
-
-int UtcDaliTextActorSetGradientColor(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::TextActor::SetGradientColor()");
-
- TextActor actor = TextActor::New(TestTextHello);
-
- DALI_TEST_CHECK(actor);
-
- actor.SetGradientColor( Color::RED );
- DALI_TEST_EQUALS( actor.GetGradientColor(), Color::RED, TEST_LOCATION );
-
- actor.SetGradientColor( Color::BLUE );
- DALI_TEST_EQUALS( actor.GetGradientColor(), Color::BLUE, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliTextActorSetGradientStartPoint(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::TextActor::SetGradientStartPoint()");
-
- TextActor actor = TextActor::New(TestTextHello);
-
- DALI_TEST_CHECK(actor);
-
- actor.SetGradientStartPoint( Vector2(0.5f, 0.5f) );
- DALI_TEST_EQUALS( actor.GetGradientStartPoint(), Vector2(0.5f, 0.5f), TEST_LOCATION );
-
- actor.SetGradientStartPoint( Vector2(1.0f, 0.0f) );
- DALI_TEST_EQUALS( actor.GetGradientStartPoint(), Vector2(1.0f, 0.0f), TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliTextActorSetGradientEndPoint(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::TextActor::SetGradientEndPoint()");
-
- TextActor actor = TextActor::New(TestTextHello);
-
- DALI_TEST_CHECK(actor);
-
- actor.SetGradientEndPoint( Vector2(0.25f, 0.25f) );
- DALI_TEST_EQUALS( actor.GetGradientEndPoint(), Vector2(0.25f, 0.25f), TEST_LOCATION );
-
- actor.SetGradientEndPoint( Vector2(0.0f, 1.0f) );
- DALI_TEST_EQUALS( actor.GetGradientEndPoint(), Vector2(0.0f, 1.0f), TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliTextActorSynchronousGlyphLoading(void)
-{
- TestApplication application;
-
- tet_infoline( "Testing synchronous loading of glyphs");
-
- // All numerals 0 through 9 are 'fake' cached in the test abstraction glyphcache
-
- // create text actor containg "Hello"
- TextActor actor = TextActor::New(TestTextHello);
-
- // no glyphs will be cached
-
- // so..GetGlyphData should have been called to gather metrics
- DALI_TEST_CHECK( application.GetPlatform().GetTrace().FindMethodAndParams( "GetGlyphData", "getBitmap:false" ) );
- // ..but not to load glyph bitmap data
- DALI_TEST_CHECK( ! application.GetPlatform().GetTrace().FindMethodAndParams( "GetGlyphData", "getBitmap:true" ) );
- // ..also, cached high quality glyphs will not have been requested yet
- DALI_TEST_CHECK( ! application.GetPlatform().WasCalled(TestPlatformAbstraction::GetCachedGlyphDataFunc) );
-
- // reset PlatformAbstraction function call traces
- application.GetPlatform().ResetTrace();
-
- // Invoke Core::ProcessEvent and tick the update/render threads
- application.SendNotification();
- application.Render();
-
- // An attempt to load high quality glyphs will have been requested and loaded nothing
- DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::GetCachedGlyphDataFunc) );
- // low quality glyphs bitmap data will have now been generated
- DALI_TEST_CHECK( application.GetPlatform().GetTrace().FindMethodAndParams( "GetGlyphData", "getBitmap:true" ) );
-
- // request numerals
- actor.SetText( "0123456789" );
-
- // reset PlatformAbstraction function call traces
- application.GetPlatform().ResetTrace();
-
- application.SendNotification();
- application.Render();
-
- // An attempt to load high quality glyphs will have been requested and loaded all the numerals
- DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::GetCachedGlyphDataFunc) );
- // ..therefore no low quality glyphs bitmap data will have been requested
- DALI_TEST_CHECK( !application.GetPlatform().GetTrace().FindMethodAndParams( "GetGlyphData", "getBitmap:true" ) );
- END_TEST;
-}
-
-int UtcDaliTextActorAutomaticSizeSet(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::TextActor getting size based on text automatically");
-
- // create empty text actor
- TextActor actor = TextActor::New();
- Stage::GetCurrent().Add(actor);
-
- // initial size is zero
- DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentSize(), TEST_LOCATION );
-
- // set some text
- actor.SetText( "a" );
- // render a frame
- application.SendNotification();
- application.Render();
-
- // dont care about the actual size as that is too hard to figure out, just want to validate that the size was changed to bigger
- Vector3 currentSize = actor.GetCurrentSize();
- DALI_TEST_GREATER( currentSize.width, 0.0f, TEST_LOCATION );
- DALI_TEST_GREATER( currentSize.height, 0.0f, TEST_LOCATION );
-
- // set some more text
- actor.SetText( "abba" );
- // render a frame
- application.SendNotification();
- application.Render();
-
- Vector3 biggerSize = actor.GetCurrentSize();
- DALI_TEST_GREATER( biggerSize.width, currentSize.width, TEST_LOCATION );
-
- // set some shorter text
- actor.SetText( "i" );
- // render a frame
- application.SendNotification();
- application.Render();
-
- // actor has shrunk
- DALI_TEST_GREATER( biggerSize.width, actor.GetCurrentSize().width, TEST_LOCATION );
-
- // set a size from application side, from this point onwards text actor no longer uses the "natural" size of the text
- actor.SetSize( Vector2( 10.0f, 11.0f ) );
- // render a frame
- application.SendNotification();
- application.Render();
- // actor has the user set size
- DALI_TEST_EQUALS( Vector2( 10.0f, 11.0f ), actor.GetCurrentSize().GetVectorXY(), TEST_LOCATION );
-
- // set some different text
- std::string longText( "jabba dabba duu" );
- actor.SetText( longText );
- // render a frame
- application.SendNotification();
- application.Render();
- // actor still has the user set size
- DALI_TEST_EQUALS( Vector2( 10.0f, 11.0f ), actor.GetCurrentSize().GetVectorXY(), TEST_LOCATION );
-
- // set text to its natural size
- actor.SetToNaturalSize();
- // render a frame
- application.SendNotification();
- application.Render();
- // actor has the natural size
- Font defaultFont = Font::New();
- Vector3 naturalSize = defaultFont.MeasureText( longText );
- DALI_TEST_EQUALS( naturalSize.GetVectorXY(), actor.GetCurrentSize().GetVectorXY(), TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliTextActorAutomaticSizeSetAnimation(void)
-{
- TestApplication application;
-
- tet_infoline("Testing Dali::TextActor getting size based on text automatically with animation");
-
- // create empty text actor
- TextActor actor = TextActor::New();
- Stage::GetCurrent().Add(actor);
-
- // initial size is zero
- DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentSize(), TEST_LOCATION );
-
- // set some text
- actor.SetText( "a" );
- // render a frame
- application.SendNotification();
- application.Render();
-
- // dont care about the actual size as that is too hard to figure out, just want to validate that the size was changed to bigger
- Vector3 currentSize = actor.GetCurrentSize();
- DALI_TEST_GREATER( currentSize.width, 0.0f, TEST_LOCATION );
- DALI_TEST_GREATER( currentSize.height, 0.0f, TEST_LOCATION );
-
- // animate size, from this point onwards text actor no longer uses the "natural" size of the text
- Animation sizeAnim = Animation::New( 0.1f ); // 0.1 seconds
- Vector3 animationTargetSize( 20.0f, 30.0f, 0.0f );
- sizeAnim.AnimateTo( Property( actor, Actor::SIZE ), animationTargetSize );
- sizeAnim.Play();
-
- // set some more text
- actor.SetText( "abba" );
- // render a frame
- application.SendNotification();
- application.Render( 1000 ); // 1 second to complete the animation
-
- DALI_TEST_EQUALS( animationTargetSize, actor.GetCurrentSize(), TEST_LOCATION );
-
- // set some more text
- std::string moreText( "something else" );
- actor.SetText( moreText );
- // render a frame
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( animationTargetSize, actor.GetCurrentSize(), TEST_LOCATION );
-
- // set text to its natural size
- actor.SetToNaturalSize();
- // render a frame
- application.SendNotification();
- application.Render();
- // actor has the natural size
- Font defaultFont = Font::New();
- Vector3 naturalSize = defaultFont.MeasureText( moreText );
- DALI_TEST_EQUALS( naturalSize.GetVectorXY(), actor.GetCurrentSize().GetVectorXY(), TEST_LOCATION );
- END_TEST;
-}
-
-
-int UtcDaliTextActorPropertyIndices(void)
-{
- TestApplication application;
- Actor basicActor = Actor::New();
- TextActor textActor = TextActor::New("Text");
-
- Property::IndexContainer indices;
- textActor.GetPropertyIndices( indices );
- DALI_TEST_CHECK( indices.size() > basicActor.GetPropertyCount() );
- DALI_TEST_EQUALS( indices.size(), textActor.GetPropertyCount(), TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliTextActorGetNaturalSize(void)
-{
- TestApplication application;
-
- TextActor actor = TextActor::New();
- std::string text( "something else" );
- actor.SetText( text );
-
- Font defaultFont = Font::New();
- Vector3 naturalSize = defaultFont.MeasureText( text );
-
- DALI_TEST_CHECK( actor.GetNaturalSize().GetVectorXY() == naturalSize.GetVectorXY() );
-
- END_TEST;
-}
diff --git a/automated-tests/src/dali/utc-Dali-TextStyle.cpp b/automated-tests/src/dali/utc-Dali-TextStyle.cpp
deleted file mode 100644
index 82c750f..0000000
--- a/automated-tests/src/dali/utc-Dali-TextStyle.cpp
+++ /dev/null
@@ -1,1500 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include
-
-#include
-#include
-#include
-
-using namespace Dali;
-
-void utc_dali_text_style_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_text_style_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-namespace
-{
-static const std::string DEFAULT_FONT_NAME_STYLE( "" );
-static const PointSize DEFAULT_FONT_POINT_SIZE( 0.f );
-
-static const std::string FONT_FAMILY( "Arial" );
-static const std::string FONT_STYLE( "Bold" );
-static const PointSize FONT_POINT_SIZE( 12.f );
-static const Vector4 TEXT_COLOR( Color::RED );
-
-static const TextStyle::Weight TEXT_WEIGHT( TextStyle::EXTRALIGHT );
-static const float SMOOTH_EDGE( 5.0f );
-
-static const bool ITALICS( true );
-static const Degree ITALICS_ANGLE( 10.f );
-
-static const bool UNDERLINE( true );
-static const float UNDERLINE_THICKNESS( 5.0f );
-static const float UNDERLINE_POSITION( 60.0f );
-
-static const bool SHADOW( true );
-static const Vector4 SHADOW_COLOR( Color::BLUE );
-static const Vector2 SHADOW_OFFSET( 2.f, 2.f );
-static const float SHADOW_SIZE( 55.f );
-
-static const bool GLOW( true );
-static const Vector4 GLOW_COLOR( Color::BLACK );
-static const float GLOW_INTENSITY( 10.0f );
-
-static const bool OUTLINE( true );
-static const Vector4 OUTLINE_COLOR( Color::MAGENTA );
-static const Vector2 OUTLINE_THICKNESS( 15.f, 14.f );
-
-static const bool GRADIENT( true );
-static const Vector4 GRADIENT_COLOR( Color::YELLOW );
-static const Vector2 GRADIENT_START_POINT( 1.f, 1.f );
-static const Vector2 GRADIENT_END_POINT( 2.f, 2.f );
-} // anon namespace
-
-int UtcDaliTextStyleDefaultConstructor(void)
-{
- tet_infoline(" UtcDaliTextStyleDefaultConstructor ");
-
- TestApplication application;
-
- TextStyle defaultStyle;
-
- DALI_TEST_CHECK( defaultStyle.IsFontNameDefault() );
- DALI_TEST_CHECK( defaultStyle.IsFontStyleDefault() );
- DALI_TEST_CHECK( defaultStyle.IsFontSizeDefault() );
- DALI_TEST_CHECK( defaultStyle.IsTextColorDefault() );
- DALI_TEST_CHECK( defaultStyle.IsFontWeightDefault() );
- DALI_TEST_CHECK( defaultStyle.IsSmoothEdgeDefault() );
- DALI_TEST_CHECK( defaultStyle.IsItalicsDefault() );
- DALI_TEST_CHECK( defaultStyle.IsUnderlineDefault() );
- DALI_TEST_CHECK( defaultStyle.IsShadowDefault() );
- DALI_TEST_CHECK( defaultStyle.IsGlowDefault() );
- DALI_TEST_CHECK( defaultStyle.IsOutlineDefault() );
- DALI_TEST_CHECK( defaultStyle.IsGradientDefault() );
-
- DALI_TEST_EQUALS( defaultStyle.GetFontName(), DEFAULT_FONT_NAME_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetFontStyle(), DEFAULT_FONT_NAME_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetFontPointSize(), DEFAULT_FONT_POINT_SIZE, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetTextColor(), TextStyle::DEFAULT_TEXT_COLOR, TEST_LOCATION );
-
- DALI_TEST_EQUALS( defaultStyle.GetWeight(), TextStyle::DEFAULT_FONT_WEIGHT, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetSmoothEdge(), TextStyle::DEFAULT_SMOOTH_EDGE_DISTANCE_FIELD, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( !defaultStyle.IsItalicsEnabled() );
- DALI_TEST_EQUALS( defaultStyle.GetItalicsAngle(), TextStyle::DEFAULT_ITALICS_ANGLE, TEST_LOCATION );
-
- DALI_TEST_CHECK( !defaultStyle.IsUnderlineEnabled() );
- DALI_TEST_EQUALS( defaultStyle.GetUnderlineThickness(), TextStyle::DEFAULT_UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetUnderlinePosition(), TextStyle::DEFAULT_UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( !defaultStyle.IsShadowEnabled() );
- DALI_TEST_EQUALS( defaultStyle.GetShadowColor(), TextStyle::DEFAULT_SHADOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetShadowOffset(), TextStyle::DEFAULT_SHADOW_OFFSET, TEST_LOCATION );
-
- DALI_TEST_CHECK( !defaultStyle.IsGlowEnabled() );
- DALI_TEST_EQUALS( defaultStyle.GetGlowColor(), TextStyle::DEFAULT_GLOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetGlowIntensity(), TextStyle::DEFAULT_GLOW_INTENSITY, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( !defaultStyle.IsOutlineEnabled() );
- DALI_TEST_EQUALS( defaultStyle.GetOutlineColor(), TextStyle::DEFAULT_OUTLINE_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetOutlineThickness(), TextStyle::DEFAULT_OUTLINE_THICKNESS, TEST_LOCATION );
-
- DALI_TEST_CHECK( !defaultStyle.IsGradientEnabled() );
- DALI_TEST_EQUALS( defaultStyle.GetGradientColor(), TextStyle::DEFAULT_GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetGradientStartPoint(), TextStyle::DEFAULT_GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultStyle.GetGradientEndPoint(), TextStyle::DEFAULT_GRADIENT_END_POINT, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextStyleCopyConstructor(void)
-{
- tet_infoline(" UtcDaliTextStyleCopyConstructor ");
-
- TestApplication application;
-
- TextStyle style;
- style.SetFontName( FONT_FAMILY );
- style.SetFontStyle( FONT_STYLE );
- style.SetFontPointSize( FONT_POINT_SIZE );
- style.SetTextColor( TEXT_COLOR );
-
- style.SetWeight( TEXT_WEIGHT );
- style.SetSmoothEdge( SMOOTH_EDGE );
-
- style.SetItalics( ITALICS, ITALICS_ANGLE );
- style.SetUnderline( UNDERLINE, UNDERLINE_THICKNESS, UNDERLINE_POSITION );
- style.SetShadow( SHADOW, SHADOW_COLOR, SHADOW_OFFSET, SHADOW_SIZE );
- style.SetGlow( GLOW, GLOW_COLOR, GLOW_INTENSITY );
- style.SetOutline( OUTLINE, OUTLINE_COLOR, OUTLINE_THICKNESS );
- style.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
-
- TextStyle style1( style );
- TextStyle style2 = style;
-
- DALI_TEST_CHECK( !style1.IsFontNameDefault() );
- DALI_TEST_CHECK( !style1.IsFontStyleDefault() );
- DALI_TEST_CHECK( !style1.IsFontSizeDefault() );
- DALI_TEST_CHECK( !style1.IsTextColorDefault() );
- DALI_TEST_CHECK( !style1.IsFontWeightDefault() );
- DALI_TEST_CHECK( !style1.IsSmoothEdgeDefault() );
- DALI_TEST_CHECK( !style1.IsItalicsDefault() );
- DALI_TEST_CHECK( !style1.IsUnderlineDefault() );
- DALI_TEST_CHECK( !style1.IsShadowDefault() );
- DALI_TEST_CHECK( !style1.IsGlowDefault() );
- DALI_TEST_CHECK( !style1.IsOutlineDefault() );
- DALI_TEST_CHECK( !style1.IsGradientDefault() );
-
- DALI_TEST_EQUALS( style1.GetFontName(), FONT_FAMILY, TEST_LOCATION );
- DALI_TEST_EQUALS( style1.GetFontStyle(), FONT_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( style1.GetFontPointSize(), FONT_POINT_SIZE, TEST_LOCATION );
- DALI_TEST_EQUALS( style1.GetTextColor(), TEXT_COLOR, TEST_LOCATION );
-
- DALI_TEST_EQUALS( style1.GetWeight(), TEXT_WEIGHT, TEST_LOCATION );
- DALI_TEST_EQUALS( style1.GetSmoothEdge(), SMOOTH_EDGE, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( style1.IsItalicsEnabled() );
- DALI_TEST_EQUALS( style1.GetItalicsAngle(), ITALICS_ANGLE, TEST_LOCATION );
-
- DALI_TEST_CHECK( style1.IsUnderlineEnabled() );
- DALI_TEST_EQUALS( style1.GetUnderlineThickness(), UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( style1.GetUnderlinePosition(), UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( style1.IsShadowEnabled() );
- DALI_TEST_EQUALS( style1.GetShadowColor(), SHADOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style1.GetShadowOffset(), SHADOW_OFFSET, TEST_LOCATION );
-
- DALI_TEST_CHECK( style1.IsGlowEnabled() );
- DALI_TEST_EQUALS( style1.GetGlowColor(), GLOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style1.GetGlowIntensity(), GLOW_INTENSITY, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( style1.IsOutlineEnabled() );
- DALI_TEST_EQUALS( style1.GetOutlineColor(), OUTLINE_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style1.GetOutlineThickness(), OUTLINE_THICKNESS, TEST_LOCATION );
-
- DALI_TEST_CHECK( style1.IsGradientEnabled() );
- DALI_TEST_EQUALS( style1.GetGradientColor(), GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style1.GetGradientStartPoint(), GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( style1.GetGradientEndPoint(), GRADIENT_END_POINT, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsFontNameDefault() );
- DALI_TEST_CHECK( !style2.IsFontStyleDefault() );
- DALI_TEST_CHECK( !style2.IsFontSizeDefault() );
- DALI_TEST_CHECK( !style2.IsTextColorDefault() );
- DALI_TEST_CHECK( !style2.IsFontWeightDefault() );
- DALI_TEST_CHECK( !style2.IsSmoothEdgeDefault() );
- DALI_TEST_CHECK( !style2.IsItalicsDefault() );
- DALI_TEST_CHECK( !style2.IsUnderlineDefault() );
- DALI_TEST_CHECK( !style2.IsShadowDefault() );
- DALI_TEST_CHECK( !style2.IsGlowDefault() );
- DALI_TEST_CHECK( !style2.IsOutlineDefault() );
- DALI_TEST_CHECK( !style2.IsGradientDefault() );
-
- DALI_TEST_EQUALS( style2.GetFontName(), FONT_FAMILY, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetFontStyle(), FONT_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetFontPointSize(), FONT_POINT_SIZE, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetTextColor(), TEXT_COLOR, TEST_LOCATION );
-
- DALI_TEST_EQUALS( style2.GetWeight(), TEXT_WEIGHT, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetSmoothEdge(), SMOOTH_EDGE, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( style2.IsItalicsEnabled() );
- DALI_TEST_EQUALS( style2.GetItalicsAngle(), ITALICS_ANGLE, TEST_LOCATION );
-
- DALI_TEST_CHECK( style2.IsUnderlineEnabled() );
- DALI_TEST_EQUALS( style2.GetUnderlineThickness(), UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetUnderlinePosition(), UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( style2.IsShadowEnabled() );
- DALI_TEST_EQUALS( style2.GetShadowColor(), SHADOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetShadowOffset(), SHADOW_OFFSET, TEST_LOCATION );
-
- DALI_TEST_CHECK( style2.IsGlowEnabled() );
- DALI_TEST_EQUALS( style2.GetGlowColor(), GLOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGlowIntensity(), GLOW_INTENSITY, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( style2.IsOutlineEnabled() );
- DALI_TEST_EQUALS( style2.GetOutlineColor(), OUTLINE_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetOutlineThickness(), OUTLINE_THICKNESS, TEST_LOCATION );
-
- DALI_TEST_CHECK( style2.IsGradientEnabled() );
- DALI_TEST_EQUALS( style2.GetGradientColor(), GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGradientStartPoint(), GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGradientEndPoint(), GRADIENT_END_POINT, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextStyleAssignmentOperator(void)
-{
- tet_infoline(" UtcDaliTextStyleAssignmentOperator ");
-
- TestApplication application;
-
- TextStyle style1;
- TextStyle style2;
-
- style1.SetFontName( FONT_FAMILY );
- style1.SetFontStyle( FONT_STYLE );
- style1.SetFontPointSize( FONT_POINT_SIZE );
- style1.SetTextColor( TEXT_COLOR );
-
- style1.SetWeight( TEXT_WEIGHT );
- style1.SetSmoothEdge( SMOOTH_EDGE );
-
- style1.SetItalics( ITALICS, ITALICS_ANGLE );
-
- style1.SetUnderline( UNDERLINE, UNDERLINE_THICKNESS, UNDERLINE_POSITION );
-
- style1.SetShadow( SHADOW, SHADOW_COLOR, SHADOW_OFFSET, SHADOW_SIZE );
- style1.SetGlow( GLOW, GLOW_COLOR, GLOW_INTENSITY );
- style1.SetOutline( OUTLINE, OUTLINE_COLOR, OUTLINE_THICKNESS );
- style1.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
-
- // Test the copy of all parameters.
- style2 = style1;
-
- DALI_TEST_CHECK( !style2.IsFontNameDefault() );
- DALI_TEST_CHECK( !style2.IsFontStyleDefault() );
- DALI_TEST_CHECK( !style2.IsFontSizeDefault() );
- DALI_TEST_CHECK( !style2.IsTextColorDefault() );
- DALI_TEST_CHECK( !style2.IsFontWeightDefault() );
- DALI_TEST_CHECK( !style2.IsSmoothEdgeDefault() );
- DALI_TEST_CHECK( !style2.IsItalicsDefault() );
- DALI_TEST_CHECK( !style2.IsUnderlineDefault() );
- DALI_TEST_CHECK( !style2.IsShadowDefault() );
- DALI_TEST_CHECK( !style2.IsGlowDefault() );
- DALI_TEST_CHECK( !style2.IsOutlineDefault() );
- DALI_TEST_CHECK( !style2.IsGradientDefault() );
-
- DALI_TEST_EQUALS( style2.GetFontName(), FONT_FAMILY, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetFontStyle(), FONT_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetFontPointSize(), FONT_POINT_SIZE, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetTextColor(), TEXT_COLOR, TEST_LOCATION );
-
- DALI_TEST_EQUALS( style2.GetWeight(), TEXT_WEIGHT, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetSmoothEdge(), SMOOTH_EDGE, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( style2.IsItalicsEnabled() );
- DALI_TEST_EQUALS( style2.GetItalicsAngle(), ITALICS_ANGLE, TEST_LOCATION );
-
- DALI_TEST_CHECK( style2.IsUnderlineEnabled() );
- DALI_TEST_EQUALS( style2.GetUnderlineThickness(), UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetUnderlinePosition(), UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( style2.IsShadowEnabled() );
- DALI_TEST_EQUALS( style2.GetShadowColor(), SHADOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetShadowOffset(), SHADOW_OFFSET, TEST_LOCATION );
-
- DALI_TEST_CHECK( style2.IsGlowEnabled() );
- DALI_TEST_EQUALS( style2.GetGlowColor(), GLOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGlowIntensity(), GLOW_INTENSITY, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( style2.IsOutlineEnabled() );
- DALI_TEST_EQUALS( style2.GetOutlineColor(), OUTLINE_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetOutlineThickness(), OUTLINE_THICKNESS, TEST_LOCATION );
-
- DALI_TEST_CHECK( style2.IsGradientEnabled() );
- DALI_TEST_EQUALS( style2.GetGradientColor(), GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGradientStartPoint(), GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGradientEndPoint(), GRADIENT_END_POINT, TEST_LOCATION );
-
- // Test assignment of the same object.
- const TextStyle& style( style2 );
-
- style2 = style;
-
- // Test the assignment of the defaults.
-
- // Test copy all defaults.
-
- TextStyle defaultStyle;
- style2 = defaultStyle;
-
- DALI_TEST_CHECK( style2.IsFontNameDefault() );
- DALI_TEST_CHECK( style2.IsFontStyleDefault() );
- DALI_TEST_CHECK( style2.IsFontSizeDefault() );
- DALI_TEST_CHECK( style2.IsTextColorDefault() );
- DALI_TEST_CHECK( style2.IsFontWeightDefault() );
- DALI_TEST_CHECK( style2.IsSmoothEdgeDefault() );
- DALI_TEST_CHECK( style2.IsItalicsDefault() );
- DALI_TEST_CHECK( style2.IsUnderlineDefault() );
- DALI_TEST_CHECK( style2.IsShadowDefault() );
- DALI_TEST_CHECK( style2.IsGlowDefault() );
- DALI_TEST_CHECK( style2.IsOutlineDefault() );
- DALI_TEST_CHECK( style2.IsGradientDefault() );
-
- DALI_TEST_EQUALS( style2.GetFontName(), DEFAULT_FONT_NAME_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetFontStyle(), DEFAULT_FONT_NAME_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetFontPointSize(), DEFAULT_FONT_POINT_SIZE, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetTextColor(), TextStyle::DEFAULT_TEXT_COLOR, TEST_LOCATION );
-
- DALI_TEST_EQUALS( style2.GetWeight(), TextStyle::DEFAULT_FONT_WEIGHT, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetSmoothEdge(), TextStyle::DEFAULT_SMOOTH_EDGE_DISTANCE_FIELD, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsItalicsEnabled() );
- DALI_TEST_EQUALS( style2.GetItalicsAngle(), TextStyle::DEFAULT_ITALICS_ANGLE, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsUnderlineEnabled() );
- DALI_TEST_EQUALS( style2.GetUnderlineThickness(), TextStyle::DEFAULT_UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetUnderlinePosition(), TextStyle::DEFAULT_UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsShadowEnabled() );
- DALI_TEST_EQUALS( style2.GetShadowColor(), TextStyle::DEFAULT_SHADOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetShadowOffset(), TextStyle::DEFAULT_SHADOW_OFFSET, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsGlowEnabled() );
- DALI_TEST_EQUALS( style2.GetGlowColor(), TextStyle::DEFAULT_GLOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGlowIntensity(), TextStyle::DEFAULT_GLOW_INTENSITY, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsOutlineEnabled() );
- DALI_TEST_EQUALS( style2.GetOutlineColor(), TextStyle::DEFAULT_OUTLINE_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetOutlineThickness(), TextStyle::DEFAULT_OUTLINE_THICKNESS, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsGradientEnabled() );
- DALI_TEST_EQUALS( style2.GetGradientColor(), TextStyle::DEFAULT_GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGradientStartPoint(), TextStyle::DEFAULT_GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGradientEndPoint(), TextStyle::DEFAULT_GRADIENT_END_POINT, TEST_LOCATION );
-
- // Test copy some defaults.
-
- // set style2 with non defaults.
- style2 = style1;
-
- // create a style with all defaults excepd the font name.
- defaultStyle.SetFontName( FONT_FAMILY );
-
- // should reset all to defaults except the font name.
- style2 = defaultStyle;
-
- DALI_TEST_CHECK( !style2.IsFontNameDefault() );
- DALI_TEST_CHECK( style2.IsFontStyleDefault() );
- DALI_TEST_CHECK( style2.IsFontSizeDefault() );
- DALI_TEST_CHECK( style2.IsTextColorDefault() );
- DALI_TEST_CHECK( style2.IsFontWeightDefault() );
- DALI_TEST_CHECK( style2.IsSmoothEdgeDefault() );
- DALI_TEST_CHECK( style2.IsItalicsDefault() );
- DALI_TEST_CHECK( style2.IsUnderlineDefault() );
- DALI_TEST_CHECK( style2.IsShadowDefault() );
- DALI_TEST_CHECK( style2.IsGlowDefault() );
- DALI_TEST_CHECK( style2.IsOutlineDefault() );
- DALI_TEST_CHECK( style2.IsGradientDefault() );
-
- DALI_TEST_EQUALS( style2.GetFontName(), FONT_FAMILY, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetFontStyle(), DEFAULT_FONT_NAME_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetFontPointSize(), DEFAULT_FONT_POINT_SIZE, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetTextColor(), TextStyle::DEFAULT_TEXT_COLOR, TEST_LOCATION );
-
- DALI_TEST_EQUALS( style2.GetWeight(), TextStyle::DEFAULT_FONT_WEIGHT, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetSmoothEdge(), TextStyle::DEFAULT_SMOOTH_EDGE_DISTANCE_FIELD, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsItalicsEnabled() );
- DALI_TEST_EQUALS( style2.GetItalicsAngle(), TextStyle::DEFAULT_ITALICS_ANGLE, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsUnderlineEnabled() );
- DALI_TEST_EQUALS( style2.GetUnderlineThickness(), TextStyle::DEFAULT_UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetUnderlinePosition(), TextStyle::DEFAULT_UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsShadowEnabled() );
- DALI_TEST_EQUALS( style2.GetShadowColor(), TextStyle::DEFAULT_SHADOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetShadowOffset(), TextStyle::DEFAULT_SHADOW_OFFSET, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsGlowEnabled() );
- DALI_TEST_EQUALS( style2.GetGlowColor(), TextStyle::DEFAULT_GLOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGlowIntensity(), TextStyle::DEFAULT_GLOW_INTENSITY, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsOutlineEnabled() );
- DALI_TEST_EQUALS( style2.GetOutlineColor(), TextStyle::DEFAULT_OUTLINE_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetOutlineThickness(), TextStyle::DEFAULT_OUTLINE_THICKNESS, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsGradientEnabled() );
- DALI_TEST_EQUALS( style2.GetGradientColor(), TextStyle::DEFAULT_GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGradientStartPoint(), TextStyle::DEFAULT_GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGradientEndPoint(), TextStyle::DEFAULT_GRADIENT_END_POINT, TEST_LOCATION );
-
- // reset the text-style to default.
- defaultStyle = TextStyle();
-
- // test now the default font name.
- defaultStyle.SetFontStyle( FONT_STYLE );
-
- style2 = defaultStyle;
-
- DALI_TEST_CHECK( style2.IsFontNameDefault() );
- DALI_TEST_CHECK( !style2.IsFontStyleDefault() );
- DALI_TEST_CHECK( style2.IsFontSizeDefault() );
- DALI_TEST_CHECK( style2.IsTextColorDefault() );
- DALI_TEST_CHECK( style2.IsFontWeightDefault() );
- DALI_TEST_CHECK( style2.IsSmoothEdgeDefault() );
- DALI_TEST_CHECK( style2.IsItalicsDefault() );
- DALI_TEST_CHECK( style2.IsUnderlineDefault() );
- DALI_TEST_CHECK( style2.IsShadowDefault() );
- DALI_TEST_CHECK( style2.IsGlowDefault() );
- DALI_TEST_CHECK( style2.IsOutlineDefault() );
- DALI_TEST_CHECK( style2.IsGradientDefault() );
-
- DALI_TEST_EQUALS( style2.GetFontName(), DEFAULT_FONT_NAME_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetFontStyle(), FONT_STYLE, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetFontPointSize(), DEFAULT_FONT_POINT_SIZE, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetTextColor(), TextStyle::DEFAULT_TEXT_COLOR, TEST_LOCATION );
-
- DALI_TEST_EQUALS( style2.GetWeight(), TextStyle::DEFAULT_FONT_WEIGHT, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetSmoothEdge(), TextStyle::DEFAULT_SMOOTH_EDGE_DISTANCE_FIELD, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsItalicsEnabled() );
- DALI_TEST_EQUALS( style2.GetItalicsAngle(), TextStyle::DEFAULT_ITALICS_ANGLE, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsUnderlineEnabled() );
- DALI_TEST_EQUALS( style2.GetUnderlineThickness(), TextStyle::DEFAULT_UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetUnderlinePosition(), TextStyle::DEFAULT_UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsShadowEnabled() );
- DALI_TEST_EQUALS( style2.GetShadowColor(), TextStyle::DEFAULT_SHADOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetShadowOffset(), TextStyle::DEFAULT_SHADOW_OFFSET, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsGlowEnabled() );
- DALI_TEST_EQUALS( style2.GetGlowColor(), TextStyle::DEFAULT_GLOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGlowIntensity(), TextStyle::DEFAULT_GLOW_INTENSITY, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsOutlineEnabled() );
- DALI_TEST_EQUALS( style2.GetOutlineColor(), TextStyle::DEFAULT_OUTLINE_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetOutlineThickness(), TextStyle::DEFAULT_OUTLINE_THICKNESS, TEST_LOCATION );
-
- DALI_TEST_CHECK( !style2.IsGradientEnabled() );
- DALI_TEST_EQUALS( style2.GetGradientColor(), TextStyle::DEFAULT_GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGradientStartPoint(), TextStyle::DEFAULT_GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGradientEndPoint(), TextStyle::DEFAULT_GRADIENT_END_POINT, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextStyleComparisonOperator(void)
-{
- tet_infoline(" UtcDaliTextStyleComparisonOperator ");
-
- TestApplication application;
-
- TextStyle style1;
- TextStyle style2;
-
- // Compares equality and inequality operators
-
- // Compare two defaults.
-
- DALI_TEST_CHECK( style1 == style2 );
- DALI_TEST_CHECK( !( style1 != style2 ) );
-
- // Compare with defaults.
-
- style1.SetFontName( FONT_FAMILY );
-
- DALI_TEST_CHECK( !( style1 == style2 ) );
- DALI_TEST_CHECK( style1 != style2 );
-
- style1 = TextStyle();
- style2.SetFontName( FONT_FAMILY );
-
- DALI_TEST_CHECK( !( style1 == style2 ) );
- DALI_TEST_CHECK( style1 != style2 );
-
- // Compare non defaults.
-
- // Compare different flags
-
- style1.SetFontName( FONT_FAMILY );
- style2.SetFontStyle( FONT_STYLE );
- style1.SetFontPointSize( FONT_POINT_SIZE );
- style2.SetTextColor( TEXT_COLOR );
-
- style1.SetWeight( TEXT_WEIGHT );
- style2.SetSmoothEdge( SMOOTH_EDGE );
-
- style1.SetItalics( ITALICS, ITALICS_ANGLE );
-
- style2.SetUnderline( UNDERLINE, UNDERLINE_THICKNESS, UNDERLINE_POSITION );
-
- style1.SetShadow( SHADOW, SHADOW_COLOR, SHADOW_OFFSET, SHADOW_SIZE );
- style2.SetGlow( GLOW, GLOW_COLOR, GLOW_INTENSITY );
- style1.SetOutline( OUTLINE, OUTLINE_COLOR, OUTLINE_THICKNESS );
- style2.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
-
- DALI_TEST_CHECK( !( style1 == style2 ) );
- DALI_TEST_CHECK( style1 != style2 );
-
- // Compare same styles
- style1 = style2;
-
- DALI_TEST_CHECK( style1 == style2 );
- DALI_TEST_CHECK( !( style1 != style2 ) );
-
- // Compare same flags but different values
- style1.SetTextColor( Color::GREEN );
-
- DALI_TEST_CHECK( !( style1 == style2 ) );
- DALI_TEST_CHECK( style1 != style2 );
-
- END_TEST;
-}
-
-int UtcDaliTextStyleCopy(void)
-{
- tet_infoline(" UtcDaliTextStyleCopy ");
-
- TestApplication application;
-
- TextStyle style;
-
- // Set a style different than default.
- TextStyle style2;
- style2.SetFontName( FONT_FAMILY );
- style2.SetFontStyle( FONT_STYLE );
- style2.SetFontPointSize( FONT_POINT_SIZE );
- style2.SetTextColor( TEXT_COLOR );
-
- style2.SetWeight( TEXT_WEIGHT );
- style2.SetSmoothEdge( SMOOTH_EDGE );
-
- style2.SetItalics( ITALICS, ITALICS_ANGLE );
- style2.SetUnderline( UNDERLINE, UNDERLINE_THICKNESS, UNDERLINE_POSITION );
- style2.SetShadow( SHADOW, SHADOW_COLOR, SHADOW_OFFSET, SHADOW_SIZE );
- style2.SetGlow( GLOW, GLOW_COLOR, GLOW_INTENSITY );
- style2.SetOutline( OUTLINE, OUTLINE_COLOR, OUTLINE_THICKNESS );
- style2.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
-
- // Test not to copy the same object. To increase coverage.
-
- const TextStyle& same( style2 );
-
- style2.Copy( same );
-
- DALI_TEST_CHECK( same == style2 );
-
- // Test mask.
-
- // All values are copied.
- style.Copy( style2 );
-
- DALI_TEST_CHECK( style == style2 );
-
- // Copy the default
- TextStyle defaultStyle;
-
- style.Copy( defaultStyle );
-
- // Test FONT
- style = TextStyle();
-
- style.Copy( style2, TextStyle::FONT );
-
- DALI_TEST_EQUALS( style.GetFontName(), FONT_FAMILY, TEST_LOCATION );
-
- style.Copy( defaultStyle, TextStyle::FONT );
-
- DALI_TEST_EQUALS( style.GetFontName(), DEFAULT_FONT_NAME_STYLE, TEST_LOCATION );
-
- // Test STYLE
- style = TextStyle();
-
- style.Copy( style2, TextStyle::STYLE );
-
- DALI_TEST_EQUALS( style.GetFontStyle(), FONT_STYLE, TEST_LOCATION );
-
- style.Copy( defaultStyle, TextStyle::STYLE );
-
- DALI_TEST_EQUALS( style.GetFontStyle(), DEFAULT_FONT_NAME_STYLE, TEST_LOCATION );
-
- // Test SIZE
- style = TextStyle();
-
- style.Copy( style2, TextStyle::SIZE );
-
- DALI_TEST_EQUALS( style.GetFontPointSize(), FONT_POINT_SIZE, TEST_LOCATION );
-
- style.Copy( defaultStyle, TextStyle::SIZE );
-
- DALI_TEST_EQUALS( style.GetFontPointSize(), PointSize( 0.f ), TEST_LOCATION );
-
- // Test COLOR
- style = TextStyle();
-
- style.Copy( style2, TextStyle::COLOR );
-
- DALI_TEST_EQUALS( style.GetTextColor(), TEXT_COLOR, TEST_LOCATION );
-
- style.Copy( defaultStyle, TextStyle::COLOR );
-
- DALI_TEST_EQUALS( style.GetTextColor(), TextStyle::DEFAULT_TEXT_COLOR, TEST_LOCATION );
-
- // Test WEIGHT
- style = TextStyle();
-
- style.Copy( style2, TextStyle::WEIGHT );
-
- DALI_TEST_EQUALS( style.GetWeight(), TEXT_WEIGHT, TEST_LOCATION );
-
- style.Copy( defaultStyle, TextStyle::WEIGHT );
-
- DALI_TEST_EQUALS( style.GetWeight(), TextStyle::DEFAULT_FONT_WEIGHT, TEST_LOCATION );
-
- // Test SMOOTH
- style = TextStyle();
-
- style.Copy( style2, TextStyle::SMOOTH );
-
- DALI_TEST_EQUALS( style.GetSmoothEdge(), SMOOTH_EDGE, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- style.Copy( defaultStyle, TextStyle::SMOOTH );
-
- DALI_TEST_EQUALS( style.GetSmoothEdge(), TextStyle::DEFAULT_SMOOTH_EDGE_DISTANCE_FIELD, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- // Test ITALICS
- style = TextStyle();
-
- style.Copy( style2, TextStyle::ITALICS );
-
- DALI_TEST_CHECK( style.IsItalicsEnabled() );
- DALI_TEST_EQUALS( style.GetItalicsAngle(), ITALICS_ANGLE, TEST_LOCATION );
-
- style.Copy( defaultStyle, TextStyle::ITALICS );
-
- DALI_TEST_CHECK( !style.IsItalicsEnabled() );
- DALI_TEST_EQUALS( style.GetItalicsAngle(), TextStyle::DEFAULT_ITALICS_ANGLE, TEST_LOCATION );
-
- // Test UNDERLINE
- style = TextStyle();
-
- style.Copy( style2, TextStyle::UNDERLINE );
-
- DALI_TEST_CHECK( style.IsUnderlineEnabled() );
- DALI_TEST_EQUALS( style.GetUnderlineThickness(), UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetUnderlinePosition(), UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- style.Copy( defaultStyle, TextStyle::UNDERLINE );
-
- DALI_TEST_CHECK( !style.IsUnderlineEnabled() );
- DALI_TEST_EQUALS( style.GetUnderlineThickness(), TextStyle::DEFAULT_UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetUnderlinePosition(), TextStyle::DEFAULT_UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- // Test SHADOW
- style = TextStyle();
-
- style.Copy( style2, TextStyle::SHADOW );
-
- DALI_TEST_CHECK( style.IsShadowEnabled() );
- DALI_TEST_EQUALS( style.GetShadowColor(), SHADOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetShadowOffset(), SHADOW_OFFSET, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetShadowSize(), SHADOW_SIZE, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- style.Copy( defaultStyle, TextStyle::SHADOW );
-
- DALI_TEST_CHECK( !style.IsShadowEnabled() );
- DALI_TEST_EQUALS( style.GetShadowColor(), TextStyle::DEFAULT_SHADOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetShadowOffset(), TextStyle::DEFAULT_SHADOW_OFFSET, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetShadowSize(), TextStyle::DEFAULT_SHADOW_SIZE, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- // Test GLOW
- style = TextStyle();
-
- style.Copy( style2, TextStyle::GLOW );
-
- DALI_TEST_CHECK( style.IsGlowEnabled() );
- DALI_TEST_EQUALS( style.GetGlowColor(), GLOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetGlowIntensity(), GLOW_INTENSITY, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- style.Copy( defaultStyle, TextStyle::GLOW );
-
- DALI_TEST_CHECK( !style.IsGlowEnabled() );
- DALI_TEST_EQUALS( style.GetGlowColor(), TextStyle::DEFAULT_GLOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetGlowIntensity(), TextStyle::DEFAULT_GLOW_INTENSITY, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- // Test OUTLINE
- style = TextStyle();
-
- style.Copy( style2, TextStyle::OUTLINE );
-
- DALI_TEST_CHECK( style.IsOutlineEnabled() );
- DALI_TEST_EQUALS( style.GetOutlineColor(), OUTLINE_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetOutlineThickness(), OUTLINE_THICKNESS, TEST_LOCATION );
-
- style.Copy( defaultStyle, TextStyle::OUTLINE );
-
- DALI_TEST_CHECK( !style.IsOutlineEnabled() );
- DALI_TEST_EQUALS( style.GetOutlineColor(), TextStyle::DEFAULT_OUTLINE_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetOutlineThickness(), TextStyle::DEFAULT_OUTLINE_THICKNESS, TEST_LOCATION );
-
- // Test GRADIENT
- style = TextStyle();
-
- style.Copy( style2, TextStyle::GRADIENT );
-
- DALI_TEST_CHECK( style.IsGradientEnabled() );
- DALI_TEST_EQUALS( style.GetGradientColor(), GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetGradientStartPoint(), GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetGradientEndPoint(), GRADIENT_END_POINT, TEST_LOCATION );
-
- style.Copy( defaultStyle, TextStyle::GRADIENT );
-
- DALI_TEST_CHECK( !style.IsGradientEnabled() );
- DALI_TEST_EQUALS( style.GetGradientColor(), TextStyle::DEFAULT_GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetGradientStartPoint(), TextStyle::DEFAULT_GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetGradientEndPoint(), TextStyle::DEFAULT_GRADIENT_END_POINT, TEST_LOCATION );
-
- // Copy to a default.
- defaultStyle.Copy( style2 );
- DALI_TEST_CHECK( defaultStyle == style2);
-
- // Copy from default.
- defaultStyle = TextStyle();
-
- defaultStyle.SetItalics( ITALICS, ITALICS_ANGLE );
- defaultStyle.SetUnderline( UNDERLINE, UNDERLINE_THICKNESS, UNDERLINE_POSITION );
- defaultStyle.SetShadow( SHADOW, SHADOW_COLOR, SHADOW_OFFSET, SHADOW_SIZE );
- defaultStyle.SetGlow( GLOW, GLOW_COLOR, GLOW_INTENSITY );
- defaultStyle.SetOutline( OUTLINE, OUTLINE_COLOR, OUTLINE_THICKNESS );
- defaultStyle.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
-
- // Copy the default values
- style2.Copy( defaultStyle, static_cast( TextStyle::FONT |
- TextStyle::STYLE |
- TextStyle::SIZE |
- TextStyle::COLOR |
- TextStyle::WEIGHT |
- TextStyle::SMOOTH ) );
-
- defaultStyle = TextStyle();
-
- defaultStyle.SetFontName( FONT_FAMILY );
- defaultStyle.SetFontStyle( FONT_STYLE );
- defaultStyle.SetFontPointSize( FONT_POINT_SIZE );
- defaultStyle.SetTextColor( TEXT_COLOR );
- defaultStyle.SetWeight( TEXT_WEIGHT );
- defaultStyle.SetSmoothEdge( SMOOTH_EDGE );
-
- // Copy the default values
- style2.Copy( defaultStyle, static_cast( TextStyle::ITALICS |
- TextStyle::UNDERLINE |
- TextStyle::SHADOW |
- TextStyle::GLOW |
- TextStyle::OUTLINE |
- TextStyle::GRADIENT ) );
-
- defaultStyle = TextStyle();
-
- DALI_TEST_CHECK( defaultStyle == style2 );
-
- END_TEST;
-}
-
-int UtcDaliTextStyleMerge(void)
-{
- tet_infoline(" UtcDaliTextStyleMerge ");
-
- TestApplication application;
-
- TextStyle defaultStyle;
-
- TextStyle style;
-
- // Set a style different than default.
- TextStyle style2;
- style2.SetFontName( FONT_FAMILY );
- style2.SetFontStyle( FONT_STYLE );
- style2.SetFontPointSize( FONT_POINT_SIZE );
- style2.SetTextColor( TEXT_COLOR );
-
- style2.SetWeight( TEXT_WEIGHT );
- style2.SetSmoothEdge( SMOOTH_EDGE );
-
- style2.SetItalics( ITALICS, ITALICS_ANGLE );
- style2.SetUnderline( UNDERLINE, UNDERLINE_THICKNESS, UNDERLINE_POSITION );
- style2.SetShadow( SHADOW, SHADOW_COLOR, SHADOW_OFFSET, SHADOW_SIZE );
- style2.SetGlow( GLOW, GLOW_COLOR, GLOW_INTENSITY );
- style2.SetOutline( OUTLINE, OUTLINE_COLOR, OUTLINE_THICKNESS );
- style2.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
-
- // Test not to merge the same object. To increase coverage.
-
- const TextStyle& same( style2 );
-
- style2.Merge( same );
-
- DALI_TEST_CHECK( same == style2 );
-
- // Test merge two styles
-
- style.Merge( style2 );
-
- DALI_TEST_CHECK( style == style2 );
-
- // Test merge a default style
-
- style.Merge( defaultStyle );
-
- DALI_TEST_CHECK( style == style2 );
-
- // Tests to increase branch coverage.
-
- style = defaultStyle;
- style.SetFontName( FONT_FAMILY );
-
- TextStyle style3;
- style3.Merge( style );
-
- DALI_TEST_CHECK( style == style3 );
-
-
- END_TEST;
-}
-
-int UtcDaliTextStyleReset(void)
-{
- tet_infoline(" UtcDaliTextStyleReset ");
-
- TestApplication application;
-
- const TextStyle defaultStyle;
-
- // Reset a default.
- TextStyle style;
-
- style.Reset();
-
- DALI_TEST_CHECK( defaultStyle == style );
-
- // Reset NONE
- style.Reset( TextStyle::NONE );
-
- DALI_TEST_CHECK( defaultStyle == style );
-
- // Reset ALL
- TextStyle style2;
- style2.SetFontName( FONT_FAMILY );
- style2.SetFontStyle( FONT_STYLE );
- style2.SetFontPointSize( FONT_POINT_SIZE );
- style2.SetTextColor( TEXT_COLOR );
-
- style2.SetWeight( TEXT_WEIGHT );
- style2.SetSmoothEdge( SMOOTH_EDGE );
-
- style2.SetItalics( ITALICS, ITALICS_ANGLE );
- style2.SetUnderline( UNDERLINE, UNDERLINE_THICKNESS, UNDERLINE_POSITION );
- style2.SetShadow( SHADOW, SHADOW_COLOR, SHADOW_OFFSET, SHADOW_SIZE );
- style2.SetGlow( GLOW, GLOW_COLOR, GLOW_INTENSITY );
- style2.SetOutline( OUTLINE, OUTLINE_COLOR, OUTLINE_THICKNESS );
- style2.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
-
- style2.Reset( TextStyle::ALL );
-
- DALI_TEST_CHECK( defaultStyle == style2 );
-
- // Set all parameters
- style2.SetFontName( FONT_FAMILY );
- style2.SetFontStyle( FONT_STYLE );
- style2.SetFontPointSize( FONT_POINT_SIZE );
- style2.SetTextColor( TEXT_COLOR );
-
- style2.SetWeight( TEXT_WEIGHT );
- style2.SetSmoothEdge( SMOOTH_EDGE );
-
- style2.SetItalics( ITALICS, ITALICS_ANGLE );
- style2.SetUnderline( UNDERLINE, UNDERLINE_THICKNESS, UNDERLINE_POSITION );
- style2.SetShadow( SHADOW, SHADOW_COLOR, SHADOW_OFFSET, SHADOW_SIZE );
- style2.SetGlow( GLOW, GLOW_COLOR, GLOW_INTENSITY );
- style2.SetOutline( OUTLINE, OUTLINE_COLOR, OUTLINE_THICKNESS );
- style2.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
-
- // Reset FONT
- style2.Reset( TextStyle::FONT );
-
- DALI_TEST_CHECK( style2.IsFontNameDefault() );
- DALI_TEST_EQUALS( style2.GetFontName(), DEFAULT_FONT_NAME_STYLE, TEST_LOCATION );
-
- // Reset STYLE
- style2.Reset( TextStyle::STYLE );
-
- DALI_TEST_CHECK( style2.IsFontStyleDefault() );
- DALI_TEST_EQUALS( style2.GetFontStyle(), DEFAULT_FONT_NAME_STYLE, TEST_LOCATION );
-
- // Reset SIZE
- style2.Reset( TextStyle::SIZE );
-
- DALI_TEST_CHECK( style2.IsFontSizeDefault() );
- DALI_TEST_EQUALS( style2.GetFontPointSize(), DEFAULT_FONT_POINT_SIZE, TEST_LOCATION );
-
- // Reset COLOR
- style2.Reset( TextStyle::COLOR );
-
- DALI_TEST_CHECK( style2.IsTextColorDefault() );
- DALI_TEST_EQUALS( style2.GetTextColor(), TextStyle::DEFAULT_TEXT_COLOR, TEST_LOCATION );
-
- // Reset WEIGHT
- style2.Reset( TextStyle::WEIGHT );
-
- DALI_TEST_CHECK( style2.IsFontWeightDefault() );
- DALI_TEST_EQUALS( style2.GetWeight(), TextStyle::DEFAULT_FONT_WEIGHT, TEST_LOCATION );
-
- // Reset SMOOTH
- style2.Reset( TextStyle::SMOOTH );
-
- DALI_TEST_CHECK( style2.IsSmoothEdgeDefault() );
- DALI_TEST_EQUALS( style2.GetSmoothEdge(), TextStyle::DEFAULT_SMOOTH_EDGE_DISTANCE_FIELD, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- // Reset ITALICS
- style2.Reset( TextStyle::ITALICS );
-
- DALI_TEST_CHECK( style2.IsItalicsDefault() );
- DALI_TEST_CHECK( !style2.IsItalicsEnabled() );
- DALI_TEST_EQUALS( style2.GetItalicsAngle(), TextStyle::DEFAULT_ITALICS_ANGLE, TEST_LOCATION );
-
- // Reset UNDERLINE
- style2.Reset( TextStyle::UNDERLINE );
-
- DALI_TEST_CHECK( style2.IsUnderlineDefault() );
- DALI_TEST_CHECK( !style2.IsUnderlineEnabled() );
- DALI_TEST_EQUALS( style2.GetUnderlineThickness(), TextStyle::DEFAULT_UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetUnderlinePosition(), TextStyle::DEFAULT_UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- // Reset SHADOW
- style2.Reset( TextStyle::SHADOW );
-
- DALI_TEST_CHECK( style2.IsShadowDefault() );
- DALI_TEST_CHECK( !style2.IsShadowEnabled() );
- DALI_TEST_EQUALS( style2.GetShadowColor(), TextStyle::DEFAULT_SHADOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetShadowOffset(), TextStyle::DEFAULT_SHADOW_OFFSET, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetShadowSize(), TextStyle::DEFAULT_SHADOW_SIZE, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- // Reset GLOW
- style2.Reset( TextStyle::GLOW );
-
- DALI_TEST_CHECK( style2.IsGlowDefault() );
- DALI_TEST_CHECK( !style2.IsGlowEnabled() );
- DALI_TEST_EQUALS( style2.GetGlowColor(), TextStyle::DEFAULT_GLOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGlowIntensity(), TextStyle::DEFAULT_GLOW_INTENSITY, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- // Reset OUTLINE
- style2.Reset( TextStyle::OUTLINE );
-
- DALI_TEST_CHECK( style2.IsOutlineDefault() );
- DALI_TEST_CHECK( !style2.IsOutlineEnabled() );
- DALI_TEST_EQUALS( style2.GetOutlineColor(), TextStyle::DEFAULT_OUTLINE_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetOutlineThickness(), TextStyle::DEFAULT_OUTLINE_THICKNESS, TEST_LOCATION );
-
- // Reset GRADIENT
- style2.Reset( TextStyle::GRADIENT );
-
- DALI_TEST_CHECK( style2.IsGradientDefault() );
- DALI_TEST_CHECK( !style2.IsGradientEnabled() );
- DALI_TEST_EQUALS( style2.GetGradientColor(), TextStyle::DEFAULT_GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGradientStartPoint(), TextStyle::DEFAULT_GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( style2.GetGradientEndPoint(), TextStyle::DEFAULT_GRADIENT_END_POINT, TEST_LOCATION );
-
-
- // Added to increase coverage.
-
- {
- // Reset the font name when there is another parameter of a different struct.
- // Test when the struct storing the font name is in the last position of the vector and when is not.
-
- TextStyle nameStyle;
-
- nameStyle.SetFontName( FONT_FAMILY );
- nameStyle.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
- nameStyle.Reset( TextStyle::FONT );
-
- DALI_TEST_EQUALS( nameStyle.GetFontName(), DEFAULT_FONT_NAME_STYLE, TEST_LOCATION );
-
- nameStyle.SetFontName( FONT_FAMILY );
- nameStyle.Reset( TextStyle::FONT );
-
- DALI_TEST_EQUALS( nameStyle.GetFontName(), DEFAULT_FONT_NAME_STYLE, TEST_LOCATION );
- }
-
- {
- // Reset the font style when there is another parameter of a different struct.
- // Test when the struct storing the font style is in the last position of the vector and when is not.
-
- TextStyle styleStyle;
-
- styleStyle.SetFontStyle( FONT_STYLE );
- styleStyle.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
- styleStyle.Reset( TextStyle::STYLE );
-
- DALI_TEST_EQUALS( styleStyle.GetFontStyle(), DEFAULT_FONT_NAME_STYLE, TEST_LOCATION );
-
- styleStyle.SetFontStyle( FONT_STYLE );
- styleStyle.Reset( TextStyle::STYLE );
-
- DALI_TEST_EQUALS( styleStyle.GetFontStyle(), DEFAULT_FONT_NAME_STYLE, TEST_LOCATION );
- }
-
- {
- // Reset the font size when there is another parameter of a different struct.
- // Test when the struct storing the font size is in the last position of the vector and when is not.
-
- TextStyle sizeStyle;
-
- sizeStyle.SetFontPointSize( FONT_POINT_SIZE );
- sizeStyle.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
- sizeStyle.Reset( TextStyle::SIZE );
-
- DALI_TEST_EQUALS( sizeStyle.GetFontPointSize(), DEFAULT_FONT_POINT_SIZE, TEST_LOCATION );
-
- sizeStyle.SetFontPointSize( FONT_POINT_SIZE );
- sizeStyle.Reset( TextStyle::SIZE );
-
- DALI_TEST_EQUALS( sizeStyle.GetFontPointSize(), DEFAULT_FONT_POINT_SIZE, TEST_LOCATION );
- }
-
- {
- // Reset the text color when there is another parameter of a different struct.
- // Test when the struct storing the text color is in the last position of the vector and when is not.
-
- TextStyle colorStyle;
-
- colorStyle.SetTextColor( TEXT_COLOR );
- colorStyle.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
- colorStyle.Reset( TextStyle::COLOR );
-
- DALI_TEST_EQUALS( colorStyle.GetTextColor(), TextStyle::DEFAULT_TEXT_COLOR, TEST_LOCATION );
-
- colorStyle.SetTextColor( TEXT_COLOR );
- colorStyle.Reset( TextStyle::COLOR );
-
- DALI_TEST_EQUALS( colorStyle.GetTextColor(), TextStyle::DEFAULT_TEXT_COLOR, TEST_LOCATION );
- }
-
- {
- // Reset the text weight when there is another parameter of a different struct.
- // Test when the struct storing the text weight is in the last position of the vector and when is not.
-
- TextStyle weightStyle;
-
- weightStyle.SetWeight( TEXT_WEIGHT );
- weightStyle.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
- weightStyle.Reset( TextStyle::WEIGHT );
-
- DALI_TEST_EQUALS( weightStyle.GetWeight(), TextStyle::DEFAULT_FONT_WEIGHT, TEST_LOCATION );
-
- weightStyle.SetWeight( TEXT_WEIGHT );
- weightStyle.Reset( TextStyle::WEIGHT );
-
- DALI_TEST_EQUALS( weightStyle.GetWeight(), TextStyle::DEFAULT_FONT_WEIGHT, TEST_LOCATION );
- }
-
- {
- // Reset the smooth edge when there is another parameter of a different struct.
- // Test when the struct storing the smooth edge is in the last position of the vector and when is not.
-
- TextStyle smoothStyle;
-
- smoothStyle.SetSmoothEdge( SMOOTH_EDGE );
- smoothStyle.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
- smoothStyle.Reset( TextStyle::SMOOTH );
-
- DALI_TEST_EQUALS( smoothStyle.GetSmoothEdge(), TextStyle::DEFAULT_SMOOTH_EDGE_DISTANCE_FIELD, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- smoothStyle.SetSmoothEdge( SMOOTH_EDGE );
- smoothStyle.Reset( TextStyle::SMOOTH );
-
- DALI_TEST_EQUALS( smoothStyle.GetSmoothEdge(), TextStyle::DEFAULT_SMOOTH_EDGE_DISTANCE_FIELD, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- }
-
- {
- // Reset the italics when there is another parameter of a different struct.
- // Test when the struct storing the italics is in the last position of the vector and when is not.
-
- TextStyle italicsStyle;
-
- italicsStyle.SetItalics( ITALICS, ITALICS_ANGLE );
- italicsStyle.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
- italicsStyle.Reset( TextStyle::ITALICS );
-
- DALI_TEST_EQUALS( italicsStyle.GetItalicsAngle(), TextStyle::DEFAULT_ITALICS_ANGLE, TEST_LOCATION );
-
- italicsStyle.SetItalics( ITALICS, ITALICS_ANGLE );
- italicsStyle.Reset( TextStyle::ITALICS );
-
- DALI_TEST_EQUALS( italicsStyle.GetItalicsAngle(), TextStyle::DEFAULT_ITALICS_ANGLE, TEST_LOCATION );
- }
-
- {
- // Reset the underline when there is another parameter of a different struct.
- // Test when the struct storing the underline is in the last position of the vector and when is not.
-
- TextStyle underlineStyle;
-
- underlineStyle.SetUnderline( UNDERLINE, UNDERLINE_THICKNESS, UNDERLINE_POSITION );
- underlineStyle.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
- underlineStyle.Reset( TextStyle::UNDERLINE );
-
- DALI_TEST_EQUALS( underlineStyle.GetUnderlineThickness(), TextStyle::DEFAULT_UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( underlineStyle.GetUnderlinePosition(), TextStyle::DEFAULT_UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- underlineStyle.SetUnderline( UNDERLINE, UNDERLINE_THICKNESS, UNDERLINE_POSITION );
- underlineStyle.Reset( TextStyle::UNDERLINE );
-
- DALI_TEST_EQUALS( underlineStyle.GetUnderlineThickness(), TextStyle::DEFAULT_UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( underlineStyle.GetUnderlinePosition(), TextStyle::DEFAULT_UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- }
-
-
-
-
-
- {
- // Reset the shadow when there is another parameter of a different struct.
- // Test when the struct storing the shadow is in the last position of the vector and when is not.
-
- TextStyle shadowStyle;
-
- shadowStyle.SetShadow( SHADOW, SHADOW_COLOR, SHADOW_OFFSET, SHADOW_SIZE );
- shadowStyle.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
- shadowStyle.Reset( TextStyle::SHADOW );
-
- DALI_TEST_CHECK( shadowStyle.IsShadowDefault() );
-
- shadowStyle.SetShadow( SHADOW, SHADOW_COLOR, SHADOW_OFFSET, SHADOW_SIZE );
- shadowStyle.Reset( TextStyle::SHADOW );
-
- DALI_TEST_CHECK( shadowStyle.IsShadowDefault() );
-}
-
- {
- // Reset the glow when there is another parameter of a different struct.
- // Test when the struct storing the glow is in the last position of the vector and when is not.
-
- TextStyle glowStyle;
-
- glowStyle.SetGlow( GLOW, GLOW_COLOR, GLOW_INTENSITY );
- glowStyle.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
- glowStyle.Reset( TextStyle::GLOW );
-
- DALI_TEST_CHECK( glowStyle.IsGlowDefault() );
-
- glowStyle.SetGlow( GLOW, GLOW_COLOR, GLOW_INTENSITY );
- glowStyle.Reset( TextStyle::GLOW );
-
- DALI_TEST_CHECK( glowStyle.IsGlowDefault() );
- }
-
- {
- // Reset the outline when there is another parameter of a different struct.
- // Test when the struct storing the outline is in the last position of the vector and when is not.
-
- TextStyle outlineStyle;
-
- outlineStyle.SetOutline( OUTLINE, OUTLINE_COLOR, OUTLINE_THICKNESS );
- outlineStyle.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
- outlineStyle.Reset( TextStyle::OUTLINE );
-
- DALI_TEST_CHECK( outlineStyle.IsOutlineDefault() );
-
- outlineStyle.SetOutline( OUTLINE, OUTLINE_COLOR, OUTLINE_THICKNESS );
- outlineStyle.Reset( TextStyle::OUTLINE );
-
- DALI_TEST_CHECK( outlineStyle.IsOutlineDefault() );
- }
-
- {
- // Reset the gradient when there is another parameter of a different struct.
- // Test when the struct storing the gradient is in the last position of the vector and when is not.
-
- TextStyle gradientStyle;
-
- gradientStyle.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
- gradientStyle.SetOutline( OUTLINE, OUTLINE_COLOR, OUTLINE_THICKNESS );
- gradientStyle.Reset( TextStyle::GRADIENT );
-
- DALI_TEST_CHECK( gradientStyle.IsGradientDefault() );
-
- gradientStyle.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
- gradientStyle.Reset( TextStyle::GRADIENT );
-
- DALI_TEST_CHECK( gradientStyle.IsGradientDefault() );
- }
-
- END_TEST;
-}
-
-int UtcDaliTextStyleSetGetFontName(void)
-{
- tet_infoline(" UtcDaliTextStyleSetGetFontName ");
-
- TestApplication application;
-
- TextStyle style;
-
- style.SetFontName( FONT_FAMILY );
-
- DALI_TEST_EQUALS( style.GetFontName(), FONT_FAMILY, TEST_LOCATION );
-
- // Added to increase coverage
- style.SetFontStyle( FONT_STYLE );
- DALI_TEST_EQUALS( style.GetFontStyle(), FONT_STYLE, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextStyleSetGetFontStyle(void)
-{
- tet_infoline(" UtcDaliTextStyleSetGetFontStyle ");
-
- TestApplication application;
-
- TextStyle style;
-
- style.SetFontStyle( FONT_STYLE );
-
- DALI_TEST_EQUALS( style.GetFontStyle(), FONT_STYLE, TEST_LOCATION );
-
- // Added to increase coverage
- style.SetFontName( FONT_FAMILY );
- DALI_TEST_EQUALS( style.GetFontName(), FONT_FAMILY, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextStyleSetGetFontPointSize(void)
-{
- tet_infoline(" UtcDaliTextStyleSetGetFontPointSize ");
-
- TestApplication application;
-
- TextStyle style;
-
- style.SetFontPointSize( FONT_POINT_SIZE );
-
- DALI_TEST_EQUALS( style.GetFontPointSize(), FONT_POINT_SIZE, TEST_LOCATION );
-
- // Added to increase coverage
- style.SetTextColor( TEXT_COLOR );
- DALI_TEST_EQUALS( style.GetTextColor(), TEXT_COLOR, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextStyleSetGetTextColor(void)
-{
- tet_infoline(" UtcDaliTextStyleSetGetTextColor ");
-
- TestApplication application;
-
- TextStyle style;
-
- style.SetTextColor( TEXT_COLOR );
-
- DALI_TEST_EQUALS( style.GetTextColor(), TEXT_COLOR, TEST_LOCATION );
-
- // Added to increase coverage
- style.SetFontPointSize( FONT_POINT_SIZE );
- DALI_TEST_EQUALS( style.GetFontPointSize(), FONT_POINT_SIZE, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextStyleSetGetWeight(void)
-{
- tet_infoline(" UtcDaliTextStyleSetGetWeight ");
-
- TestApplication application;
-
- TextStyle style;
-
- style.SetWeight( TEXT_WEIGHT );
-
- DALI_TEST_EQUALS( style.GetWeight(), TEXT_WEIGHT, TEST_LOCATION );
-
- // Added to increase coverage
- style.SetSmoothEdge( SMOOTH_EDGE );
- DALI_TEST_EQUALS( style.GetSmoothEdge(), SMOOTH_EDGE, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextStyleSetGetSmoothEdge(void)
-{
- tet_infoline(" UtcDaliTextStyleSetGetGlow ");
-
- TestApplication application;
-
- TextStyle style;
-
- style.SetSmoothEdge( SMOOTH_EDGE );
-
- DALI_TEST_EQUALS( style.GetSmoothEdge(), SMOOTH_EDGE, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- // Added to increase coverage
- style.SetWeight( TEXT_WEIGHT );
- DALI_TEST_EQUALS( style.GetWeight(), TEXT_WEIGHT, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextStyleSetGetItalics(void)
-{
- tet_infoline(" UtcDaliTextStyleSetGetItalics ");
-
- TestApplication application;
-
- TextStyle style;
-
- DALI_TEST_EQUALS( style.GetItalicsAngle(), TextStyle::DEFAULT_ITALICS_ANGLE, TEST_LOCATION );
-
- style.SetItalics( ITALICS, ITALICS_ANGLE );
-
- DALI_TEST_CHECK( style.IsItalicsEnabled() );
- DALI_TEST_EQUALS( style.GetItalicsAngle(), ITALICS_ANGLE, TEST_LOCATION );
-
- style.SetItalics( !ITALICS, TextStyle::DEFAULT_ITALICS_ANGLE );
-
- DALI_TEST_CHECK( !style.IsItalicsEnabled() );
-
- END_TEST;
-}
-
-int UtcDaliTextStyleSetGetUnderline(void)
-{
- tet_infoline(" UtcDaliTextStyleSetGetUnderline ");
-
- TestApplication application;
-
- TextStyle style;
-
- style.SetUnderline( UNDERLINE, UNDERLINE_THICKNESS, UNDERLINE_POSITION );
-
- DALI_TEST_CHECK( style.IsUnderlineEnabled() );
- DALI_TEST_EQUALS( style.GetUnderlineThickness(), UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetUnderlinePosition(), UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- style.SetUnderline( !UNDERLINE, TextStyle::DEFAULT_UNDERLINE_THICKNESS, TextStyle::DEFAULT_UNDERLINE_POSITION );
-
- DALI_TEST_CHECK( !style.IsUnderlineEnabled() );
- DALI_TEST_EQUALS( style.GetUnderlineThickness(), TextStyle::DEFAULT_UNDERLINE_THICKNESS, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetUnderlinePosition(), TextStyle::DEFAULT_UNDERLINE_POSITION, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextStyleSetGetShadow(void)
-{
- tet_infoline(" UtcDaliTextStyleSetGetShadow ");
-
- TestApplication application;
-
- TextStyle style;
-
- DALI_TEST_CHECK( !style.IsShadowEnabled() );
-
- style.SetShadow( SHADOW, SHADOW_COLOR, SHADOW_OFFSET, SHADOW_SIZE );
-
- DALI_TEST_CHECK( style.IsShadowEnabled() );
- DALI_TEST_EQUALS( style.GetShadowColor(), SHADOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetShadowOffset(), SHADOW_OFFSET, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetShadowSize(), SHADOW_SIZE, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- style.SetShadow( !SHADOW, TextStyle::DEFAULT_SHADOW_COLOR, TextStyle::DEFAULT_SHADOW_OFFSET, TextStyle::DEFAULT_SHADOW_SIZE );
- DALI_TEST_CHECK( !style.IsShadowEnabled() );
- DALI_TEST_EQUALS( style.GetShadowColor(), TextStyle::DEFAULT_SHADOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetShadowOffset(), TextStyle::DEFAULT_SHADOW_OFFSET, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetShadowSize(), TextStyle::DEFAULT_SHADOW_SIZE, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextStyleSetGetGlow(void)
-{
- tet_infoline(" UtcDaliTextStyleSetGetGlow ");
-
- TestApplication application;
-
- TextStyle style;
-
- DALI_TEST_CHECK( !style.IsGlowEnabled() );
-
- style.SetGlow( GLOW, GLOW_COLOR, GLOW_INTENSITY );
-
- DALI_TEST_CHECK( style.IsGlowEnabled() );
- DALI_TEST_EQUALS( style.GetGlowColor(), GLOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetGlowIntensity(), GLOW_INTENSITY, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- style.SetGlow( !GLOW, TextStyle::DEFAULT_GLOW_COLOR, TextStyle::DEFAULT_GLOW_INTENSITY );
-
- DALI_TEST_CHECK( !style.IsGlowEnabled() );
- DALI_TEST_EQUALS( style.GetGlowColor(), TextStyle::DEFAULT_GLOW_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetGlowIntensity(), TextStyle::DEFAULT_GLOW_INTENSITY, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextStyleSetGetOutline(void)
-{
- tet_infoline(" UtcDaliTextStyleSetGetOutline ");
-
- TestApplication application;
-
- TextStyle style;
-
- DALI_TEST_CHECK( !style.IsOutlineEnabled() );
-
- style.SetOutline( OUTLINE, OUTLINE_COLOR, OUTLINE_THICKNESS );
-
- DALI_TEST_CHECK( style.IsOutlineEnabled() );
- DALI_TEST_EQUALS( style.GetOutlineColor(), OUTLINE_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetOutlineThickness(), OUTLINE_THICKNESS, TEST_LOCATION );
-
- style.SetOutline( !OUTLINE, TextStyle::DEFAULT_OUTLINE_COLOR, TextStyle::DEFAULT_OUTLINE_THICKNESS );
-
- DALI_TEST_CHECK( !style.IsOutlineEnabled() );
- DALI_TEST_EQUALS( style.GetOutlineColor(), TextStyle::DEFAULT_OUTLINE_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetOutlineThickness(), TextStyle::DEFAULT_OUTLINE_THICKNESS, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliTextStyleSetGetGradient(void)
-{
- tet_infoline(" UtcDaliTextStyleSetGetGradient ");
-
- TestApplication application;
-
- TextStyle style;
-
- DALI_TEST_CHECK( !style.IsGradientEnabled() );
-
- style.SetGradient( GRADIENT, GRADIENT_COLOR, GRADIENT_START_POINT, GRADIENT_END_POINT );
-
- DALI_TEST_CHECK( style.IsGradientEnabled() );
- DALI_TEST_EQUALS( style.GetGradientColor(), GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetGradientStartPoint(), GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetGradientEndPoint(), GRADIENT_END_POINT, TEST_LOCATION );
-
- style.SetGradient( !GRADIENT, TextStyle::DEFAULT_GRADIENT_COLOR, TextStyle::DEFAULT_GRADIENT_START_POINT, TextStyle::DEFAULT_GRADIENT_END_POINT );
-
- DALI_TEST_CHECK( !style.IsGradientEnabled() );
- DALI_TEST_EQUALS( style.GetGradientColor(), TextStyle::DEFAULT_GRADIENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetGradientStartPoint(), TextStyle::DEFAULT_GRADIENT_START_POINT, TEST_LOCATION );
- DALI_TEST_EQUALS( style.GetGradientEndPoint(), TextStyle::DEFAULT_GRADIENT_END_POINT, TEST_LOCATION );
-
- END_TEST;
-}
diff --git a/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp b/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp
index 19327d6..49130c3 100644
--- a/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp
+++ b/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp
@@ -1295,7 +1295,7 @@ int UtcDaliTouchStencil(void)
TestApplication application;
Stage stage = Stage::GetCurrent();
- TextActor actor = TextActor::New();
+ ImageActor actor = ImageActor::New();
actor.SetSize(100.0f, 100.0f);
actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
stage.Add(actor);
@@ -1333,12 +1333,12 @@ int UtcDaliTouchStencilInActorHierarchy(void)
TestApplication application;
Stage stage = Stage::GetCurrent();
- TextActor parent = TextActor::New();
+ ImageActor parent = ImageActor::New();
parent.SetSize(100.0f, 100.0f);
parent.SetAnchorPoint(AnchorPoint::TOP_LEFT);
stage.Add(parent);
- TextActor child = TextActor::New();
+ ImageActor child = ImageActor::New();
child.SetSize(25.0f, 25.0f);
child.SetAnchorPoint(AnchorPoint::TOP_LEFT);
parent.Add(child);
@@ -1419,7 +1419,7 @@ int UtcDaliTouchMultipleStencils(void)
TestApplication application;
Stage stage = Stage::GetCurrent();
- TextActor actor = TextActor::New();
+ ImageActor actor = ImageActor::New();
actor.SetSize(100.0f, 100.0f);
actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
stage.Add(actor);
diff --git a/dali/integration-api/file.list b/dali/integration-api/file.list
index 30dee19..d6b7779 100644
--- a/dali/integration-api/file.list
+++ b/dali/integration-api/file.list
@@ -3,7 +3,6 @@
platform_abstraction_src_files = \
$(platform_abstraction_src_dir)/bitmap.cpp \
$(platform_abstraction_src_dir)/core.cpp \
- $(platform_abstraction_src_dir)/glyph-set.cpp \
$(platform_abstraction_src_dir)/image-data.cpp \
$(platform_abstraction_src_dir)/debug.cpp \
$(platform_abstraction_src_dir)/profiling.cpp \
@@ -26,7 +25,6 @@ platform_abstraction_src_files = \
platform_abstraction_header_files = \
$(platform_abstraction_src_dir)/core.h \
$(platform_abstraction_src_dir)/context-notifier.h \
- $(platform_abstraction_src_dir)/glyph-set.h \
$(platform_abstraction_src_dir)/debug.h \
$(platform_abstraction_src_dir)/profiling.h \
$(platform_abstraction_src_dir)/input-options.h \
@@ -45,8 +43,7 @@ platform_abstraction_header_files = \
$(platform_abstraction_src_dir)/platform-abstraction.h \
$(platform_abstraction_src_dir)/shader-data.h \
$(platform_abstraction_src_dir)/system-overlay.h \
- $(platform_abstraction_src_dir)/common/lockless-buffer.h \
- $(platform_abstraction_src_dir)/text-array.h
+ $(platform_abstraction_src_dir)/common/lockless-buffer.h
platform_abstraction_dynamics_header_files = \
$(platform_abstraction_src_dir)/dynamics/dynamics-body-intf.h \
diff --git a/dali/integration-api/glyph-set.cpp b/dali/integration-api/glyph-set.cpp
deleted file mode 100644
index 33d3e47..0000000
--- a/dali/integration-api/glyph-set.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include
-
-namespace Dali
-{
-
-namespace Integration
-{
-
-GlyphSet::GlyphSet()
-: mFontHash(0),
- mLineHeight(0.0f),
- mAscender(0.0f),
- mUnitsPerEM(0.0f),
- mUnderlinePosition(0.0f),
- mUnderlineThickness(0.0f),
- mPadAdjust(0.0f),
- mAtlasId( 0 )
-{
-}
-
-GlyphSet::~GlyphSet()
-{
- mCharacterList.clear();
-}
-
-void GlyphSet::AddCharacter(BitmapPtr bitmapData, const GlyphMetrics& glyphMetrics)
-{
- mCharacterList.push_back(Character(bitmapData, glyphMetrics));
-}
-
-void GlyphSet::AddCharacter(const Character& character)
-{
- mCharacterList.push_back(character);
-}
-
-const GlyphSet::CharacterList& GlyphSet::GetCharacterList() const
-{
- return mCharacterList;
-}
-
-bool GlyphSet::HasCharacter(const uint32_t charCode) const
-{
- for (CharacterConstIter iter = mCharacterList.begin(), endIter = mCharacterList.end(); iter != endIter; ++iter)
- {
- if (iter->second.code == charCode)
- {
- return true;
- }
- }
- return false;
-}
-
-bool GlyphSet::HasCharacter(const Character& character) const
-{
- return HasCharacter(character.second.code);
-}
-
-ResourceId GlyphSet::GetAtlasResourceId() const
-{
- return mAtlasId;
-}
-
-void GlyphSet::SetAtlasResourceId(ResourceId resourceId)
-{
- mAtlasId = resourceId;
-}
-
-} //namespace Integration
-
-} //namespace Dali
diff --git a/dali/integration-api/glyph-set.h b/dali/integration-api/glyph-set.h
deleted file mode 100644
index 9474711..0000000
--- a/dali/integration-api/glyph-set.h
+++ /dev/null
@@ -1,186 +0,0 @@
-#ifndef __DALI_INTEGRATION_PLATFORM_FONT_H__
-#define __DALI_INTEGRATION_PLATFORM_FONT_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include
-
-// INTERNAL INCLUDES
-#include
-#include
-#include
-#include
-
-namespace Dali
-{
-
-namespace Integration
-{
-class GlyphSet;
-typedef IntrusivePtr GlyphSetPointer;
-
-/**
- * A Glyph holds information for a single character.
- */
-struct GlyphMetrics
-{
- enum GlyphQuality
- {
- LOW_QUALITY = 0x0,
- HIGH_QUALITY = 0x1
- };
-
- uint32_t code:21; ///< character code (UTF-32), max value of 0x10ffff (21 bits)
- uint32_t quality:1; ///< 0 = low quality, 1 = high quality
- float width; ///< glyph width in pixels
- float height; ///< glyph height in pixels
- float top; ///< distance between glyph's tallest pixel and baseline
- float left; ///< where to place the glyph horizontally in relation to current 'pen' position
- float xAdvance; ///< distance in pixels to move the 'pen' after displaying the character
- unsigned int xPosition; ///< x position in target atlas texture
- unsigned int yPosition; ///< y position in target atlas texture
-};
-
-/**
- * Stores font global metrics.
- */
-struct GlobalMetrics
-{
- GlobalMetrics()
- : lineHeight( 0.f ),
- ascender( 0.f ),
- unitsPerEM( 0.f ),
- underlinePosition( 0.f ),
- underlineThickness( 0.f ),
- padAdjustX( 0.f ),
- padAdjustY( 0.f ),
- maxWidth( 0.f ),
- maxHeight( 0.f )
- {}
-
- GlobalMetrics( float lh, float asc, float upem, float up, float ut, float pax, float pay, float mw, float mh )
- : lineHeight( lh ),
- ascender( asc ),
- unitsPerEM( upem ),
- underlinePosition( up ),
- underlineThickness( ut ),
- padAdjustX( pax ),
- padAdjustY( pay ),
- maxWidth( mw ),
- maxHeight ( mh )
- {}
-
- float lineHeight; ///< Distance between baselines
- float ascender; ///< Distance from baseline to top of cell
- float unitsPerEM; ///< font units/EM
- float underlinePosition; ///< Underline distance from baseline
- float underlineThickness; ///< Underline thickness
- float padAdjustX; ///< X adjustment value for padding around distance field
- float padAdjustY; ///< Y adjustment value for padding around distance field
- float maxWidth; ///< Width of widest glyph
- float maxHeight; ///< Height of tallest glyph
-};
-
-/**
- *
- * Platform font class.
- * A container for font data; consisting of some metrics and a list of bitmaps
- */
-class DALI_IMPORT_API GlyphSet : public Dali::RefObject
-{
-public:
- typedef std::pair Character;
- typedef IntrusivePtr CharacterPtr;
- typedef std::vector CharacterList;
- typedef CharacterList::iterator CharacterIter;
- typedef CharacterList::const_iterator CharacterConstIter;
-
- /**
- * Constructor.
- */
- GlyphSet();
-
- /**
- * Destructor.
- */
- ~GlyphSet();
-
- /**
- * Add a character to the platform font
- * @param [in] bitmapData A bitmap of the rendered character
- * @param [in] glyphMetrics Metrics for the character, including its character code
- */
- void AddCharacter(BitmapPtr bitmapData, const GlyphMetrics& glyphMetrics);
-
- /**
- * Add a character to the platform font
- * @param [in] character The Character object
- */
- void AddCharacter(const Character& character);
-
- /**
- * Get the list of characters in the font
- * @return The list of characters
- */
- const CharacterList& GetCharacterList() const;
-
- /**
- * Checks if the character is contained in the GlyphSet
- * @param [in] charCode The character to search for.
- * @return true if the character is contained in the GlyphSet
- */
- bool HasCharacter(const uint32_t charCode) const;
-
- /**
- * Checks if the character is contained in the GlyphSet
- * @param [in] character The character to search for.
- * @return true if the character is contained in the GlyphSet
- */
- bool HasCharacter(const Character& character) const;
-
- /**
- * Returns the resource ID of the texture atlas these bitmaps will be written to
- * @return the resource id
- */
- ResourceId GetAtlasResourceId() const;
-
- /**
- * Sets the resource ID of the texture atlas these bitmaps will be written to
- * @param[in] resourceId the resource identifier of the texture atlas.
- */
- void SetAtlasResourceId(ResourceId resourceId);
-
- size_t mFontHash; ///< hash of the fontname the glyphs were loaded for
- float mLineHeight; ///< Distance between baselines
- float mAscender; ///< Distance from baseline to top of cell
- float mUnitsPerEM; ///< font units/EM
- float mUnderlinePosition; ///< Underline distance from baseline
- float mUnderlineThickness; ///< Underline thickness
- float mPadAdjust; ///< Adjustment value for padding around distance field
-
-private:
- CharacterList mCharacterList;
- ResourceId mAtlasId; ///< Resource ID of target texture
-};
-
-} // namespace Integration
-
-} // namespace Dali
-
-#endif // __DALI_INTEGRATION_PLATFORM_FONT_H__
diff --git a/dali/integration-api/platform-abstraction.h b/dali/integration-api/platform-abstraction.h
index 77fa8fe..5f7601e 100644
--- a/dali/integration-api/platform-abstraction.h
+++ b/dali/integration-api/platform-abstraction.h
@@ -19,9 +19,8 @@
*/
// INTERNAL INCLUDES
-#include
+#include
#include
-#include
namespace Dali
{
@@ -162,79 +161,6 @@ public:
*/
virtual void JoinLoaderThreads() = 0;
- // Font Queries
-
- /**
- * Called by Dali to retrieve the default font family for the platform.
- * Multi-threading note: this method will be called from the main thread only i.e. not
- * from within the Core::Render() method.
- * @return The default font family.
- */
- virtual const std::string& GetDefaultFontFamily() const = 0;
-
- /**
- * Called by Dali to retrieve the default font size for the platform in points.
- * Multi-threading note: this method will be called from the main thread only i.e. not
- * from within the Core::Render() method.
- * @return The default font size.
- */
- virtual float GetDefaultFontSize() const = 0;
-
- /**
- * Gets a font line height to match a given caps-height
- *
- * @note fontFamily and fontStyle must have been validated previously.
- * @see ValidateFontFamilyName().
- *
- * @param[in] fontFamily The name of the font's family
- * @param[in] fontStyle The style of the font
- * @param[in] capsHeight The caps-height in pixels
- */
- virtual PixelSize GetFontLineHeightFromCapsHeight(const std::string& fontFamily, const std::string& fontStyle, CapsHeight capsHeight) const = 0;
-
- /**
- * Called by Font objects to synchronously query glyph data.
- *
- * @note fontFamily and font style, included in the resource request, must have been validated previously.
- * @see ValidateFontFamilyName().
- *
- * @note Font's style goes inside the textRequest parameter
- * @param[in] textRequest Resource request. Includes font's style.
- * @param[in] fontFamily The name of the font's family
- * @param[in] getBitmap Whether to load bitmaps for the symbols as well
- * @return A GlyphSet pointer with a list of the requested glyph metrics.
- */
- virtual Integration::GlyphSet* GetGlyphData ( const Integration::TextResourceType& textRequest,
- const std::string& fontFamily,
- bool getBitmap) const = 0;
-
- /**
- * Called by GlyphResourceManager to synchronously load glyph data.
- *
- * @note fontFamily and font style, included in the resource request, must have been validated previously.
- * @see ValidateFontFamilyName().
- *
- * @param[in] textRequest resource request
- * @param[in] fontFamily name of the font's family
- * @return A GlyphSet pointer containing the requested glyph bitmaps.
- */
- virtual Integration::GlyphSet* GetCachedGlyphData( const TextResourceType& textRequest,
- const std::string& fontFamily ) const = 0;
-
- /**
- * Called by Font objects to synchronously query global font metrics.
- *
- * @note fontFamily and fontStyle, must have been validated previously.
- * @see ValidateFontFamilyName().
- *
- * @param[in] fontFamily The name of the font's family
- * @param[in] fontStyle The style of the font
- * @param[out] globalMetrics font requested global metrics.
- */
- virtual void GetGlobalMetrics( const std::string& fontFamily,
- const std::string& fontStyle,
- Integration::GlobalMetrics& globalMetrics ) const = 0;
-
/**
* Sets horizontal and vertical pixels per inch value that is used by the display
* @param[in] dpiHorizontal horizontal dpi value
@@ -243,56 +169,6 @@ public:
virtual void SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical) = 0;
/**
- * Returns the name of the font's family for displayed text.
- * If possible, the returned font name should be able to display all characters in text.
- * Otherwise returns closest match.
- * @param[in] charsRequested displayed text
- */
- virtual const std::string& GetFontFamilyForChars(const TextArray& charsRequested) const = 0;
-
- /**
- * Checks whether all characters of text could be displayed with specified font family.
- *
- * @note fontFamily and fontStyle must have been validated previously.
- * @see ValidateFontFamilyName().
- *
- * @param[in] fontFamily The name of the font's family
- * @param[in] fontStyle The style of the font
- * @param[in] text displayed text
- */
- virtual bool AllGlyphsSupported(const std::string& fontFamily, const std::string& fontStyle, const TextArray& text) const = 0;
-
- /**
- * Checks whether fontName is a valid font family name and fontStyle is a valid font style.
- * closestFontFamilyMatch and closestFontStyleMatch are always set to the best matching font
- * or the system default font if no near match is detected.
- * @param[in] fontFamily The name of the font's family
- * @param[in] fontStyle The style of the font
- * @param[out] isDefaultSystemFont Whether this font has been created with a default system font.
- * @param[out] closestFontFamilyMatch Name of the font's family found based on the user input family's name
- * @param[out] closestFontStyleMatch Name of the font's style found based on the user input font's style
- * @return Whether a valid match has been found.
- */
- virtual bool ValidateFontFamilyName(const std::string& fontFamily, const std::string& fontStyle, bool& isDefaultSystemFont, std::string& closestFontFamilyMatch, std::string& closestFontStyleMatch) const = 0;
-
- /**
- * The mode for GetFontList()
- */
- enum FontListMode
- {
- LIST_SYSTEM_FONTS,
- LIST_APPLICATION_FONTS,
- LIST_ALL_FONTS
- };
-
- /**
- * Gets a list of fonts installed on the system.
- * @param[in] mode which fonts to include in the list.
- * @param[out] fontList The list of font family names.
- */
- virtual void GetFontList( FontListMode mode, std::vector& fontList ) const = 0;
-
- /**
* Load a file into a buffer
* @param[in] filename The filename to load
* @param[out] buffer A buffer to receive the file.
@@ -310,95 +186,10 @@ public:
virtual bool SaveFile(const std::string& filename, std::vector< unsigned char >& buffer) const = 0;
/**
- * This method re-loads the device defaults that Dali uses. Adaptor will call this
- * when devices settings change.
- */
- virtual void UpdateDefaultsFromDevice() = 0;
-
- /**
* Get a pointer to the DynamicsFactory.
*/
virtual DynamicsFactory* GetDynamicsFactory() = 0;
- /**
- * Read from the metrics cache into the global metrics parameter
- *
- * @note fontFamily and fontStyle must have been validated previously.
- * @see ValidateFontFamilyName().
- *
- * @param[in] fontFamily The name of the font family
- * @param[in] fontStyle The name of the font style
- * @param[out] globalMetrics The data store to write into
- * @return \e true if the operation succeeded
- */
- virtual bool ReadGlobalMetricsFromCache( const std::string& fontFamily,
- const std::string& fontStyle,
- Integration::GlobalMetrics& globalMetrics ) = 0;
-
- /**
- *
- * @note fontFamily and fontStyle must have been validated previously.
- * @see ValidateFontFamilyName().
- *
- * Write the global metrics parameter to the metrics cache
- * @param[in] fontFamily The name of the font family
- * @param[in] fontStyle The name of the font style
- * @param[out] globalMetrics The data store to write
- */
- virtual void WriteGlobalMetricsToCache( const std::string& fontFamily,
- const std::string& fontStyle,
- const Integration::GlobalMetrics& globalMetrics ) = 0;
-
- /**
- * Read the metrics from the cache into the supplied vector
- *
- * @note fontFamily and fontStyle must have been validated previously.
- * @see ValidateFontFamilyName().
- *
- * @param[in] fontFamily The name of the font family
- * @param[in] fontStyle The name of the font style
- * @param[out] glyphMetricsContainer The vector of metrics to write
- * @return true if the operation succeeded
- */
- virtual bool ReadMetricsFromCache( const std::string& fontFamily,
- const std::string& fontStyle,
- std::vector& glyphMetricsContainer ) = 0;
-
- /**
- * Write the metrics to the cache
- *
- * @note fontFamily and fontStyle must have been validated previously.
- * @see ValidateFontFamilyName().
- *
- * @param[in] fontFamily The name of the font family
- * @param[in] fontStyle The name of the font style
- * @param[in] glyphSet The set of metrics to write
- */
- virtual void WriteMetricsToCache( const std::string& fontFamily,
- const std::string& fontStyle,
- const Integration::GlyphSet& glyphSet ) = 0;
-
- /**
- * Retrieves file names from the given directory.
- *
- * @param[in] directoryName The directory name.
- * @param[out] fileNames The file names in the given directory.
- */
- virtual void GetFileNamesFromDirectory( const std::string& directoryName,
- std::vector& fileNames ) = 0;
-
- /**
- * Retrieves the glyph image which represents the character.
- *
- * @param[in] fontFamily The font's family name.
- * @param[in] fontStyle The font's style.
- * @param[in] fontSize The font's size (in points).
- * @param[in] character The given character.
- *
- * @return A bitmap representing the character.
- */
- virtual Integration::BitmapPtr GetGlyphImage( const std::string& fontFamily, const std::string& fontStyle, float fontSize, uint32_t character ) const = 0;
-
}; // class PlatformAbstraction
} // namespace Integration
diff --git a/dali/integration-api/profiling.cpp b/dali/integration-api/profiling.cpp
index 4343fe5..bd3e6f2 100644
--- a/dali/integration-api/profiling.cpp
+++ b/dali/integration-api/profiling.cpp
@@ -26,14 +26,12 @@
#include
#include
-#include
#include
#include
#include
#include
#include
-#include
#include
#include
@@ -48,7 +46,6 @@
#include
#include
-#include
#include
#include
@@ -66,7 +63,6 @@
#include
#include
#include
-#include
#include
@@ -74,7 +70,6 @@
#include
#include
-#include
#include
using Dali::Internal::GestureEventProcessor;
@@ -126,13 +121,6 @@ const int CAMERA_ACTOR_MEMORY_SIZE(
sizeof( Internal::CameraAttachment ) +
sizeof( Internal::SceneGraph::Node ) +
sizeof( Internal::SceneGraph::CameraAttachment ) );
-const int TEXT_ACTOR_MEMORY_SIZE(
- sizeof( Internal::TextActor ) +
- sizeof( Internal::TextAttachment ) +
- sizeof( Internal::SceneGraph::Node ) +
- sizeof( Internal::SceneGraph::TextAttachment ) +
- sizeof( Internal::TextParameters ) +
- sizeof( Internal::SceneGraph::TextRenderer ) );
const int MESH_ACTOR_MEMORY_SIZE(
sizeof( Internal::MeshActor ) +
sizeof( Internal::MeshAttachment ) +
diff --git a/dali/integration-api/resource-cache.h b/dali/integration-api/resource-cache.h
index f094033..e5fa3d6 100644
--- a/dali/integration-api/resource-cache.h
+++ b/dali/integration-api/resource-cache.h
@@ -21,7 +21,6 @@
// INTERNAL INCLUDES
#include
#include
-#include
namespace Dali
{
diff --git a/dali/integration-api/resource-types.h b/dali/integration-api/resource-types.h
index 4174b0e..1811a3d 100644
--- a/dali/integration-api/resource-types.h
+++ b/dali/integration-api/resource-types.h
@@ -45,8 +45,7 @@ enum ResourceTypeId
ResourceTargetImage,
ResourceShader,
ResourceModel,
- ResourceMesh,
- ResourceText
+ ResourceMesh
};
/**
@@ -266,145 +265,6 @@ private:
};
/**
- * TextResourceType describes a font resource, which can be requested.
- * from PlatformAbstraction::LoadResource() No font atlas is created.
- */
-struct TextResourceType : public ResourceType
-{
- /**
- * Text quality enum
- */
- enum TextQuality
- {
- TextQualityLow, ///< Request lower quality text
- TextQualityHigh ///< Request higher quality text
- };
-
- /**
- * Structure for requesting character to be loaded from file with atlas position
- * for automatic texture upload
- */
- struct GlyphPosition
- {
- GlyphPosition(unsigned int chr, unsigned int xPos, unsigned int yPos)
- : character(chr),
- quality(0),
- loaded(0),
- xPosition(xPos),
- yPosition(yPos)
- {
- }
-
- /** \addtogroup GlyphPositionPackedWord
- * We have 32 bits available for this data because of the alignment restrictions
- * on the 32 bit words that follow so rather than using the minimum number of
- * bits for each, we give "loaded" a whole 8 bits and push it to a byte-aligned
- * address to make access possible via a plain byte load instead of a load,
- * mask, shift sequence. The naive bitwidths before this modification are as follows:
- * character:21;
- * quality:1;
- * loaded:1;
- * @{
- */
- uint32_t character:21; ///< character code (UTF-32), max value of 0x10ffff (21 bits)
- uint32_t quality:3; ///< Loaded quality 0 = low quality, 1 = high quality
- uint32_t loaded:8; ///< true if Loaded
- /** @}*/
-
- uint32_t xPosition; ///< X Position in atlas
- uint32_t yPosition; ///< Y Position in atlas
-
- /**
- * Used by ResourceTypeCompare
- */
- friend bool operator==(const GlyphPosition& lhs, const GlyphPosition& rhs);
- };
-
- typedef std::vector< GlyphPosition > CharacterList; ///< List of glyphs requested
-
- enum GlyphCacheMode
- {
- GLYPH_CACHE_READ, ///< Doesn't cache glyphs.
- GLYPH_CACHE_WRITE, ///< Caches glyphs.
- };
-
- /**
- * Text resource type constructor
- * @param [in] hash The resourceHash for the FontAtlas and FontMetrics
- * @param [in] style The font style
- * @param [in] characterList The requested text as a vector or UTF-32 codes
- * @param [in] textureAtlasId The resource ID of the texture atlas
- * @param [in] quality A boolean, set to true to request high quality glyph bitmaps.
- * @param [in] maxGlyphSize The size of the largest glyph in the font.
- * @param [in] cache Whether text glyph should be cached or not.
- */
- TextResourceType( const size_t hash,
- const std::string& style,
- const CharacterList& characterList,
- ResourceId textureAtlasId,
- TextQuality quality = TextQualityLow,
- Vector2 maxGlyphSize = Vector2::ONE,
- GlyphCacheMode cache = GLYPH_CACHE_READ )
- : ResourceType(ResourceText),
- mFontHash(hash),
- mStyle(style),
- mCharacterList(characterList),
- mTextureAtlasId(textureAtlasId),
- mQuality(quality),
- mMaxGlyphSize(maxGlyphSize),
- mCache( cache )
- {
- }
-
- /**
- * virtual destructor
- */
- virtual ~TextResourceType()
- {
- }
-
- /**
- * @copydoc ResourceType::Clone
- */
- virtual ResourceType* Clone() const
- {
- return new TextResourceType(mFontHash, mStyle, mCharacterList, mTextureAtlasId, mQuality, mMaxGlyphSize, mCache);
- }
-
- /**
- * Font resource hash.
- */
- const size_t mFontHash;
-
- /**
- * Font style.
- */
- const std::string mStyle;
-
- /**
- * Displayed text (UTF-32 codes)
- */
-
- CharacterList mCharacterList; ///< List of characters
-
- ResourceId mTextureAtlasId; ///< Resource ID of the texture atlas this request is for
-
- TextQuality mQuality; ///< Text quality setting
-
- Vector2 mMaxGlyphSize; ///< Max glyph size for font
-
- GlyphCacheMode mCache; ///< Whether text glyphs should be cached.
-
-private:
-
- // Undefined copy constructor.
- TextResourceType(const TextResourceType& typePath);
-
- // Undefined copy constructor.
- TextResourceType& operator=(const TextResourceType& rhs);
-};
-
-/**
* ModelResourceType describes a model resource, which can be requested
* from PlatformAbstraction::LoadResource()
*/
@@ -477,11 +337,6 @@ private:
MeshResourceType& operator=(const MeshResourceType& rhs);
};
-inline bool operator==(const TextResourceType::GlyphPosition& lhs, const TextResourceType::GlyphPosition& rhs)
-{
- return lhs.character == rhs.character && lhs.xPosition == rhs.xPosition && lhs.yPosition == rhs.yPosition && lhs.quality == rhs.quality;
-}
-
} // namespace Integration
} // namespace Dali
diff --git a/dali/integration-api/text-array.h b/dali/integration-api/text-array.h
deleted file mode 100644
index 70d78ef..0000000
--- a/dali/integration-api/text-array.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef __DALI_INTERNAL_TEXT_ARRAY_H__
-#define __DALI_INTERNAL_TEXT_ARRAY_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include
-
-// INTERNAL INCLUDES
-#include
-
-namespace Dali
-{
-
-namespace Integration
-{
-
-/**
- * array of UTF-32 codes.
- */
-typedef Vector TextArray;
-
-} // namespace Integration
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_TEXT_ARRAY_H__
diff --git a/dali/internal/common/bitmap-upload.h b/dali/internal/common/bitmap-upload.h
index d6419c1..700785f 100644
--- a/dali/internal/common/bitmap-upload.h
+++ b/dali/internal/common/bitmap-upload.h
@@ -80,7 +80,7 @@ typedef std::vector BitmapUploadArray; ///< typedef for a array of
/**
- * Structure is used for clearing areas of the atlas prior to loading glyphs
+ * Structure is used for clearing areas of the bitmap
*/
typedef std::vector BitmapClearArray;
diff --git a/dali/internal/common/core-impl.cpp b/dali/internal/common/core-impl.cpp
index 97787c7..8f788ed 100644
--- a/dali/internal/common/core-impl.cpp
+++ b/dali/internal/common/core-impl.cpp
@@ -39,9 +39,7 @@
#include
#include
#include
-#include
#include
-#include
#include
#include
#include
@@ -95,11 +93,9 @@ Core::Core( RenderController& renderController, PlatformAbstraction& platform,
mDiscardQueue(NULL),
mResourcePostProcessQueue(),
mNotificationManager(NULL),
- mFontFactory(NULL),
mImageFactory(NULL),
mModelFactory(NULL),
mShaderFactory(NULL),
- mEmojiFactory(NULL),
mIsActive(true),
mProcessingEvent(false)
{
@@ -163,12 +159,10 @@ Core::Core( RenderController& renderController, PlatformAbstraction& platform,
mGestureEventProcessor = new GestureEventProcessor(*mStage, gestureManager, mRenderController);
mEventProcessor = new EventProcessor(*mStage, *mNotificationManager, *mGestureEventProcessor);
- mFontFactory = new FontFactory(*mResourceClient);
mImageFactory = new ImageFactory( *mResourceClient );
mModelFactory = new ModelFactory(*mResourceClient);
mShaderFactory = new ShaderFactory(*mResourceClient);
mShaderFactory->LoadDefaultShaders();
- mEmojiFactory = new EmojiFactory();
GetImplementation(Dali::TypeRegistry::Get()).CallInitFunctions();
}
@@ -199,7 +193,6 @@ Core::~Core()
delete mEventProcessor;
delete mGestureEventProcessor;
delete mNotificationManager;
- delete mFontFactory;
delete mImageFactory;
delete mModelFactory;
delete mShaderFactory;
@@ -207,7 +200,6 @@ Core::~Core()
delete mResourceManager;
delete mUpdateManager;
delete mTouchResampler;
- delete mEmojiFactory;
delete mRenderManager;
delete mDiscardQueue;
delete mResourcePostProcessQueue;
@@ -223,7 +215,6 @@ void Core::RecoverFromContextLoss()
DALI_LOG_INFO(gCoreFilter, Debug::Verbose, "Core::RecoverFromContextLoss()\n");
mImageFactory->RecoverFromContextLoss(); // Reload images from files
- mFontFactory->RecoverFromContextLoss(); // Reload glyphs from cache into new atlas
mStage->GetRenderTaskList().RecoverFromContextLoss(); // Re-trigger render-tasks
}
@@ -245,7 +236,6 @@ void Core::SurfaceResized(unsigned int width, unsigned int height)
void Core::SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical)
{
mPlatform.SetDpi( dpiHorizontal, dpiVertical );
- mFontFactory->SetDpi( dpiHorizontal, dpiVertical);
mStage->SetDpi( Vector2( dpiHorizontal , dpiVertical) );
}
@@ -333,9 +323,6 @@ void Core::ProcessEvents()
// Flush discard queue for image factory
mImageFactory->FlushReleaseQueue();
- // send text requests if required
- mFontFactory->SendTextRequests();
-
// Flush any queued messages for the update-thread
const bool messagesToProcess = eventToUpdate.FlushQueue();
@@ -424,11 +411,6 @@ ResourceClient& Core::GetResourceClient()
return *(mResourceClient);
}
-FontFactory& Core::GetFontFactory()
-{
- return *(mFontFactory);
-}
-
ImageFactory& Core::GetImageFactory()
{
return *(mImageFactory);
@@ -449,11 +431,6 @@ GestureEventProcessor& Core::GetGestureEventProcessor()
return *(mGestureEventProcessor);
}
-EmojiFactory& Core::GetEmojiFactory()
-{
- return *mEmojiFactory;
-}
-
void Core::CreateThreadLocalStorage()
{
// a pointer to the ThreadLocalStorage object will be stored in TLS
diff --git a/dali/internal/common/core-impl.h b/dali/internal/common/core-impl.h
index b456e82..aa0ce23 100644
--- a/dali/internal/common/core-impl.h
+++ b/dali/internal/common/core-impl.h
@@ -56,12 +56,10 @@ class EventProcessor;
class GestureEventProcessor;
class ResourceClient;
class ResourceManager;
-class FontFactory;
class ImageFactory;
class ModelFactory;
class ShaderFactory;
class TouchResampler;
-class EmojiFactory;
namespace SceneGraph
{
@@ -239,12 +237,6 @@ private: // for use by ThreadLocalStorage
ResourceClient& GetResourceClient();
/**
- * Returns the Font factory
- * @return A reference to the Font factory.
- */
- FontFactory& GetFontFactory();
-
- /**
* Returns the Image factory
* @return A reference to the Image factory.
*/
@@ -268,12 +260,6 @@ private: // for use by ThreadLocalStorage
*/
GestureEventProcessor& GetGestureEventProcessor();
- /**
- * Returns the Emoji factory.
- * @return a reference to the Emoji factory.
- */
- EmojiFactory& GetEmojiFactory();
-
private:
/**
@@ -302,14 +288,12 @@ private:
NotificationManager* mNotificationManager; ///< Notification manager
AnimationPlaylistOwner mAnimationPlaylist; ///< For 'Fire and forget' animation support
OwnerPointer mPropertyNotificationManager; ///< For safe signal emmision of property changed notifications
- FontFactory* mFontFactory; ///< font resource factory
ImageFactory* mImageFactory; ///< Image resource factory
ModelFactory* mModelFactory; ///< Model resource factory
ShaderFactory* mShaderFactory; ///< Shader resource factory
ResourceClient* mResourceClient; ///< Asynchronous Resource Loading
ResourceManager* mResourceManager; ///< Asynchronous Resource Loading
TouchResampler* mTouchResampler; ///< Resamples touches to correct frame rate.
- EmojiFactory* mEmojiFactory; ///< Emoji resource factory.
bool mIsActive : 1; ///< Whether Core is active or suspended
bool mProcessingEvent : 1; ///< True during ProcessEvents()
diff --git a/dali/internal/common/text-parameters.cpp b/dali/internal/common/text-parameters.cpp
deleted file mode 100644
index 7edcae2..0000000
--- a/dali/internal/common/text-parameters.cpp
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include
-
-// INTERNAL INCLUDES
-#include
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-TextParameters::TextParameters()
-: mFlags( 0 )
-{
-}
-
-TextParameters::~TextParameters()
-{
- // destroy all containers.
- if ( mFlags & OUTLINE_EXISTS )
- {
- OutlineAttributes* attrPtr = reinterpret_cast( *( mParameters.Begin() + ( mFlags & TEXT_PARAMETER_MASK ) ) );
- delete attrPtr;
- }
- if ( mFlags & GLOW_EXISTS )
- {
- GlowAttributes* attrPtr = reinterpret_cast( *( mParameters.Begin() + ( ( mFlags >> GLOW_INDEX_SHIFT ) & TEXT_PARAMETER_MASK ) ) );
- delete attrPtr;
- }
- if ( mFlags & DROP_SHADOW_EXISTS )
- {
- DropShadowAttributes* attrPtr = reinterpret_cast( *( mParameters.Begin() + ( ( mFlags >> DROP_SHADOW_INDEX_SHIFT ) & TEXT_PARAMETER_MASK ) ) );
- delete attrPtr;
- }
- if ( mFlags & GRADIENT_EXISTS )
- {
- GradientAttributes* attrPtr = reinterpret_cast( *( mParameters.Begin() + ( ( mFlags >> GRADIENT_INDEX_SHIFT ) & TEXT_PARAMETER_MASK ) ) );
- delete attrPtr;
- }
-}
-
-void TextParameters::SetOutline( bool enable, const Vector4& color, const Vector2& thickness )
-{
- if ( mFlags & OUTLINE_EXISTS )
- {
- OutlineAttributes* attrPtr = reinterpret_cast( *( mParameters.Begin() + ( mFlags & TEXT_PARAMETER_MASK ) ) );
- attrPtr->mOutlineColor = color;
- attrPtr->mOutlineThickness = thickness;
- }
- else
- {
- OutlineAttributes* attr = new OutlineAttributes();
- attr->mOutlineColor = color;
- attr->mOutlineThickness = thickness;
- mFlags |= ( ( mFlags & ~OUTLINE_INDEX ) | ( mParameters.Size() & TEXT_PARAMETER_MASK ) | OUTLINE_EXISTS );
- mParameters.PushBack( reinterpret_cast( attr ) );
- }
-
- if( enable )
- {
- mFlags |= OUTLINE_ENABLED;
- }
- else
- {
- mFlags &= ~OUTLINE_ENABLED;
- }
-}
-
-void TextParameters::SetGlow( bool enable, const Vector4& color, float intensity )
-{
- if ( mFlags & GLOW_EXISTS )
- {
- GlowAttributes* attrPtr = reinterpret_cast( *( mParameters.Begin() + ( ( mFlags >> GLOW_INDEX_SHIFT ) & TEXT_PARAMETER_MASK ) ) );
- attrPtr->mGlowColor = color;
- attrPtr->mGlowIntensity = intensity;
- }
- else
- {
- GlowAttributes* attr = new GlowAttributes();
- attr->mGlowColor = color;
- attr->mGlowIntensity = intensity;
- mFlags |= ( ( mFlags & ~GLOW_INDEX ) | ( ( mParameters.Size() & TEXT_PARAMETER_MASK ) << GLOW_INDEX_SHIFT ) | GLOW_EXISTS );
- mParameters.PushBack( reinterpret_cast( attr ) );
- }
-
- if( enable )
- {
- mFlags |= GLOW_ENABLED;
- }
- else
- {
- mFlags &= ~GLOW_ENABLED;
- }
-}
-
-void TextParameters::SetShadow( bool enable, const Vector4& color, const Vector2& offset, float size )
-{
- if ( mFlags & DROP_SHADOW_EXISTS )
- {
- DropShadowAttributes* attrPtr = reinterpret_cast( *( mParameters.Begin() + ( ( mFlags >> DROP_SHADOW_INDEX_SHIFT ) & TEXT_PARAMETER_MASK ) ) );
- attrPtr->mDropShadowColor = color;
- attrPtr->mDropShadowOffset = offset;
- attrPtr->mDropShadowSize = size;
- }
- else
- {
- DropShadowAttributes* attr = new DropShadowAttributes();
- attr->mDropShadowColor = color;
- attr->mDropShadowOffset = offset;
- attr->mDropShadowSize = size;
- mFlags |= ( ( mFlags & ~DROP_SHADOW_INDEX ) | ( ( mParameters.Size() & TEXT_PARAMETER_MASK ) << DROP_SHADOW_INDEX_SHIFT ) | DROP_SHADOW_EXISTS );
- mParameters.PushBack( reinterpret_cast( attr ) );
- }
-
- if( enable )
- {
- mFlags |= DROP_SHADOW_ENABLED;
- }
- else
- {
- mFlags &= ~DROP_SHADOW_ENABLED;
- }
-}
-
-void TextParameters::SetGradient( const Vector4& color, const Vector2& start, const Vector2& end )
-{
- if ( mFlags & GRADIENT_EXISTS )
- {
- GradientAttributes* attrPtr = reinterpret_cast( *( mParameters.Begin() + ( ( mFlags >> GRADIENT_INDEX_SHIFT ) & TEXT_PARAMETER_MASK ) ) );
- attrPtr->mGradientColor = color;
- attrPtr->mGradientStartPoint = start;
- attrPtr->mGradientEndPoint = end;
- }
- else
- {
- GradientAttributes* attr = new GradientAttributes();
- attr->mGradientColor = color;
- attr->mGradientStartPoint = start;
- attr->mGradientEndPoint = end;
- mFlags |= ( ( mFlags & ~GRADIENT_INDEX ) | ( ( mParameters.Size() & TEXT_PARAMETER_MASK ) << GRADIENT_INDEX_SHIFT ) | GRADIENT_EXISTS );
- mParameters.PushBack( reinterpret_cast( attr ) );
- }
-
- if ( end != start )
- {
- mFlags |= GRADIENT_ENABLED;
- }
- else
- {
- mFlags &=~GRADIENT_ENABLED;
- }
-}
-
-const Vector4& TextParameters::GetOutlineColor() const
-{
- if ( mFlags & OUTLINE_ENABLED )
- {
- const OutlineAttributes* attrPtr = reinterpret_cast( *( mParameters.Begin() + ( mFlags & TEXT_PARAMETER_MASK ) ) );
- return attrPtr->mOutlineColor;
- }
- else
- {
- return TextStyle::DEFAULT_OUTLINE_COLOR;
- }
-}
-
-const Vector2& TextParameters::GetOutlineThickness() const
-{
- if ( mFlags & OUTLINE_EXISTS )
- {
- const OutlineAttributes* attrPtr = reinterpret_cast( *( mParameters.Begin() + ( mFlags & TEXT_PARAMETER_MASK ) ) );
- return attrPtr->mOutlineThickness;
- }
- else
- {
- return TextStyle::DEFAULT_OUTLINE_THICKNESS;
- }
-}
-
-const Vector4& TextParameters::GetGlowColor() const
-{
- if ( mFlags & GLOW_EXISTS )
- {
- const GlowAttributes* attrPtr = reinterpret_cast( *( mParameters.Begin() + ( ( mFlags >> GLOW_INDEX_SHIFT ) & TEXT_PARAMETER_MASK ) ) );
- return attrPtr->mGlowColor;
- }
- else
- {
- return TextStyle::DEFAULT_GLOW_COLOR;
- }
-}
-
-float TextParameters::GetGlowIntensity() const
-{
- if ( mFlags & GLOW_EXISTS )
- {
- const GlowAttributes* attrPtr = reinterpret_cast( *( mParameters.Begin() + ( ( mFlags >> GLOW_INDEX_SHIFT ) & TEXT_PARAMETER_MASK ) ) );
- return attrPtr->mGlowIntensity;
- }
- else
- {
- return TextStyle::DEFAULT_GLOW_INTENSITY;
- }
-}
-
-const Vector4& TextParameters::GetDropShadowColor() const
-{
- if ( mFlags & DROP_SHADOW_EXISTS )
- {
- const DropShadowAttributes* attrPtr = reinterpret_cast( *( mParameters.Begin() + ( ( mFlags >> DROP_SHADOW_INDEX_SHIFT ) & TEXT_PARAMETER_MASK ) ) );
- return attrPtr->mDropShadowColor;
- }
- else
- {
- return TextStyle::DEFAULT_SHADOW_COLOR;
- }
-}
-
-const Vector2& TextParameters::GetDropShadowOffset() const
-{
- if ( mFlags & DROP_SHADOW_EXISTS )
- {
-
- const DropShadowAttributes* attrPtr = reinterpret_cast( *( mParameters.Begin() + ( ( mFlags >> DROP_SHADOW_INDEX_SHIFT ) & TEXT_PARAMETER_MASK ) ) );
- return attrPtr->mDropShadowOffset;
- }
- else
- {
- return TextStyle::DEFAULT_SHADOW_OFFSET;
- }
-}
-
-float TextParameters::GetDropShadowSize() const
-{
- if ( mFlags & DROP_SHADOW_EXISTS )
- {
- const DropShadowAttributes* attrPtr = reinterpret_cast( *( mParameters.Begin() + ( ( mFlags >> DROP_SHADOW_INDEX_SHIFT ) & TEXT_PARAMETER_MASK ) ) );
- return attrPtr->mDropShadowSize;
- }
- else
- {
- return TextStyle::DEFAULT_SHADOW_SIZE;
- }
-}
-
-const Vector4& TextParameters::GetGradientColor() const
-{
- if ( mFlags & GRADIENT_EXISTS )
- {
- const GradientAttributes* attrPtr = reinterpret_cast( *( mParameters.Begin() + ( ( mFlags >> GRADIENT_INDEX_SHIFT ) & TEXT_PARAMETER_MASK ) ) );
- return attrPtr->mGradientColor;
- }
- else
- {
- return TextStyle::DEFAULT_GRADIENT_COLOR;
- }
-}
-
-const Vector2& TextParameters::GetGradientStartPoint() const
-{
- if ( mFlags & GRADIENT_EXISTS )
- {
- const GradientAttributes* attrPtr = reinterpret_cast( *( mParameters.Begin() + ( ( mFlags >> GRADIENT_INDEX_SHIFT ) & TEXT_PARAMETER_MASK ) ) );
- return attrPtr->mGradientStartPoint;
- }
- else
- {
- return TextStyle::DEFAULT_GRADIENT_START_POINT;
- }
-}
-
-const Vector2& TextParameters::GetGradientEndPoint() const
-{
- if ( mFlags & GRADIENT_EXISTS )
- {
- const GradientAttributes* attrPtr = reinterpret_cast( *( mParameters.Begin() + ( ( mFlags >> GRADIENT_INDEX_SHIFT ) & TEXT_PARAMETER_MASK ) ) );
- return attrPtr->mGradientEndPoint;
- }
- else
- {
- return TextStyle::DEFAULT_GRADIENT_END_POINT;
- }
-}
-
-} // namespace Internal
-
-} // namespace Dali
diff --git a/dali/internal/common/text-parameters.h b/dali/internal/common/text-parameters.h
deleted file mode 100644
index 8252523..0000000
--- a/dali/internal/common/text-parameters.h
+++ /dev/null
@@ -1,264 +0,0 @@
-#ifndef __INTERNAL_TEXT_PARAMETERS_H__
-#define __INTERNAL_TEXT_PARAMETERS_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL HEADERS
-#include
-#include
-#include
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-
- // Number of bits for an index mask - increase if more attributes are added...
- const unsigned int TEXT_PARAMETER_BITS = 2u;
-
- // Set mask for this number of bits
- const unsigned int TEXT_PARAMETER_MASK = ~( -1 << TEXT_PARAMETER_BITS );
-
- // Shift values for attribute indices
- const unsigned int OUTLINE_INDEX_SHIFT = 0u;
- const unsigned int GLOW_INDEX_SHIFT = OUTLINE_INDEX_SHIFT + TEXT_PARAMETER_BITS;
- const unsigned int DROP_SHADOW_INDEX_SHIFT = GLOW_INDEX_SHIFT + TEXT_PARAMETER_BITS;
- const unsigned int GRADIENT_INDEX_SHIFT = DROP_SHADOW_INDEX_SHIFT + TEXT_PARAMETER_BITS;
- const unsigned int TEXT_PARAMETER_FLAGS = GRADIENT_INDEX_SHIFT + TEXT_PARAMETER_BITS;
-
- // Position in flags for attribute index
- const unsigned int OUTLINE_INDEX = 0u; // bits 0,1
- const unsigned int GLOW_INDEX = TEXT_PARAMETER_MASK << GLOW_INDEX_SHIFT; // bits 2,3
- const unsigned int DROP_SHADOW_INDEX = TEXT_PARAMETER_MASK << DROP_SHADOW_INDEX_SHIFT; // bits 4,5
- const unsigned int GRADIENT_INDEX = TEXT_PARAMETER_MASK << GRADIENT_INDEX_SHIFT; // bits 6,7
-
- // Flag positions for attributes ( gradient has two as parameters can be set independently )
- const unsigned int OUTLINE_EXISTS = 1u << TEXT_PARAMETER_FLAGS; // bit 8
- const unsigned int OUTLINE_ENABLED = 1u << ( TEXT_PARAMETER_FLAGS + 1u ); // bit 9
- const unsigned int GLOW_EXISTS = 1u << ( TEXT_PARAMETER_FLAGS + 2u ); // bit 10
- const unsigned int GLOW_ENABLED = 1u << ( TEXT_PARAMETER_FLAGS + 3u ); // bit 11
- const unsigned int DROP_SHADOW_EXISTS = 1u << ( TEXT_PARAMETER_FLAGS + 4u ); // bit 12
- const unsigned int DROP_SHADOW_ENABLED = 1u << ( TEXT_PARAMETER_FLAGS + 5u ); // bit 13
- const unsigned int GRADIENT_EXISTS = 1u << ( TEXT_PARAMETER_FLAGS + 6u ); // bit 14
- const unsigned int GRADIENT_ENABLED = 1u << ( TEXT_PARAMETER_FLAGS + 7u ); // bit 15
- const unsigned int ATTRIBUTE_END = GRADIENT_ENABLED;
-
-/**
- * class TextParameters internal class to encapsulate (and allow on demand allocation) of
- * text effect parameters like, outline, glow and shadow
- */
-class TextParameters
-{
-public:
-
- /**
- * @brief Outline attributes
- */
- struct OutlineAttributes
- {
- Vector4 mOutlineColor;
- Vector2 mOutlineThickness;
- };
-
- /**
- * @brief Glow attributes
- */
- struct GlowAttributes
- {
- Vector4 mGlowColor;
- float mGlowIntensity;
- };
-
- /**
- * @brief Drop Shadow attributes
- */
- struct DropShadowAttributes
- {
- Vector4 mDropShadowColor;
- Vector2 mDropShadowOffset;
- float mDropShadowSize;
- };
-
- /**
- * @brief Gradient attributes
- */
- struct GradientAttributes
- {
- Vector4 mGradientColor;
- Vector2 mGradientStartPoint;
- Vector2 mGradientEndPoint;
- };
-
- /**
- * Constructor
- */
- TextParameters();
-
- /**
- * Destructor
- */
- ~TextParameters();
-
- /// @copydoc Dali::TextActor::SetOutline
- void SetOutline( bool enable, const Vector4& color, const Vector2& thickness );
-
- /// @copydoc Dali::TextActor::SetGlow
- void SetGlow( bool enable, const Vector4& color, float intensity );
-
- /// @copydoc Dali::TextActor::SetShadow
- void SetShadow( bool enable, const Vector4& color, const Vector2& offset, float size );
-
- /**
- * @brief Set Gradient parameters.
- * @param[in] color The gradient color (end-point color)
- * @param[in] start The relative position of the gradient start point.
- * @param[in] end The relative position of the gradient end point.
- */
- void SetGradient( const Vector4& color, const Vector2& start, const Vector2& end );
-
- /**
- * @brief Get the Gradient Color
- *
- * @return Gradient Color
- */
- const Vector4& GetOutlineColor() const;
-
- /**
- * @brief Get Outline Thickness
- *
- * @return Outline Thickness
- */
- const Vector2& GetOutlineThickness() const;
-
- /**
- * @brief Get Glow Color
- *
- * @return Glow Color
- */
- const Vector4& GetGlowColor() const;
-
- /**
- * @brief Get Glow Intensity
- *
- * @return Glow Intensity
- */
- float GetGlowIntensity() const;
-
- /**
- * @brief Get Drop Shadow Color
- *
- * @return Drop Shadow Color
- */
- const Vector4& GetDropShadowColor() const;
-
- /**
- * @brief Get Drop Shadow Offset
- *
- * @return Drop Shadow Offset
- */
- const Vector2& GetDropShadowOffset() const;
-
- /**
- * @brief Get Drop Shadow Size
- *
- * @return Drop Shadow Size
- */
- float GetDropShadowSize() const;
-
- /**
- * @brief Get Gradient Color
- *
- * @return Gradient Color
- */
- const Vector4& GetGradientColor() const;
-
- /**
- * @brief Get Gradient Start Point
- *
- * @return Position of Gradient Start Point
- */
- const Vector2& GetGradientStartPoint() const;
-
- /**
- * @brief Get Gradient End Point
- *
- * @return Position of Gradient End Point
- */
- const Vector2& GetGradientEndPoint() const;
-
- /**
- * @brief Get if Outline is enabled
- *
- * @return true if enabled, false if not
- */
- bool IsOutlineEnabled() const
- {
- return ( ( mFlags & OUTLINE_ENABLED ) != 0 );
- }
-
- /**
- * @brief Get if Glow is enabled
- *
- * @return true if enabled, false if not
- */
- bool IsGlowEnabled() const
- {
- return ( ( mFlags & GLOW_ENABLED ) != 0 );
- }
-
- /**
- * @brief Get if Drop Shadow is enabled
- *
- * @return true if enabled, false if not
- */
- bool IsDropShadowEnabled() const
- {
- return ( ( mFlags & DROP_SHADOW_ENABLED ) != 0 );
- }
-
- /**
- * @brief Get if Gradient is enabled
- *
- * @return true if enabled, false if not
- */
- bool IsGradientEnabled() const
- {
- return ( ( mFlags & GRADIENT_ENABLED ) != 0 );
- }
-
-private: // unimplemented copy constructor and assignment operator
- TextParameters( const TextParameters& copy );
- TextParameters& operator=(const TextParameters& rhs);
-
- Vector mParameters; // container for any used attributes
-
-#if ( ATTRIBUTE_END > 0x8000 )
- unsigned int mFlags; // flags for used attributes, packed with position in container
-#else
- unsigned short mFlags; // might be rendered irrelevant by alignment / packing
-#endif
-
-}; // class TextParameters
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __INTERNAL_TEXT_PARAMETERS_H__
diff --git a/dali/internal/common/text-vertex-buffer.h b/dali/internal/common/text-vertex-buffer.h
deleted file mode 100644
index 1459ace..0000000
--- a/dali/internal/common/text-vertex-buffer.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef __DALI_INTERNAL_TEXT_VERTEX_BUFFER_H__
-#define __DALI_INTERNAL_TEXT_VERTEX_BUFFER_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include
-#include
-#include
-#include
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-/*
- * Vertex data for display text.
- * No indices are stored because, text is an array of quads.
- * each character quad is made up for 2 triangles (4 points).
- */
-struct TextVertexBuffer
-{
- std::vector mVertices; ///< List of vertices (coordinates and texture coordinates)
- unsigned int mTextureId; ///< Texture id
- Vector2 mVertexMax; ///< Calculated unskewed geometry size
- Vector2 mGeometryExtent; ///< Actual extents of geometry
-};
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_TEXT_VERTEX_BUFFER_H__
diff --git a/dali/internal/event/actor-attachments/actor-attachment-declarations.h b/dali/internal/event/actor-attachments/actor-attachment-declarations.h
index 3759f37..36744ea 100644
--- a/dali/internal/event/actor-attachments/actor-attachment-declarations.h
+++ b/dali/internal/event/actor-attachments/actor-attachment-declarations.h
@@ -32,7 +32,6 @@ class ActorAttachment;
class CameraAttachment;
class ImageAttachment;
class LightAttachment;
-class TextAttachment;
class MeshAttachment;
typedef IntrusivePtr ActorAttachmentPtr;
@@ -40,7 +39,6 @@ typedef IntrusivePtr CameraAttachmentPtr;
typedef IntrusivePtr ImageAttachmentPtr;
typedef IntrusivePtr LightAttachmentPtr;
typedef IntrusivePtr MeshAttachmentPtr;
-typedef IntrusivePtr TextAttachmentPtr;
} // namespace Internal
diff --git a/dali/internal/event/actor-attachments/text-attachment-impl.cpp b/dali/internal/event/actor-attachments/text-attachment-impl.cpp
deleted file mode 100644
index 97ee7ad..0000000
--- a/dali/internal/event/actor-attachments/text-attachment-impl.cpp
+++ /dev/null
@@ -1,631 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-
-#include
-
-// INTERNAL INCLUDES
-
-#include
-#include
-#include
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-TextAttachmentPtr TextAttachment::New( const SceneGraph::Node& parentNode, const Integration::TextArray& text, FontPointer font )
-{
- StagePtr stage = Stage::GetCurrent();
-
- TextAttachmentPtr attachment( new TextAttachment( *stage ) );
-
- // Second-phase construction
-
- attachment->mFont = font;
- attachment->mText = text;
-
- // Transfer object ownership of scene-object to message
- SceneGraph::TextAttachment* sceneObject = SceneGraph::TextAttachment::New();
-
- AttachToNodeMessage( stage->GetUpdateManager(), parentNode, sceneObject );
-
- // Keep raw pointer for message passing
- attachment->mSceneObject = sceneObject;
-
- attachment->CalculateWeightedSmoothing( TextStyle::DEFAULT_FONT_WEIGHT, TextStyle::DEFAULT_SMOOTH_EDGE_DISTANCE_FIELD ); // adjust smoothedge for font weight
-
- return attachment;
-}
-
-TextAttachment::TextAttachment( Stage& stage )
-: RenderableAttachment( stage ),
- mSceneObject( NULL ),
- mTextRequestHelper( *this ),
- mTextColor( NULL ),
- mTextChanged( true ),
- mFontChanged( true ),
- mUnderlineChanged( true ),
- mItalicsChanged( true ),
- mTextureIdSet( false ),
- mTextureId(0),
- mTextSize( Vector3::ZERO )
-{
-}
-
-TextAttachment::~TextAttachment()
-{
- delete mTextColor;
-}
-
-void TextAttachment::SetText( const Integration::TextArray& text )
-{
- // return if the text hasn't changed
- if( ( text.Count() == mText.Count() ) &&
- std::equal( mText.Begin(), mText.End(), text.Begin () ) )
- {
- return;
- }
-
- // Cache for public getters
- mText = text;
- mTextChanged = true;
-}
-
-void TextAttachment::SetFont(Font& font)
-{
- if( font == *mFont )
- {
- return;
- }
- // References the font
- mFont = &font;
- mFontChanged = true;
-}
-
-void TextAttachment::SetTextColor( const Vector4& color )
-{
- bool sendMessage( false );
-
- Vector4 clampedColor = Clamp( color, 0.f, 1.f );
-
- if( NULL == mTextColor )
- {
- // A color (different from default) has been set, so allocate storage for the text color
- mTextColor = new Vector4( clampedColor );
- sendMessage = true;
- }
- else
- {
- if( *mTextColor != clampedColor )
- {
- // text color has changed
- *mTextColor = clampedColor;
- sendMessage = true;
- }
- }
-
- if( sendMessage )
- {
- SetTextColorMessage( mStage->GetUpdateInterface(), *mSceneObject, clampedColor );
- }
-}
-
-Vector4 TextAttachment::GetTextColor() const
-{
- Vector4 color;
-
- if( NULL != mTextColor )
- {
- color = *mTextColor;
- }
- else
- {
- color = TextStyle::DEFAULT_TEXT_COLOR;
- }
-
- return color;
-}
-
-void TextAttachment::ResetTextColor()
-{
- if( NULL != mTextColor )
- {
- delete mTextColor;
- mTextColor = NULL;
-
- SetTextColorMessage( mStage->GetUpdateInterface(), *mSceneObject, TextStyle::DEFAULT_TEXT_COLOR );
- }
-}
-
-void TextAttachment::SetWeight( TextStyle::Weight weight )
-{
- if( mStyle.IsFontWeightDefault() ||
- ( mStyle.GetWeight() != weight ) )
- {
- mStyle.SetWeight( weight );
-
- CalculateWeightedSmoothing( weight, mStyle.GetSmoothEdge() );
- }
-}
-
-TextStyle::Weight TextAttachment::GetWeight() const
-{
- return mStyle.GetWeight();
-}
-
-void TextAttachment::ResetWeight()
-{
- if( !mStyle.IsFontWeightDefault() )
- {
- mStyle.Reset( TextStyle::WEIGHT );
-
- CalculateWeightedSmoothing( TextStyle::DEFAULT_FONT_WEIGHT, mStyle.GetSmoothEdge() );
- }
-}
-
-void TextAttachment::SetSmoothEdge( float smoothEdge )
-{
- if( mStyle.IsSmoothEdgeDefault() ||
- ( fabsf( smoothEdge - mStyle.GetSmoothEdge() ) > Math::MACHINE_EPSILON_1000 ) )
- {
- mStyle.SetSmoothEdge( smoothEdge );
- CalculateWeightedSmoothing( mStyle.GetWeight(), smoothEdge );
- }
-}
-
-float TextAttachment::GetSmoothEdge() const
-{
- return mStyle.GetSmoothEdge();
-}
-
-void TextAttachment::ResetSmoothEdge()
-{
- if( !mStyle.IsSmoothEdgeDefault() )
- {
- mStyle.Reset( TextStyle::SMOOTH );
-
- CalculateWeightedSmoothing( mStyle.GetWeight(), TextStyle::DEFAULT_SMOOTH_EDGE_DISTANCE_FIELD );
- }
-}
-
-void TextAttachment::SetItalics( Radian angle )
-{
- if( mStyle.IsItalicsDefault() ||
- ( Radian( mStyle.GetItalicsAngle() ) != angle ) )
- {
- mItalicsChanged = true;
-
- const Radian radian0( 0.0f );
- mStyle.SetItalics( ( radian0 != angle ), Degree( angle ) );
- }
-}
-
-bool TextAttachment::GetItalics() const
-{
- return mStyle.IsItalicsEnabled();
-}
-
-Radian TextAttachment::GetItalicsAngle() const
-{
- return Radian( mStyle.GetItalicsAngle() );
-}
-
-void TextAttachment::ResetItalics()
-{
- if( !mStyle.IsItalicsDefault() )
- {
- mStyle.Reset( TextStyle::ITALICS );
-
- mItalicsChanged = true;
- }
-}
-
-void TextAttachment::SetUnderline( bool enable, float thickness, float position )
-{
- if( mStyle.IsUnderlineDefault() ||
- ( mStyle.IsUnderlineEnabled() != enable ) ||
- ( fabsf( mStyle.GetUnderlineThickness() - thickness ) > Math::MACHINE_EPSILON_1000 ) ||
- ( fabsf( mStyle.GetUnderlinePosition() - position ) > Math::MACHINE_EPSILON_1000 ) )
- {
- mUnderlineChanged = true;
-
- mStyle.SetUnderline( enable, thickness, position );
- }
-}
-
-bool TextAttachment::GetUnderline() const
-{
- return mStyle.IsUnderlineEnabled();
-}
-
-float TextAttachment::GetUnderlineThickness() const
-{
- return mStyle.GetUnderlineThickness();
-}
-
-float TextAttachment::GetUnderlinePosition() const
-{
- return mStyle.GetUnderlinePosition();
-}
-
-void TextAttachment::ResetUnderline()
-{
- if( !mStyle.IsUnderlineDefault() )
- {
- mStyle.Reset( TextStyle::UNDERLINE );
-
- mUnderlineChanged = true;
- }
-}
-
-void TextAttachment::SetOutline( bool enable, const Vector4& color, const Vector2& thickness )
-{
- if( mStyle.IsOutlineDefault() ||
- ( mStyle.IsOutlineEnabled() != enable ) ||
- ( mStyle.GetOutlineColor() != color ) ||
- ( mStyle.GetOutlineThickness() != thickness ) )
- {
- mStyle.SetOutline( enable, color, thickness );
-
- SetOutlineMessage( mStage->GetUpdateInterface(), *mSceneObject, enable, color, thickness );
- }
-}
-
-bool TextAttachment::GetOutline() const
-{
- return mStyle.IsOutlineEnabled();
-}
-
-void TextAttachment::GetOutlineParams( Vector4& color, Vector2& thickness ) const
-{
- color = mStyle.GetOutlineColor();
- thickness = mStyle.GetOutlineThickness();
-}
-
-void TextAttachment::ResetOutline()
-{
- if( !mStyle.IsOutlineDefault() )
- {
- mStyle.Reset( TextStyle::OUTLINE );
-
- SetOutlineMessage( mStage->GetUpdateInterface(), *mSceneObject, false, TextStyle::DEFAULT_OUTLINE_COLOR, TextStyle::DEFAULT_OUTLINE_THICKNESS );
- }
-}
-
-void TextAttachment::SetGlow( bool enable, const Vector4& color, float intensity )
-{
- if( mStyle.IsGlowDefault() ||
- ( mStyle.IsGlowEnabled() != enable ) ||
- ( mStyle.GetGlowColor() != color ) ||
- ( fabsf( mStyle.GetGlowIntensity() - intensity ) > Math::MACHINE_EPSILON_1000 ) )
- {
- mStyle.SetGlow( enable, color, intensity );
-
- SetGlowMessage( mStage->GetUpdateInterface(), *mSceneObject, enable, color, intensity );
- }
-}
-
-bool TextAttachment::GetGlow() const
-{
- return mStyle.IsGlowEnabled();
-}
-
-void TextAttachment::GetGlowParams( Vector4& color, float& intensity) const
-{
- color = mStyle.GetGlowColor();
- intensity = mStyle.GetGlowIntensity();
-}
-
-void TextAttachment::ResetGlow()
-{
- if( !mStyle.IsGlowDefault() )
- {
- mStyle.Reset( TextStyle::GLOW );
-
- SetGlowMessage( mStage->GetUpdateInterface(), *mSceneObject, false, TextStyle::DEFAULT_GLOW_COLOR, TextStyle::DEFAULT_GLOW_INTENSITY );
- }
-}
-
-void TextAttachment::SetShadow( bool enable, const Vector4& color, const Vector2& offset, float size )
-{
- if( mStyle.IsShadowDefault() ||
- ( mStyle.IsShadowEnabled() != enable ) ||
- ( mStyle.GetShadowColor() != color ) ||
- ( mStyle.GetShadowOffset() != offset ) ||
- ( fabsf( mStyle.GetShadowSize() - size ) > Math::MACHINE_EPSILON_1000 ) )
- {
- mStyle.SetShadow( enable, color, offset, size );
-
- const float unitPointSize( 64.0f );
- const float unitsToPixels( mFont->GetUnitsToPixels());
- const float fontPointSize( mFont->GetPointSize() );
-
- float shadowSize( (size * 0.25f) / unitsToPixels );
-
- Vector2 shadowOffset( offset );
- Vector2 maxOffset( fontPointSize / 4.5f, fontPointSize / 4.5f );
- shadowOffset = Min( shadowOffset, maxOffset );
- shadowOffset = Max( shadowOffset, -maxOffset );
- shadowOffset *= unitPointSize / fontPointSize;
- SetDropShadowMessage( mStage->GetUpdateInterface(), *mSceneObject, enable, color, shadowOffset, shadowSize );
- }
-}
-
-bool TextAttachment::GetShadow() const
-{
- return mStyle.IsShadowEnabled();
-}
-
-void TextAttachment::GetShadowParams( Vector4& color, Vector2& offset, float& size ) const
-{
- color = mStyle.GetShadowColor();
- offset = mStyle.GetShadowOffset();
- size = mStyle.GetShadowSize();
-}
-
-void TextAttachment::ResetShadow()
-{
- if( !mStyle.IsShadowDefault() )
- {
- mStyle.Reset( TextStyle::SHADOW );
-
- const float unitPointSize( 64.0f );
- const float unitsToPixels( mFont->GetUnitsToPixels());
- const float fontPointSize( mFont->GetPointSize() );
-
- float shadowSize( ( TextStyle::DEFAULT_SHADOW_SIZE * 0.25f ) / unitsToPixels );
-
- Vector2 shadowOffset( TextStyle::DEFAULT_SHADOW_OFFSET );
- Vector2 maxOffset( fontPointSize / 4.5f, fontPointSize / 4.5f );
- shadowOffset = Min( shadowOffset, maxOffset );
- shadowOffset = Max( shadowOffset, -maxOffset );
- shadowOffset *= unitPointSize / fontPointSize;
- SetDropShadowMessage( mStage->GetUpdateInterface(), *mSceneObject, false, TextStyle::DEFAULT_SHADOW_COLOR, shadowOffset, shadowSize );
- }
-}
-
-void TextAttachment::SetGradient( const Vector4& color, const Vector2& startPoint, const Vector2& endPoint )
-{
- if( mStyle.IsGradientDefault() ||
- ( mStyle.GetGradientColor() != color ) ||
- ( mStyle.GetGradientStartPoint() != startPoint ) ||
- ( mStyle.GetGradientEndPoint() != endPoint ) )
- {
- mStyle.SetGradient( true, color, startPoint, endPoint );
- SetGradientMessage( mStage->GetUpdateInterface(), *mSceneObject, color, startPoint, endPoint );
- }
-}
-
-const Vector4& TextAttachment::GetGradientColor() const
-{
- return mStyle.GetGradientColor();
-}
-
-const Vector2& TextAttachment::GetGradientStartPoint() const
-{
- return mStyle.GetGradientStartPoint();
-}
-
-const Vector2& TextAttachment::GetGradientEndPoint() const
-{
- return mStyle.GetGradientEndPoint();
-}
-
-void TextAttachment::ResetGradient()
-{
- if( !mStyle.IsGradientDefault() )
- {
- mStyle.Reset( TextStyle::GRADIENT );
-
- SetGradientMessage( mStage->GetUpdateInterface(), *mSceneObject, TextStyle::DEFAULT_GRADIENT_COLOR, TextStyle::DEFAULT_GRADIENT_START_POINT, TextStyle::DEFAULT_GRADIENT_END_POINT );
- }
-}
-
-void TextAttachment::GetTextStyle( TextStyle& style ) const
-{
- style.Copy( mStyle );
-
- // Font name, font style, font point size and color are not store inside the mStyle, so they need to be copied after.
-
- if( NULL != mTextColor )
- {
- style.SetTextColor( *mTextColor );
- }
-
- if( !mFont->IsDefaultSystemFont() )
- {
- style.SetFontName( mFont->GetName() );
- style.SetFontStyle( mFont->GetStyle() );
- }
-
- if( !mFont->IsDefaultSystemSize() )
- {
- style.SetFontPointSize( PointSize( mFont->GetPointSize() ) );
- }
-}
-
-Vector3 TextAttachment::MeasureText() const
-{
- return mFont->MeasureText( mText );
-}
-
-void TextAttachment::TextChanged()
-{
- DALI_LOG_INFO(Debug::Filter::gResource, Debug::Verbose, "TextAttachment::TextChanged() TextModified:%s TextEmpty:%s\n", IsTextModified()?"Y":"N", ( 0u == mText.Count() )?"Y":"N");
-
- if( !IsTextModified() )
- {
- return;
- }
-
- // if the underline or italics have changed we trigger a text request
- if( mUnderlineChanged || mItalicsChanged )
- {
- mTextChanged = true;
- }
-
- TextFormat format( mStyle.IsUnderlineEnabled(),
- mStyle.IsItalicsEnabled(),
- Radian( mStyle.GetItalicsAngle() ),
- mFont->GetPointSize(),
- mStyle.GetUnderlineThickness(),
- mStyle.GetUnderlinePosition() );
-
- if ( mTextChanged && mFontChanged )
- {
- mVertexBuffer = mTextRequestHelper.SetTextAndFont( mText, mFont, format );
- }
- else if( mTextChanged )
- {
- mVertexBuffer = mTextRequestHelper.SetText( mText, format );
- }
- else if ( mFontChanged )
- {
- mVertexBuffer = mTextRequestHelper.SetFont( mFont, format );
- }
-
- // sceneObject is being used in a separate thread; queue a message to set
- SetTextChanges();
-
- mTextChanged = false;
- mFontChanged = false;
- mUnderlineChanged = false;
- mItalicsChanged = false;
-}
-
-bool TextAttachment::IsTextLoaded()
-{
- bool loaded = mTextRequestHelper.IsTextLoaded();
- if( loaded && !mTextureIdSet )
- {
- mTextureIdSet = true;
- }
-
- return loaded;
-}
-
-void TextAttachment::CalculateWeightedSmoothing( TextStyle::Weight weight, float smoothEdge )
-{
- float weightedSmoothing = smoothEdge;
-
- // Adjust edge smoothing for font weight
- const float BOLDER = 0.20f;
- const float LIGHTER = 1.65f;
- const float offset = 1.0f - ( ( 1.0f / Dali::TextStyle::EXTRABLACK ) * weight );
- weightedSmoothing *= BOLDER + ( ( LIGHTER - BOLDER ) * offset );
- weightedSmoothing = std::max( 0.0f, weightedSmoothing );
- weightedSmoothing = std::min( 1.0f, weightedSmoothing );
-
- SetSmoothEdgeMessage( mStage->GetUpdateInterface(), *mSceneObject, weightedSmoothing );
-}
-
-void TextAttachment::TextureResized( const TextureIdList& oldTextureIds, unsigned int newTextureId )
-{
- bool matched( false );
-
- // check if resized texture is the one we are using
- for( std::size_t i = 0, count = oldTextureIds.size(); i < count; ++i )
- {
- if( oldTextureIds[i] == mTextureId )
- {
- matched = true;
- break;
- }
- }
-
- DALI_LOG_INFO(Debug::Filter::gResource, Debug::General, "TextAttachment::TextureResized() Current texture: %d New texture: %d\n", mTextureId, newTextureId);
-
- if( newTextureId == mTextureId )
- {
- // nothing has changed, we are using the new texture already
- return;
- }
-
- // the texture we're using has been replaced
- // re-request the text vertex information and update the texture id on the scene graph text attachment
- if( matched )
- {
- mTextRequestHelper.TextureChanged( mTextureId, newTextureId );
- mTextureId = newTextureId;
- mTextChanged = true;
- TextChanged();
- return;
- }
-}
-
-void TextAttachment::TextureSplit( FontId fontId, const TextureIdList& oldTextureIds, unsigned int newTextureId )
-{
- // currently not supported.
- // the implementation will be if( fontId == mFont->GetId() ) TextureResized(..);
-}
-
-bool TextAttachment::IsTextModified()
-{
- return ( mTextChanged || mFontChanged || mUnderlineChanged || mItalicsChanged );
-}
-
-void TextAttachment::OnStageConnection2()
-{
- // do nothing
-}
-
-void TextAttachment::OnStageDisconnection2()
-{
- // do nothing
-}
-
-const SceneGraph::RenderableAttachment& TextAttachment::GetSceneObject() const
-{
- DALI_ASSERT_DEBUG( mSceneObject != NULL );
- return *mSceneObject;
-}
-
-void TextAttachment::SetTextChanges()
-{
- if( mVertexBuffer )
- {
- // record the natural size of the text
- mTextSize = mVertexBuffer->mVertexMax;
-
- // remember the texture id, so we can detect atlas resizes / splits
- mTextureId = mVertexBuffer->mTextureId;
-
- EventToUpdate& eventToUpdate( mStage->GetUpdateInterface() );
- const SceneGraph::TextAttachment& attachment( *mSceneObject );
-
- if( mTextChanged || mFontChanged )
- {
- DALI_LOG_INFO(Debug::Filter::gResource, Debug::General, "TextAttachment::SetTextChanges() Sending VertexBuffer to attachment:%p textureId:%d\n", &attachment, mVertexBuffer->mTextureId);
-
- // release the vertex buffer to pass ownership to the scene-graph-text-attachment
- SetTextVertexBufferMessage( eventToUpdate, attachment, *mVertexBuffer.Release() );
-
- if( mFontChanged )
- {
- SetTextFontSizeMessage( eventToUpdate, attachment, mFont->GetPixelSize() );
- }
- }
- }
-}
-
-} // namespace Internal
-
-} // namespace Dali
diff --git a/dali/internal/event/actor-attachments/text-attachment-impl.h b/dali/internal/event/actor-attachments/text-attachment-impl.h
deleted file mode 100644
index de16ee8..0000000
--- a/dali/internal/event/actor-attachments/text-attachment-impl.h
+++ /dev/null
@@ -1,409 +0,0 @@
-#ifndef __DALI_INTERNAL_TEXT_ATTACHMENT_H__
-#define __DALI_INTERNAL_TEXT_ATTACHMENT_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-class TextParameters;
-
-namespace SceneGraph
-{
-class TextAttachment;
-class Node;
-}
-
-/**
- * An attachment for rendering text from a font atlas.
- */
-class TextAttachment : public RenderableAttachment, public GlyphTextureObserver
-{
-public:
-
- /**
- * Create a new TextAttachment.
- * @param[in] parentNode The node to attach a scene-object to.
- * @param [in] text The text which will be displayed.
- * @param [in] font The font which will be used for the text.
- * @return A smart-pointer to the newly allocated TextAttachment.
- */
- static TextAttachmentPtr New( const SceneGraph::Node& parentNode, const Integration::TextArray& text, FontPointer font );
-
- /**
- * Set the text label displayed by the attachment
- * @param [in] text The new text label
- */
- void SetText(const Integration::TextArray& text);
-
- /**
- * Get the text label displayed by the attachment
- * @return The text label
- */
- const Integration::TextArray& GetText() const
- {
- // This is not animatable; the cached value is up-to-date.
- return mText;
- }
-
- /**
- * Get the natural text size
- * @return the natural size of the text.
- */
- const Vector2& GetNaturalTextSize() const
- {
- // This is not animatable; the cached value is up-to-date.
- return mTextSize;
- }
-
- /**
- * Set the font used to display the text label displayed by the attachment
- * @param [in] font The new font
- */
- void SetFont(Font& font);
-
- /**
- * Get the font used to display the text label displayed by the attachment
- * @return The font currently in use
- */
- Font& GetFont()
- {
- return *mFont;
- }
-
- /**
- * Set the text color
- * @param[in] color The text color
- */
- void SetTextColor(const Vector4& color);
-
- /**
- * Get the text color
- * @return The text color
- */
- Vector4 GetTextColor() const;
-
- /**
- * Resets to default the text color.
- */
- void ResetTextColor();
-
- /**
- * @copydoc Dali::TextActor::SetWeight()
- */
- void SetWeight( TextStyle::Weight weight );
-
- /**
- * @copydoc Dali::TextActor::GetWeight()
- */
- TextStyle::Weight GetWeight() const;
-
- /**
- * Resets to default the text weight.
- */
- void ResetWeight();
-
- /**
- * @copydoc Dali::TextActor::SetSmoothEdge(const float)
- */
- void SetSmoothEdge( float smoothEdge );
-
- /**
- * Retrieve the smooth edge value.
- * @return the smooth edge value.
- */
- float GetSmoothEdge() const;
-
- /**
- * Resets to default the smooth edge.
- */
- void ResetSmoothEdge();
-
- /**
- * Enable italics on the text actor, the text will be sheared by the given angle.
- * @param[in] angle Italics angle in radians.
- */
- void SetItalics( Radian angle );
-
- /**
- * @copydoc Dali::TextActor::GetItalics()
- */
- bool GetItalics() const;
-
- /**
- * @copydoc Dali::TextActor::GetItalicsAngle()
- */
- Radian GetItalicsAngle() const;
-
- /**
- * Resets to default the italics.
- */
- void ResetItalics();
-
- /**
- * @copydoc Dali::TextActor::SetUnderline()
- */
- void SetUnderline( bool enable, float thickness, float position );
-
- /**
- * @copydoc Dali::TextActor::GetUnderline()
- */
- bool GetUnderline() const;
-
- /**
- * @copydoc Internal::TextActor::GetUnderlineThickness()
- */
- float GetUnderlineThickness() const;
-
- /**
- * @copydoc Internal::TextActor::GetUnderlinePosition()
- */
- float GetUnderlinePosition() const;
-
- /**
- * Resets to default the text underline.
- */
- void ResetUnderline();
-
- /**
- * @copydoc Dali::TextActor::SetOutline(const bool,const Vector4&,const Vector2&)
- */
- void SetOutline( bool enable, const Vector4& color, const Vector2& thickness );
-
- /**
- * Get outline state.
- * @return \e true if outline is enabled, otherwise \e false.
- */
- bool GetOutline() const;
-
- /**
- * Retrieve outline parameters.
- * @param[out] color The outline color.
- * @param[out] thickness The outline parameters.
- */
- void GetOutlineParams( Vector4& color, Vector2& thickness ) const;
-
- /**
- * Resets to default the text outline.
- */
- void ResetOutline();
-
- /**
- * @copydoc Dali::TextActor::SetGlow(const bool,const Vector4&,const float)
- */
- void SetGlow( bool enable, const Vector4& color, float intensity );
-
- /**
- * Get glow state.
- * @return \e true if glow is enabled, otherwise \e false.
- */
- bool GetGlow() const;
-
- /**
- * Retrieve glow parameters.
- * @param[out] color The glow color.
- * @param[out] intensity The glow intensity.
- */
- void GetGlowParams( Vector4& color, float& intensity ) const;
-
- /**
- * Resets to default the text glow.
- */
- void ResetGlow();
-
- /**
- * @copydoc Dali::TextActor::SetShadow(const bool,const Vector4&,const Vector2&,const float)
- */
- void SetShadow( bool enable, const Vector4& color, const Vector2& offset, float size );
-
- /**
- * Retrieve the shadow state.
- * @return \e true if shadow is enabled, otherwise \e false.
- */
- bool GetShadow() const;
-
- /**
- * Retrieve shadow parameters.
- * @param[out] color The shadow color.
- * @param[out] offset The shadow offset.
- * @param[out] size The shadow size.
- */
- void GetShadowParams( Vector4& color, Vector2& offset, float& size ) const;
-
- /**
- * Resets to default the text shadow.
- */
- void ResetShadow();
-
- /**
- * @see Dali::TextActor::SetGradientColor()
- * @see Dali::TextActor::SetGradientStartPoint()
- * @see Dali::TextActor::SetGradientEndPoint()
- */
- void SetGradient( const Vector4& color, const Vector2& startPoint, const Vector2& endPoint );
-
- /**
- * @copydoc Dali::TextActor::GetGradientColor()
- */
- const Vector4& GetGradientColor() const;
-
- /**
- * @copydoc Dali::TextActor::GetGradientStartPoint()
- */
- const Vector2& GetGradientStartPoint() const;
-
- /**
- * @copydoc Dali::TextActor::GetGradientEndPoint()
- */
- const Vector2& GetGradientEndPoint() const;
-
- /**
- * Resets to default the text gradient.
- */
- void ResetGradient();
-
- /**
- * Retrieves the text style.
- *
- * @param[out] style The text style.
- */
- void GetTextStyle( TextStyle& style ) const;
-
- /**
- * Measure the natural size of a text string, as displayed in this font.
- * @return The natural size of the text.
- */
- Vector3 MeasureText() const;
-
- /**
- * Inform the text attachment the text / font it is using has changed.
- * The TextChanged() and TextNotRequired() functions are used to avoid duplicate
- * requests for text. For example if the text is changed, and the font is changed
- * then we want to avoid requesting the new text with the old font, then the new
- * text with the new font.
- */
- void TextChanged();
-
- /**
- * @return true if all text has been loaded and is ready to display
- */
- bool IsTextLoaded();
-
- /**
- * Calculates the weighted smoothing value.
- */
- void CalculateWeightedSmoothing( TextStyle::Weight weight, float smoothEdge );
-
-public: // glyph texture observer
-
- /**
- * @copydoc Dali::Internal::GlyphTextureObserver::TextureResized()
- */
- virtual void TextureResized( const TextureIdList& oldTextureIds, unsigned int newTextureId );
-
- /**
- * @copydoc Dali::Internal::GlyphTextureObserver::TextureSplit()
- */
- virtual void TextureSplit( FontId fontId, const TextureIdList& oldTextureIds, unsigned int newTextureId );
-
-private:
-
- /**
- * Check if the text has been modified
- * @return true if the text or it's formating has been modified
- */
- bool IsTextModified();
-
- /**
- * First stage construction of a TextAttachment.
- * @param[in] stage Used to send messages to scene-graph.
- */
- TextAttachment( Stage& stage );
-
- /**
- * @copydoc Dali::Internal::RenderableAttachment::OnStageConnection2()
- */
- virtual void OnStageConnection2();
-
- /**
- * @copydoc Dali::Internal::RenderableAttachment::OnStageDisconnection2()
- */
- virtual void OnStageDisconnection2();
-
- /**
- * @copydoc Dali::Internal::RenderableAttachment::GetSceneObject()
- */
- virtual const SceneGraph::RenderableAttachment& GetSceneObject() const;
-
- /**
- * Update any text & font changes to the on stage scene graph text attachment
- */
- void SetTextChanges();
-
-protected:
-
- /**
- * A reference counted object may only be deleted by calling Unreference()
- */
- virtual ~TextAttachment();
-
-private:
-
- const SceneGraph::TextAttachment* mSceneObject; ///< Not owned
-
- TextRequestHelper mTextRequestHelper; ///< Text request helper
- FontPointer mFont; ///< The font resource
- Vector4* mTextColor; ///< on demand storage for text color
- TextStyle mStyle; ///< on demand storage for text effects parameters ( do not store font parameters and color )
- ///< Font parameters are stored in the FontPointer member. Inside the TextStyle, font parameters and color are allocated in the same struct,
- ///< so store the text color in the style will allocate space for the font parameters as well, wasting space.
- // Cached values for public getters
- Integration::TextArray mText;
-
- bool mTextChanged:1; ///< whether the text has changed
- bool mFontChanged:1; ///< whether the font has changed
- bool mUnderlineChanged:1; ///< whether the underline has changed
- bool mItalicsChanged:1; ///< whether the italics has changed
- bool mTextureIdSet:1; ///< flag to signify if the texture id has been set on the scene-graph text-attachment
- unsigned int mTextureId; ///< the texture id of the glyph atlas being used
- Vector2 mTextSize; ///< text natural size
-
- OwnerPointer< TextVertexBuffer > mVertexBuffer; ///< vertex data to display the text
-};
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_TEXT_ATTACHMENT_H__
diff --git a/dali/internal/event/actors/actor-declarations.h b/dali/internal/event/actors/actor-declarations.h
index a6f8feb..2d2df75 100644
--- a/dali/internal/event/actors/actor-declarations.h
+++ b/dali/internal/event/actors/actor-declarations.h
@@ -34,7 +34,6 @@ class ImageActor;
class Layer;
class LightActor;
class MeshActor;
-class TextActor;
typedef IntrusivePtr ActorPtr;
typedef IntrusivePtr CameraActorPtr;
@@ -43,7 +42,6 @@ typedef IntrusivePtr ImageActorPtr;
typedef IntrusivePtr LayerPtr;
typedef IntrusivePtr LightActorPtr;
typedef IntrusivePtr MeshActorPtr;
-typedef IntrusivePtr TextActorPtr;
} // namespace Internal
diff --git a/dali/internal/event/actors/text-actor-impl.cpp b/dali/internal/event/actors/text-actor-impl.cpp
deleted file mode 100644
index e631516..0000000
--- a/dali/internal/event/actors/text-actor-impl.cpp
+++ /dev/null
@@ -1,1075 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include
-
-// INTERNAL INCLUDES
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-namespace Dali
-{
-
-const Property::Index TextActor::TEXT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
-const Property::Index TextActor::FONT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 1;
-const Property::Index TextActor::FONT_STYLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 2;
-const Property::Index TextActor::OUTLINE_ENABLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 3;
-const Property::Index TextActor::OUTLINE_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 4;
-const Property::Index TextActor::OUTLINE_THICKNESS_WIDTH = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 5;
-const Property::Index TextActor::SMOOTH_EDGE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 6;
-const Property::Index TextActor::GLOW_ENABLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 7;
-const Property::Index TextActor::GLOW_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 8;
-const Property::Index TextActor::GLOW_INTENSITY = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 9;
-const Property::Index TextActor::SHADOW_ENABLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 10;
-const Property::Index TextActor::SHADOW_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 11;
-const Property::Index TextActor::SHADOW_OFFSET = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 12;
-const Property::Index TextActor::ITALICS_ANGLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 13;
-const Property::Index TextActor::UNDERLINE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 14;
-const Property::Index TextActor::WEIGHT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 15;
-const Property::Index TextActor::FONT_DETECTION_AUTOMATIC = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 16;
-const Property::Index TextActor::GRADIENT_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 17;
-const Property::Index TextActor::GRADIENT_START_POINT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 18;
-const Property::Index TextActor::GRADIENT_END_POINT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 19;
-const Property::Index TextActor::SHADOW_SIZE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 20;
-const Property::Index TextActor::TEXT_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 21;
-
-namespace
-{
-
-const char* DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[] =
-{
- "text",
- "font",
- "font-style",
- "outline-enable",
- "outline-color",
- "outline-thickness-width",
- "smooth-edge",
- "glow-enable",
- "glow-color",
- "glow-intensity",
- "shadow-enable",
- "shadow-color",
- "shadow-offset",
- "italics-angle",
- "underline",
- "weight",
- "font-detection-automatic",
- "gradient-color",
- "gradient-start-point",
- "gradient-end-point",
- "shadow-size",
- "text-color"
-};
-const int DEFAULT_TEXT_ACTOR_PROPERTY_COUNT = sizeof( DEFAULT_TEXT_ACTOR_PROPERTY_NAMES ) / sizeof( DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[0] );
-
-const Property::Type DEFAULT_TEXT_ACTOR_PROPERTY_TYPES[DEFAULT_TEXT_ACTOR_PROPERTY_COUNT] =
-{
- Property::STRING, // "text"
- Property::STRING, // "font"
- Property::STRING, // "font-style"
- Property::BOOLEAN, // "outline-enable"
- Property::VECTOR4, // "outline-color"
- Property::VECTOR2, // "outline-thickness-width"
- Property::FLOAT, // "smooth-edge"
- Property::BOOLEAN, // "glow-enable"
- Property::VECTOR4, // "glow-color"
- Property::FLOAT, // "glow-intensity"
- Property::BOOLEAN, // "shadow-enable"
- Property::VECTOR4, // "shadow-color"
- Property::VECTOR2, // "shadow-offset"
- Property::FLOAT, // "italics-angle"
- Property::BOOLEAN, // "underline"
- Property::INTEGER, // "weight"
- Property::BOOLEAN, // "font-detection-automatic"
- Property::VECTOR4, // "gradient-color",
- Property::VECTOR2, // "gradient-start-point",
- Property::VECTOR2, // "gradient-end-point"
- Property::FLOAT, // "shadow-size"
- Property::VECTOR4, // "text-color",
-};
-
-}
-
-namespace Internal
-{
-
-namespace
-{
-
-BaseHandle Create()
-{
- return Dali::TextActor::New();
-}
-
-TypeRegistration mType( typeid(Dali::TextActor), typeid(Dali::RenderableActor), Create );
-
-SignalConnectorType s1( mType, Dali::TextActor::SIGNAL_TEXT_LOADING_FINISHED, &TextActor::DoConnectSignal );
-
-}
-
-TextActorPtr TextActor::New( const Integration::TextArray& utfCodes, const TextActorParameters& parameters )
-{
- // first stage construction
- TextActorPtr actor ( new TextActor( parameters.IsAutomaticFontDetectionEnabled() ) );
-
- const TextStyle& style = parameters.GetTextStyle();
-
- FontPointer fontPtr( Font::New(style.GetFontName(), style.GetFontStyle(), style.GetFontPointSize() ) );
-
- // Second-phase construction
- actor->Initialize();
-
- //create the attachment
- actor->mTextAttachment = TextAttachment::New( *actor->mNode, Integration::TextArray(), fontPtr );
- actor->Attach(*actor->mTextAttachment);
-
- // Note: SetTextStyle() MUST be called before SetText(), to ensure
- // that a single ResourceRequest for the glyphs is made. Calling
- // them in the wrong order will issue two requests.
- actor->SetTextStyle( style, DONT_REQUEST_NEW_TEXT );
-
- actor->SetText( utfCodes );
-
- return actor;
-}
-
-TextActor::TextActor(bool fontDetection)
-: RenderableActor(),
- mLoadingState(Dali::ResourceLoading),
- mUsingNaturalSize(true),
- mInternalSetSize(false),
- mFontDetection(fontDetection),
- mObserving(false)
-{
-}
-
-void TextActor::OnInitialize()
-{
-}
-
-TextActor::~TextActor()
-{
- StopObservingTextLoads();
-}
-
-const std::string TextActor::GetText() const
-{
- const Integration::TextArray& utfCodes = mTextAttachment->GetText();
-
- std::string text;
-
- const std::size_t length = utfCodes.Count();
- // minimize allocations for ascii strings
- text.reserve( length );
-
- for (unsigned int i = 0; i < length; ++i)
- {
- unsigned char utf8Data[4];
- unsigned int utf8Length;
-
- utf8Length = UTF8Write(utfCodes[i], utf8Data);
-
- text.append(reinterpret_cast(utf8Data), utf8Length);
- }
-
- return text;
-}
-
-Font* TextActor::GetFont() const
-{
- return &mTextAttachment->GetFont();
-}
-
-void TextActor::SetToNaturalSize()
-{
- // ignore size set by application
- mUsingNaturalSize = true;
- TextChanged(); // this will calculate natural size
-}
-
-void TextActor::StopObservingTextLoads()
-{
- if( mObserving )
- {
- mTextAttachment->GetFont().RemoveObserver( *this );
- mObserving = false;
- }
-}
-
-void TextActor::StartObservingTextLoads()
-{
- if( !mObserving )
- {
- mTextAttachment->GetFont().AddObserver( *this );
- mObserving = true;
- }
-}
-
-void TextActor::SetText(const Integration::TextArray& utfCodes)
-{
- StopObservingTextLoads();
-
- // assign the new text
- mTextAttachment->SetText(utfCodes);
-
- if( mFontDetection )
- {
- // first check if the provided font supports the text
- //
- if( !mTextAttachment->GetFont().AllGlyphsSupported(utfCodes) )
- {
- // auto-detect font
- // @todo GetFamilyForText should return font name and style
- const std::string fontName = Font::GetFamilyForText(utfCodes);
-
- // use previous formatting
- Internal::Font& font = mTextAttachment->GetFont();
-
- Dali::Font fontNew = Dali::Font::New( Dali::FontParameters( fontName, font.GetStyle(), PointSize(font.GetPointSize() ) ) );
-
- SetFont( GetImplementation(fontNew), DONT_REQUEST_NEW_TEXT );
- }
- }
-
- TextChanged();
-}
-
-void TextActor::SetFont(Font& font, TextRequestMode mode )
-{
- StopObservingTextLoads();
-
- if( mode == REQUEST_NEW_TEXT )
- {
- // set the new font
- mTextAttachment->SetFont( font );
-
- // request text for new font
- TextChanged();
- }
- else
- {
- // just set the font
- mTextAttachment->SetFont( font );
- }
-}
-
-Vector3 TextActor::GetNaturalSize() const
-{
- Vector2 naturalSize( mTextAttachment->GetNaturalTextSize() );
- return Vector3( naturalSize.width, naturalSize.height, CalculateSizeZ( naturalSize ) );
-}
-
-void TextActor::OnSizeSet(const Vector3& targetSize)
-{
- if( !mInternalSetSize )
- {
- // after size is once set by application we no longer use the natural size
- mUsingNaturalSize = false;
- }
-}
-
-void TextActor::OnSizeAnimation(Animation& animation, const Vector3& targetSize)
-{
- // after size has been animated by application we no longer use the natural size
- mUsingNaturalSize = false;
-}
-
-RenderableAttachment& TextActor::GetRenderableAttachment() const
-{
- DALI_ASSERT_DEBUG( mTextAttachment );
- return *mTextAttachment;
-}
-
-void TextActor::SetGradientColor( const Vector4& color )
-{
- mTextAttachment->SetGradient( color, mTextAttachment->GetGradientStartPoint(), mTextAttachment->GetGradientEndPoint() );
-}
-
-const Vector4& TextActor::GetGradientColor() const
-{
- return mTextAttachment->GetGradientColor();
-}
-
-void TextActor::SetGradientStartPoint( const Vector2& position )
-{
- mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), position, mTextAttachment->GetGradientEndPoint() );
-}
-
-const Vector2& TextActor::GetGradientStartPoint() const
-{
- return mTextAttachment->GetGradientStartPoint();
-}
-
-void TextActor::SetGradientEndPoint( const Vector2& position )
-{
- mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), mTextAttachment->GetGradientStartPoint(), position );
-}
-
-const Vector2& TextActor::GetGradientEndPoint() const
-{
- return mTextAttachment->GetGradientEndPoint();
-}
-
-void TextActor::SetGradient( const Vector4& color, const Vector2& startPoint, const Vector2& endPoint )
-{
- mTextAttachment->SetGradient( color, startPoint, endPoint );
-}
-
-void TextActor::SetTextStyle( const TextStyle& style, TextRequestMode mode )
-{
- // Set font.
- const Font& font = mTextAttachment->GetFont();
-
- // Determine the font name/style/size that Font would create.
- // Then compare this to the existing font (which has been validated by Font).
-
- std::string resolvedFontName = style.GetFontName();
- std::string resolvedFontStyle = style.GetFontStyle();
- float resolvedFontPointSize = style.GetFontPointSize();
- bool resolvedFontFamilyDefault(false);
- bool resolvedFontPointSizeDefault(false);
-
- Font::ValidateFontRequest( resolvedFontName,
- resolvedFontStyle,
- resolvedFontPointSize,
- resolvedFontFamilyDefault,
- resolvedFontPointSizeDefault );
-
- // Now compare to existing font used to see if a font change is necessary.
- if( ( font.GetName() != resolvedFontName ) ||
- ( font.GetStyle() != resolvedFontStyle ) ||
- ( fabsf(font.GetPointSize() - resolvedFontPointSize) >= GetRangedEpsilon(font.GetPointSize(), resolvedFontPointSize) ) )
- {
- // Create font with original request (so font can determine if family and/or point size is default)
- SetFont( *(Font::New( style.GetFontName(), style.GetFontStyle(), style.GetFontPointSize() ) ), mode );
- }
-
- // Set color.
- if( !style.IsTextColorDefault() )
- {
- SetTextColor( style.GetTextColor() );
- }
- else
- {
- mTextAttachment->ResetTextColor();
- }
-
- // Italics
- if( !style.IsItalicsDefault() )
- {
- SetItalics( style.IsItalicsEnabled() ? Radian( style.GetItalicsAngle() ) : Radian( 0.0f ) );
- }
- else
- {
- mTextAttachment->ResetItalics();
- }
-
- // Underline
- if( !style.IsUnderlineDefault() )
- {
- SetUnderline( style.IsUnderlineEnabled(), style.GetUnderlineThickness(), style.GetUnderlinePosition() );
- }
- else
- {
- mTextAttachment->ResetUnderline();
- }
-
- // Shadow
- if( !style.IsShadowDefault() )
- {
- SetShadow( style.IsShadowEnabled(), style.GetShadowColor(), style.GetShadowOffset(), style.GetShadowSize() );
- }
- else
- {
- mTextAttachment->ResetShadow();
- }
-
- // Glow
- if( !style.IsGlowDefault() )
- {
- SetGlow( style.IsGlowEnabled(), style.GetGlowColor(), style.GetGlowIntensity() );
- }
- else
- {
- mTextAttachment->ResetGlow();
- }
-
- // Soft Smooth edge.
- if( !style.IsSmoothEdgeDefault() )
- {
- SetSmoothEdge( style.GetSmoothEdge() );
- }
- else
- {
- mTextAttachment->ResetSmoothEdge();
- }
-
- // Outline
- if( !style.IsOutlineDefault() )
- {
- SetOutline( style.IsOutlineEnabled(), style.GetOutlineColor(), style.GetOutlineThickness() );
- }
- else
- {
- mTextAttachment->ResetOutline();
- }
-
- // Weight
- if( !style.IsFontWeightDefault() )
- {
- SetWeight( style.GetWeight() );
- }
- else
- {
- mTextAttachment->ResetWeight();
- }
-
- //Gradient
- if( !style.IsGradientDefault() )
- {
- if( style.IsGradientEnabled() )
- {
- SetGradient( style.GetGradientColor(), style.GetGradientStartPoint(), style.GetGradientEndPoint() );
- }
- else
- {
- SetGradient( TextStyle::DEFAULT_GRADIENT_COLOR, TextStyle::DEFAULT_GRADIENT_START_POINT, TextStyle::DEFAULT_GRADIENT_END_POINT );
- }
- }
- else
- {
- mTextAttachment->ResetGradient();
- }
- TextChanged();
-}
-
-TextStyle TextActor::GetTextStyle() const
-{
- TextStyle textStyle;
- mTextAttachment->GetTextStyle( textStyle );
-
- return textStyle;
-}
-
-void TextActor::SetTextColor(const Vector4& color)
-{
- mTextAttachment->SetTextColor( color );
-}
-
-Vector4 TextActor::GetTextColor() const
-{
- return mTextAttachment->GetTextColor();
-}
-
-void TextActor::SetSmoothEdge( float smoothEdge )
-{
- mTextAttachment->SetSmoothEdge(smoothEdge);
-}
-
-void TextActor::SetOutline( bool enable, const Vector4& color, const Vector2& offset )
-{
- mTextAttachment->SetOutline(enable, color, offset);
-}
-
-void TextActor::SetGlow( bool enable, const Vector4& color, float intensity )
-{
- mTextAttachment->SetGlow(enable, color, intensity);
-}
-
-void TextActor::SetShadow( bool enable, const Vector4& color, const Vector2& offset, float size )
-{
- mTextAttachment->SetShadow(enable, color, offset, size);
-}
-
-void TextActor::SetItalics( Radian angle )
-{
- mTextAttachment->SetItalics( angle );
-
- TextChanged();
-}
-
-bool TextActor::GetItalics() const
-{
- return mTextAttachment->GetItalics();
-}
-
-Radian TextActor::GetItalicsAngle() const
-{
- return mTextAttachment->GetItalicsAngle();
-}
-
-void TextActor::SetUnderline( bool enable, float thickness, float position )
-{
- mTextAttachment->SetUnderline( enable, thickness, position );
-
- TextChanged();
-}
-
-bool TextActor::GetUnderline() const
-{
- return mTextAttachment->GetUnderline();
-}
-
-float TextActor::GetUnderlineThickness() const
-{
- return mTextAttachment->GetUnderlineThickness();
-}
-
-float TextActor::GetUnderlinePosition() const
-{
- return mTextAttachment->GetUnderlinePosition();
-}
-
-void TextActor::SetWeight( TextStyle::Weight weight )
-{
- mTextAttachment->SetWeight( weight );
-}
-
-TextStyle::Weight TextActor::GetWeight() const
-{
- return mTextAttachment->GetWeight();
-}
-
-void TextActor::SetFontDetectionAutomatic(bool value)
-{
- mFontDetection = value;
-}
-
-bool TextActor::IsFontDetectionAutomatic() const
-{
- return mFontDetection;
-}
-
-bool TextActor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
-{
- bool connected( true );
- TextActor* textActor = dynamic_cast(object);
-
- if( Dali::TextActor::SIGNAL_TEXT_LOADING_FINISHED == signalName )
- {
- textActor->TextAvailableSignal().Connect( tracker, functor );
- }
- else
- {
- // signalName does not match any signal
- connected = false;
- }
-
- return connected;
-}
-
-void TextActor::TextLoaded()
-{
- // if the text is loaded, trigger the loaded finished signal
- CheckTextLoadState();
-}
-
-void TextActor::TextChanged()
-{
- // this will tell the text attachment to act on any text or font changes
- mTextAttachment->TextChanged();
-
- // check the loading state
- bool loaded = CheckTextLoadState();
- if( ! loaded)
- {
- mLoadingState = Dali::ResourceLoading;
-
- StartObservingTextLoads();
- }
- // the text natural size is calculated synchronously above, when TextChanged() is called
- if (mUsingNaturalSize)
- {
- mInternalSetSize = true; // to know we're internally setting size
- SetSize( mTextAttachment->GetNaturalTextSize() );
- mInternalSetSize = false;
- }
-}
-
-bool TextActor::CheckTextLoadState()
-{
- if( mTextAttachment->IsTextLoaded() )
- {
- mLoadingState = Dali::ResourceLoadingSucceeded;
-
- StopObservingTextLoads();
-
- // emit text available signal
-
- mLoadingFinishedV2.Emit( Dali::TextActor( this ) );
-
- return true;
- }
-
- // text not loaded
- return false;
-}
-
-unsigned int TextActor::GetDefaultPropertyCount() const
-{
- return RenderableActor::GetDefaultPropertyCount() + DEFAULT_TEXT_ACTOR_PROPERTY_COUNT;
-}
-
-void TextActor::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
-{
- RenderableActor::GetDefaultPropertyIndices( indices ); // RenderableActor class properties
-
- indices.reserve( indices.size() + DEFAULT_TEXT_ACTOR_PROPERTY_COUNT );
-
- int index = DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
- for ( int i = 0; i < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT; ++i, ++index )
- {
- indices.push_back( index );
- }
-}
-
-const char* TextActor::GetDefaultPropertyName( Property::Index index ) const
-{
- if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
- {
- return RenderableActor::GetDefaultPropertyName(index) ;
- }
- else
- {
- index -= DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
-
- if ( ( index >= 0 ) && ( index < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT ) )
- {
- return DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[index];
- }
- else
- {
- return NULL;
- }
- }
-}
-
-Property::Index TextActor::GetDefaultPropertyIndex(const std::string& name) const
-{
- Property::Index index = Property::INVALID_INDEX;
-
- // Look for name in default properties
- for( int i = 0; i < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT; ++i )
- {
- if( 0 == strcmp( name.c_str(), DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[ i ] ) ) // dont want to convert rhs to string
- {
- index = i + DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
- break;
- }
- }
-
- // If not found, check in base class
- if( Property::INVALID_INDEX == index )
- {
- index = RenderableActor::GetDefaultPropertyIndex( name );
- }
-
- return index;
-}
-
-bool TextActor::IsDefaultPropertyWritable( Property::Index index ) const
-{
- if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
- {
- return RenderableActor::IsDefaultPropertyWritable(index) ;
- }
- else
- {
- return true;
- }
-}
-
-bool TextActor::IsDefaultPropertyAnimatable( Property::Index index ) const
-{
- if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
- {
- return RenderableActor::IsDefaultPropertyAnimatable(index) ;
- }
- else
- {
- return false;
- }
-}
-
-bool TextActor::IsDefaultPropertyAConstraintInput( Property::Index index ) const
-{
- if( index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT )
- {
- return RenderableActor::IsDefaultPropertyAConstraintInput(index);
- }
- return true; // Our properties can be used as input to constraints.
-}
-
-Property::Type TextActor::GetDefaultPropertyType( Property::Index index ) const
-{
- if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
- {
- return RenderableActor::GetDefaultPropertyType(index) ;
- }
- else
- {
- index -= DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
-
- if ( ( index >= 0 ) && ( index < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT ) )
- {
- return DEFAULT_TEXT_ACTOR_PROPERTY_TYPES[index];
- }
- else
- {
- // index out-of-bounds
- return Property::NONE;
- }
- }
-}
-
-void TextActor::SetDefaultProperty( Property::Index index, const Property::Value& propertyValue )
-{
- if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
- {
- RenderableActor::SetDefaultProperty(index, propertyValue) ;
- }
- else
- {
- switch(index)
- {
- case Dali::TextActor::TEXT:
- {
- SetText( GetTextArray( Dali::Text( propertyValue.Get() ) ) );
- break;
- }
- case Dali::TextActor::FONT:
- {
- SetFont(*Font::New(propertyValue.Get(),
- mTextAttachment->GetFont().GetStyle(),
- PointSize(mTextAttachment->GetFont().GetPointSize())));
- break;
- }
- case Dali::TextActor::FONT_STYLE:
- {
- SetFont(*Font::New(mTextAttachment->GetFont().GetName(),
- propertyValue.Get(),
- PointSize(mTextAttachment->GetFont().GetPointSize())));
- break;
- }
- case Dali::TextActor::OUTLINE_ENABLE:
- {
- Vector4 color;
- Vector2 thickness;
- mTextAttachment->GetOutlineParams( color, thickness );
- mTextAttachment->SetOutline(propertyValue.Get(), color, thickness);
- break;
- }
- case Dali::TextActor::OUTLINE_COLOR:
- {
- Vector4 color;
- Vector2 thickness;
- mTextAttachment->GetOutlineParams( color, thickness );
- mTextAttachment->SetOutline(mTextAttachment->GetOutline(), propertyValue.Get(), thickness);
- break;
- }
- case Dali::TextActor::OUTLINE_THICKNESS_WIDTH:
- {
- Vector4 color;
- Vector2 thickness;
- mTextAttachment->GetOutlineParams( color, thickness );
- mTextAttachment->SetOutline(mTextAttachment->GetOutline(), color, propertyValue.Get());
- break;
- }
- case Dali::TextActor::SMOOTH_EDGE:
- {
- mTextAttachment->SetSmoothEdge( propertyValue.Get());
- break;
- }
- case Dali::TextActor::GLOW_ENABLE:
- {
- Vector4 color;
- float intensity;
- mTextAttachment->GetGlowParams( color, intensity );
- mTextAttachment->SetGlow(propertyValue.Get(), color, intensity);
- break;
- }
- case Dali::TextActor::GLOW_COLOR:
- {
- Vector4 color;
- float intensity;
- mTextAttachment->GetGlowParams( color, intensity );
- mTextAttachment->SetGlow(mTextAttachment->GetGlow(), propertyValue.Get(), intensity);
- break;
- }
- case Dali::TextActor::GLOW_INTENSITY:
- {
- Vector4 color;
- float intensity;
- mTextAttachment->GetGlowParams( color, intensity );
- mTextAttachment->SetGlow(mTextAttachment->GetGlow(), color, propertyValue.Get());
- break;
- }
- case Dali::TextActor::SHADOW_ENABLE:
- {
- Vector4 color;
- Vector2 offset;
- float size;
- mTextAttachment->GetShadowParams( color, offset, size );
- mTextAttachment->SetShadow(propertyValue.Get(), color, offset, size );
- break;
- }
- case Dali::TextActor::SHADOW_COLOR:
- {
- Vector4 color;
- Vector2 offset;
- float size;
- mTextAttachment->GetShadowParams( color, offset, size );
- mTextAttachment->SetShadow(mTextAttachment->GetShadow(), propertyValue.Get(), offset, size);
- break;
- }
- case Dali::TextActor::SHADOW_OFFSET:
- {
- Vector4 color;
- Vector2 offset;
- float size;
- mTextAttachment->GetShadowParams( color, offset, size );
- mTextAttachment->SetShadow(mTextAttachment->GetShadow(), color, propertyValue.Get(), size );
- break;
- }
- case Dali::TextActor::SHADOW_SIZE:
- {
- Vector4 color;
- Vector2 offset;
- float size;
- mTextAttachment->GetShadowParams( color, offset, size );
- mTextAttachment->SetShadow(mTextAttachment->GetShadow(), color, offset, propertyValue.Get());
- break;
- }
- case Dali::TextActor::ITALICS_ANGLE:
- {
- SetItalics(Radian(propertyValue.Get())) ;
- break;
- }
- case Dali::TextActor::UNDERLINE:
- {
- SetUnderline(propertyValue.Get(), 0.f, 0.f ) ;
- break;
- }
- case Dali::TextActor::WEIGHT:
- {
- mTextAttachment->SetWeight(static_cast(propertyValue.Get())) ;
- break;
- }
- case Dali::TextActor::FONT_DETECTION_AUTOMATIC:
- {
- mFontDetection = propertyValue.Get() ;
- break;
- }
- case Dali::TextActor::GRADIENT_COLOR:
- {
- mTextAttachment->SetGradient( propertyValue.Get(), mTextAttachment->GetGradientStartPoint(), mTextAttachment->GetGradientEndPoint() );
- break;
- }
- case Dali::TextActor::GRADIENT_START_POINT:
- {
- mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), propertyValue.Get(), mTextAttachment->GetGradientEndPoint() );
- break;
- }
- case Dali::TextActor::GRADIENT_END_POINT:
- {
- mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), mTextAttachment->GetGradientStartPoint(), propertyValue.Get() );
- break;
- }
- case Dali::TextActor::TEXT_COLOR:
- {
- mTextAttachment->SetTextColor( propertyValue.Get() );
- break;
- }
- default:
- {
- DALI_LOG_WARNING("Unknown text set property (%d)\n", index);
- break;
- }
- } // switch(index)
-
- } // else
-}
-
-Property::Value TextActor::GetDefaultProperty( Property::Index index ) const
-{
- Property::Value ret ;
- if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
- {
- ret = RenderableActor::GetDefaultProperty(index) ;
- }
- else
- {
- switch(index)
- {
- case Dali::TextActor::TEXT:
- {
- ret = GetText();
- break;
- }
- case Dali::TextActor::FONT:
- {
- ret = mTextAttachment->GetFont().GetName();
- break;
- }
- case Dali::TextActor::FONT_STYLE:
- {
- ret = mTextAttachment->GetFont().GetStyle();
- break;
- }
- case Dali::TextActor::OUTLINE_ENABLE:
- {
- ret = mTextAttachment->GetOutline();
- break;
- }
- case Dali::TextActor::OUTLINE_COLOR:
- {
- Vector4 color;
- Vector2 thickness;
- mTextAttachment->GetOutlineParams( color, thickness );
- ret = color;
- break;
- }
- case Dali::TextActor::OUTLINE_THICKNESS_WIDTH:
- {
- Vector4 color;
- Vector2 thickness;
- mTextAttachment->GetOutlineParams( color, thickness );
- ret = thickness;
- break;
- }
- case Dali::TextActor::SMOOTH_EDGE:
- {
- ret = mTextAttachment->GetSmoothEdge();
- break;
- }
- case Dali::TextActor::GLOW_ENABLE:
- {
- ret = mTextAttachment->GetGlow();
- break;
- }
- case Dali::TextActor::GLOW_COLOR:
- {
- Vector4 color;
- float intensity(0.0f);
- mTextAttachment->GetGlowParams( color, intensity );
- ret = color;
- break;
- }
- case Dali::TextActor::GLOW_INTENSITY:
- {
- Vector4 color;
- float intensity(0.0f);
- mTextAttachment->GetGlowParams( color, intensity );
- ret = intensity;
- break;
- }
- case Dali::TextActor::SHADOW_ENABLE:
- {
- ret = mTextAttachment->GetShadow();
- break;
- }
- case Dali::TextActor::SHADOW_COLOR:
- {
- Vector4 color;
- Vector2 offset;
- float size;
- mTextAttachment->GetShadowParams( color, offset, size );
- ret = color;
- break;
- }
- case Dali::TextActor::SHADOW_OFFSET:
- {
- Vector4 color;
- Vector2 offset;
- float size;
- mTextAttachment->GetShadowParams( color, offset, size );
- ret = offset;
- break;
- }
- case Dali::TextActor::SHADOW_SIZE:
- {
- Vector4 color;
- Vector2 offset;
- float size;
- mTextAttachment->GetShadowParams( color, offset, size );
- ret = size;
- break;
- }
- case Dali::TextActor::ITALICS_ANGLE:
- {
- ret = static_cast