From e2eda444afbe82e9591fe198eef339227f90a616 Mon Sep 17 00:00:00 2001
From: Paul Wisbey
Date: Mon, 3 Mar 2014 19:04:23 +0000
Subject: [PATCH] [SRUK] Initial copy from Tizen 2.2 version
Signed-off-by: Paul Wisbey
Change-Id: I1088d752201827b02c6b83015c00ff158f58e2ad
---
.gitignore | 56 +
LICENSE | 205 +
automated-tests/.gitignore | 7 +
automated-tests/_export_desktop.sh | 33 +
automated-tests/_export_env.sh | 17 +
automated-tests/_export_sbs.sh | 17 +
automated-tests/_export_target_env.sh | 17 +
automated-tests/build.sh | 70 +
automated-tests/build_out.sh | 3 +
automated-tests/coverage.mk | 1 +
automated-tests/coverage.sh | 22 +
.../dali-internal-test-suite/master-makefile.mk | 53 +
automated-tests/dali-internal-test-suite/tc-gen.sh | 1 +
.../dali-internal-test-suite/text-input/.gitignore | 1 +
.../dali-internal-test-suite/text-input/Makefile | 1 +
.../dali-internal-test-suite/text-input/file.list | 2 +
.../dali-internal-test-suite/text-input/tslist | 1 +
.../text-input/utc-Dali-TextInput.cpp | 145 +
.../dali-internal-test-suite/text-view/.gitignore | 5 +
.../dali-internal-test-suite/text-view/Makefile | 1 +
.../dali-internal-test-suite/text-view/file.list | 6 +
.../dali-internal-test-suite/text-view/tslist | 5 +
.../text-view/utc-Dali-TextView-HelperAndDebug.cpp | 304 ++
.../utc-Dali-TextView-Processor-Types.cpp | 311 ++
.../text-view/utc-Dali-TextView-Processor.cpp | 428 ++
.../utc-Dali-TextView-Relayout-Utilities.cpp | 856 ++++
.../text-view/utc-Dali-TextView.cpp | 2917 +++++++++++
.../utc-MODULE-CLASS.cpp.in | 96 +
automated-tests/dali-test-suite/.gitignore | 1 +
.../dali-test-suite/alignment/.gitignore | 1 +
automated-tests/dali-test-suite/alignment/Makefile | 1 +
.../dali-test-suite/alignment/file.list | 2 +
automated-tests/dali-test-suite/alignment/tslist | 1 +
.../alignment/utc-Dali-Alignment.cpp | 1127 +++++
.../dali-test-suite/bubble-emitter/.gitignore | 1 +
.../dali-test-suite/bubble-emitter/Makefile | 1 +
.../dali-test-suite/bubble-emitter/file.list | 2 +
.../dali-test-suite/bubble-emitter/tslist | 1 +
.../bubble-emitter/utc-Dali-BubbleEmitter.cpp | 423 ++
automated-tests/dali-test-suite/builder/.gitignore | 2 +
automated-tests/dali-test-suite/builder/Makefile | 1 +
automated-tests/dali-test-suite/builder/file.list | 3 +
automated-tests/dali-test-suite/builder/tslist | 2 +
.../dali-test-suite/builder/utc-Dali-Builder.cpp | 393 ++
.../builder/utc-Dali-JsonParser.cpp | 640 +++
automated-tests/dali-test-suite/buttons/.gitignore | 3 +
automated-tests/dali-test-suite/buttons/Makefile | 1 +
automated-tests/dali-test-suite/buttons/file.list | 4 +
automated-tests/dali-test-suite/buttons/tslist | 3 +
.../dali-test-suite/buttons/utc-Dali-Button.cpp | 397 ++
.../buttons/utc-Dali-CheckBoxButton.cpp | 230 +
.../buttons/utc-Dali-PushButton.cpp | 1263 +++++
automated-tests/dali-test-suite/cluster/.gitignore | 1 +
automated-tests/dali-test-suite/cluster/Makefile | 1 +
automated-tests/dali-test-suite/cluster/file.list | 2 +
automated-tests/dali-test-suite/cluster/tslist | 1 +
.../dali-test-suite/cluster/utc-Dali-Cluster.cpp | 224 +
automated-tests/dali-test-suite/control/.gitignore | 2 +
automated-tests/dali-test-suite/control/Makefile | 1 +
.../dali-test-suite/control/dummy-control.h | 237 +
automated-tests/dali-test-suite/control/file.list | 3 +
automated-tests/dali-test-suite/control/tslist | 2 +
.../dali-test-suite/control/utc-Dali-Control.cpp | 368 ++
.../control/utc-Dali-ControlImpl.cpp | 829 ++++
.../dali-test-suite/default-controls/.gitignore | 1 +
.../dali-test-suite/default-controls/Makefile | 1 +
.../dali-test-suite/default-controls/file.list | 2 +
.../dali-test-suite/default-controls/tslist | 1 +
.../default-controls/utc-Dali-DefaultControls.cpp | 258 +
.../dali-test-suite/focus-manager/.gitignore | 3 +
.../dali-test-suite/focus-manager/Makefile | 1 +
.../dali-test-suite/focus-manager/file.list | 4 +
.../dali-test-suite/focus-manager/tslist | 3 +
.../focus-manager/utc-Dali-FocusManager.cpp | 1070 +++++
.../utc-Dali-KeyInputFocusManager.cpp | 336 ++
.../utc-Dali-KeyboardFocusManager.cpp | 738 +++
.../dali-test-suite/item-view/.gitignore | 8 +
automated-tests/dali-test-suite/item-view/Makefile | 1 +
.../dali-test-suite/item-view/file.list | 9 +
automated-tests/dali-test-suite/item-view/tslist | 8 +
.../item-view/utc-Dali-AlbumLayout.cpp | 402 ++
.../item-view/utc-Dali-DepthLayout.cpp | 658 +++
.../item-view/utc-Dali-GridLayout.cpp | 579 +++
.../item-view/utc-Dali-ItemLayout.cpp | 171 +
.../item-view/utc-Dali-ItemView.cpp | 575 +++
.../item-view/utc-Dali-NavigationLayout.cpp | 616 +++
.../item-view/utc-Dali-RollLayout.cpp | 471 ++
.../item-view/utc-Dali-SpiralLayout.cpp | 606 +++
automated-tests/dali-test-suite/master-makefile.mk | 53 +
.../dali-test-suite/navigation-frame/.gitignore | 2 +
.../dali-test-suite/navigation-frame/Makefile | 1 +
.../dali-test-suite/navigation-frame/file.list | 3 +
.../dali-test-suite/navigation-frame/tslist | 2 +
.../utc-Dali-NavigationControl.cpp | 388 ++
.../navigation-frame/utc-Dali-Page.cpp | 262 +
.../dali-test-suite/page-turn-view/.gitignore | 1 +
.../dali-test-suite/page-turn-view/Makefile | 1 +
.../dali-test-suite/page-turn-view/file.list | 2 +
.../dali-test-suite/page-turn-view/tslist | 1 +
.../page-turn-view/utc-Dali-PageTurnView.cpp | 664 +++
automated-tests/dali-test-suite/popup/.gitignore | 1 +
automated-tests/dali-test-suite/popup/Makefile | 1 +
automated-tests/dali-test-suite/popup/file.list | 2 +
automated-tests/dali-test-suite/popup/tslist | 1 +
.../dali-test-suite/popup/utc-Dali-Popup.cpp | 470 ++
.../dali-test-suite/scroll-view/.gitignore | 1 +
.../dali-test-suite/scroll-view/Makefile | 1 +
.../dali-test-suite/scroll-view/file.list | 3 +
automated-tests/dali-test-suite/scroll-view/tslist | 2 +
.../scroll-view/utc-Dali-ScrollView.cpp | 1579 ++++++
.../scroll-view/utc-Dali-ScrollViewEffect.cpp | 934 ++++
.../dali-test-suite/selectors/.gitignore | 1 +
automated-tests/dali-test-suite/selectors/Makefile | 1 +
.../dali-test-suite/selectors/file.list | 2 +
automated-tests/dali-test-suite/selectors/tslist | 1 +
.../selectors/utc-Dali-RotatingSelector.cpp | 277 ++
.../dali-test-suite/shader-effects/.gitignore | 23 +
.../dali-test-suite/shader-effects/Makefile | 1 +
.../dali-test-suite/shader-effects/file.list | 23 +
.../dali-test-suite/shader-effects/tslist | 22 +
.../shader-effects/utc-Dali-BendyEffect.cpp | 193 +
.../shader-effects/utc-Dali-BlindEffect.cpp | 168 +
.../shader-effects/utc-Dali-BloomView.cpp | 194 +
.../shader-effects/utc-Dali-CarouselEffect.cpp | 179 +
.../shader-effects/utc-Dali-DisplacementEffect.cpp | 177 +
.../shader-effects/utc-Dali-DissolveEffect.cpp | 197 +
.../utc-Dali-DistanceFieldEffect.cpp | 202 +
.../shader-effects/utc-Dali-GaussianBlurView.cpp | 232 +
.../shader-effects/utc-Dali-IrisEffect.cpp | 179 +
.../shader-effects/utc-Dali-MaskEffect.cpp | 101 +
.../utc-Dali-NinePatchMaskEffect.cpp | 109 +
.../shader-effects/utc-Dali-OverlayEffect.cpp | 124 +
.../shader-effects/utc-Dali-PageTurnEffect.cpp | 132 +
.../shader-effects/utc-Dali-Ripple2DEffect.cpp | 176 +
.../shader-effects/utc-Dali-RippleEffect.cpp | 187 +
.../shader-effects/utc-Dali-ShadowView.cpp | 190 +
.../shader-effects/utc-Dali-ShearEffect.cpp | 196 +
.../shader-effects/utc-Dali-SoftButtonEffect.cpp | 110 +
.../shader-effects/utc-Dali-SpotEffect.cpp | 180 +
.../utc-Dali-SquareDissolveEffect.cpp | 204 +
.../shader-effects/utc-Dali-SwirlEffect.cpp | 192 +
.../shader-effects/utc-Dali-WaterEffect.cpp | 378 ++
automated-tests/dali-test-suite/slider/.gitignore | 1 +
automated-tests/dali-test-suite/slider/Makefile | 1 +
automated-tests/dali-test-suite/slider/file.list | 2 +
automated-tests/dali-test-suite/slider/tslist | 1 +
.../dali-test-suite/slider/utc-Dali-Slider.cpp | 199 +
.../dali-test-suite/super-blur-view/.gitignore | 1 +
.../dali-test-suite/super-blur-view/Makefile | 1 +
.../dali-test-suite/super-blur-view/file.list | 2 +
.../dali-test-suite/super-blur-view/tslist | 1 +
.../super-blur-view/utc-Dali-SuperBlurView.cpp | 240 +
.../dali-test-suite/table-view/.gitignore | 1 +
.../dali-test-suite/table-view/Makefile | 1 +
.../dali-test-suite/table-view/file.list | 2 +
automated-tests/dali-test-suite/table-view/tslist | 1 +
.../table-view/utc-Dali-TableView.cpp | 575 +++
automated-tests/dali-test-suite/tc-gen.sh | 58 +
.../dali-test-suite/text-input/.gitignore | 1 +
.../dali-test-suite/text-input/Makefile | 1 +
.../dali-test-suite/text-input/file.list | 2 +
automated-tests/dali-test-suite/text-input/tslist | 1 +
.../text-input/utc-Dali-TextInput.cpp | 531 ++
.../dali-test-suite/text-view/.gitignore | 2 +
automated-tests/dali-test-suite/text-view/Makefile | 1 +
.../dali-test-suite/text-view/file.list | 3 +
automated-tests/dali-test-suite/text-view/tslist | 2 +
.../text-view/utc-Dali-MarkupProcessor.cpp | 418 ++
.../text-view/utc-Dali-TextView.cpp | 839 ++++
automated-tests/dali-test-suite/toolbar/.gitignore | 2 +
automated-tests/dali-test-suite/toolbar/Makefile | 1 +
automated-tests/dali-test-suite/toolbar/file.list | 2 +
automated-tests/dali-test-suite/toolbar/tslist | 1 +
.../dali-test-suite/toolbar/utc-Dali-ToolBar.cpp | 288 ++
.../dali-test-suite/transition-effects/.gitignore | 3 +
.../dali-test-suite/transition-effects/Makefile | 1 +
.../dali-test-suite/transition-effects/file.list | 2 +
.../dali-test-suite/transition-effects/tslist | 1 +
.../utc-Dali-CubeTransitionEffect.cpp | 965 ++++
.../dali-test-suite/ui-builder/.gitignore | 1 +
.../dali-test-suite/ui-builder/file.list | 2 +
.../dali-test-suite/utc-MODULE-CLASS.cpp.in | 96 +
automated-tests/dali-test-suite/view/.gitignore | 1 +
automated-tests/dali-test-suite/view/Makefile | 1 +
automated-tests/dali-test-suite/view/file.list | 2 +
automated-tests/dali-test-suite/view/tslist | 1 +
.../dali-test-suite/view/utc-Dali-View.cpp | 413 ++
.../dali-toolkit-test-suite-utils.h | 26 +
.../toolkit-accessibility-manager.cpp | 212 +
.../toolkit-accessibility-manager.h | 75 +
.../dali-toolkit-test-utils/toolkit-adaptor.cpp | 249 +
.../dali-toolkit-test-utils/toolkit-adaptor.h | 259 +
.../toolkit-application.cpp | 103 +
.../dali-toolkit-test-utils/toolkit-application.h | 91 +
.../toolkit-clipboard-event-notifier.cpp | 106 +
.../toolkit-clipboard-event-notifier.h | 68 +
.../toolkit-orientation.cpp | 143 +
.../dali-toolkit-test-utils/toolkit-orientation.h | 129 +
.../toolkit-physical-keyboard.cpp | 119 +
.../toolkit-physical-keyboard.h | 68 +
.../toolkit-style-monitor.cpp | 138 +
.../toolkit-style-monitor.h | 130 +
.../toolkit-test-application.h | 69 +
.../dali-toolkit-test-utils/toolkit-timer.cpp | 168 +
.../dali-toolkit-test-utils/toolkit-timer.h | 69 +
automated-tests/debug.sh | 53 +
automated-tests/debug_target.sh | 52 +
automated-tests/execute.sh | 42 +
automated-tests/execute_target.sh | 39 +
automated-tests/rules.mk.in | 11 +
automated-tests/tbp.pl | 339 ++
automated-tests/tet_scen | 126 +
automated-tests/tetbuild.cfg | 5 +
automated-tests/tetclean.cfg | 5 +
automated-tests/tetexec.cfg | 5 +
build/slp/.gitignore | 19 +
build/slp/Makefile.am | 55 +
build/slp/README | 3 +
build/slp/configure.ac | 96 +
build/slp/dali-toolkit.pc.in | 12 +
build/slp/dali-toolkit/Makefile.am | 215 +
.../public-api/controls/alignment/alignment.h | 201 +
.../controls/bubble-effect/bubble-emitter.h | 182 +
.../public-api/controls/buttons/button.h | 156 +
.../public-api/controls/buttons/push-button.h | 366 ++
.../public-api/controls/cluster/cluster-style.h | 174 +
.../public-api/controls/control-impl.h | 592 +++
capi/dali-toolkit/public-api/controls/control.h | 349 ++
.../default-controls/push-button-factory.h | 90 +
.../controls/default-controls/solid-color-actor.h | 55 +
.../controls/image-view/masked-image-view.h | 270 ++
.../dali-toolkit/public-api/controls/popup/popup.h | 277 ++
.../controls/scroll-component/scroll-bar.h | 125 +
.../controls/scroll-component/scroll-component.h | 101 +
.../controls/scrollable/item-view/grid-layout.h | 288 ++
.../controls/scrollable/item-view/item-factory.h | 68 +
.../controls/scrollable/item-view/item-layout.h | 367 ++
.../controls/scrollable/item-view/item-view.h | 280 ++
.../scroll-view/scroll-view-cube-effect.h | 139 +
.../scroll-view/scroll-view-custom-effect.h | 433 ++
.../scrollable/scroll-view/scroll-view-effect.h | 88 +
.../scroll-view/scroll-view-page-spiral-effect.h | 113 +
.../scroll-view/scroll-view-slide-effect.h | 159 +
.../scroll-view/scroll-view-twist-effect.h | 163 +
.../controls/scrollable/scroll-view/scroll-view.h | 1055 ++++
.../public-api/controls/scrollable/scrollable.h | 205 +
.../controls/super-blur-view/super-blur-view.h | 165 +
.../public-api/controls/text-input/text-input.h | 584 +++
.../public-api/controls/text-view/text-view.h | 641 +++
.../public-api/dali-toolkit-capi-internal.h | 65 +
capi/dali-toolkit/public-api/enums.h | 71 +
.../public-api/factory/localized-control-factory.h | 100 +
capi/dali-toolkit/public-api/file.list | 83 +
.../public-api/focus-manager/focus-manager.h | 358 ++
.../focus-manager/keyboard-focus-manager.h | 245 +
.../public-api/markup-processor/markup-processor.h | 167 +
.../public-api/shader-effects/dissolve-effect.h | 94 +
.../shader-effects/image-region-effect.h | 97 +
.../public-api/shader-effects/iris-effect.h | 120 +
.../public-api/shader-effects/mask-effect.h | 76 +
.../shader-effects/nine-patch-mask-effect.h | 77 +
.../shader-effects/page-turn-book-spine-effect.h | 99 +
.../public-api/shader-effects/page-turn-effect.h | 167 +
.../public-api/shader-effects/ripple-effect.h | 108 +
.../public-api/shader-effects/ripple2d-effect.h | 95 +
.../public-api/shader-effects/swirl-effect.h | 105 +
dali-toolkit.manifest | 8 +
dali-toolkit/dali-toolkit.h | 88 +
dali-toolkit/images/00_popup_bg.png | Bin 0 -> 4323 bytes
dali-toolkit/images/00_popup_bottom_bg.png | Bin 0 -> 2858 bytes
dali-toolkit/images/00_popup_bubble_bg.png | Bin 0 -> 4235 bytes
.../images/00_popup_bubble_tail_bottom.png | Bin 0 -> 3782 bytes
dali-toolkit/images/00_popup_button_bg.png | Bin 0 -> 2975 bytes
dali-toolkit/images/00_popup_button_pressed.png | Bin 0 -> 1480 bytes
dali-toolkit/images/B16-8_TTS_focus.png | Bin 0 -> 3097 bytes
dali-toolkit/images/copy_paste_icon_clipboard.png | Bin 0 -> 1374 bytes
dali-toolkit/images/copy_paste_icon_copy.png | Bin 0 -> 1277 bytes
dali-toolkit/images/copy_paste_icon_cut.png | Bin 0 -> 3745 bytes
dali-toolkit/images/copy_paste_icon_paste.png | Bin 0 -> 1329 bytes
dali-toolkit/images/copy_paste_icon_select.png | Bin 0 -> 1678 bytes
dali-toolkit/images/copy_paste_icon_select_all.png | Bin 0 -> 1643 bytes
dali-toolkit/images/copypanelLine.png | Bin 0 -> 154 bytes
dali-toolkit/images/cursor.png | Bin 0 -> 2821 bytes
dali-toolkit/images/cutCopyPastePopup_bg.png | Bin 0 -> 4264 bytes
dali-toolkit/images/file.list | 4 +
dali-toolkit/images/insertpoint-icon.png | Bin 0 -> 5136 bytes
dali-toolkit/images/keyboard_focus.png | Bin 0 -> 3020 bytes
dali-toolkit/images/magnifier-image-frame.png | Bin 0 -> 1222 bytes
dali-toolkit/images/magnifier.png | Bin 0 -> 5191 bytes
dali-toolkit/images/overshoot_ripple.png | Bin 0 -> 281234 bytes
dali-toolkit/images/popup_bg.png | Bin 0 -> 3869 bytes
dali-toolkit/images/popup_scroll.png | Bin 0 -> 1304 bytes
dali-toolkit/images/popup_tail_down.png | Bin 0 -> 3765 bytes
dali-toolkit/images/popup_tail_left.png | Bin 0 -> 3685 bytes
dali-toolkit/images/popup_tail_right.png | Bin 0 -> 3731 bytes
dali-toolkit/images/popup_tail_up.png | Bin 0 -> 3712 bytes
dali-toolkit/images/scroll_overshoot.png | Bin 0 -> 2831 bytes
dali-toolkit/images/slider-popup-arrow.png | Bin 0 -> 2916 bytes
dali-toolkit/images/slider-popup.png | Bin 0 -> 233 bytes
dali-toolkit/images/slider-skin-handle.png | Bin 0 -> 5721 bytes
dali-toolkit/images/slider-skin-progress.png | Bin 0 -> 389 bytes
dali-toolkit/images/slider-skin.png | Bin 0 -> 1718 bytes
.../text-input-selection-handle-left-press.png | Bin 0 -> 4637 bytes
.../images/text-input-selection-handle-left.png | Bin 0 -> 4637 bytes
.../text-input-selection-handle-right-press.png | Bin 0 -> 4689 bytes
.../images/text-input-selection-handle-right.png | Bin 0 -> 4689 bytes
dali-toolkit/internal/builder/builder-actor.cpp | 230 +
.../internal/builder/builder-animations.cpp | 336 ++
dali-toolkit/internal/builder/builder-control.cpp | 112 +
.../internal/builder/builder-declarations.h | 43 +
dali-toolkit/internal/builder/builder-filesystem.h | 48 +
dali-toolkit/internal/builder/builder-get-is.inl.h | 388 ++
dali-toolkit/internal/builder/builder-impl.cpp | 693 +++
dali-toolkit/internal/builder/builder-impl.h | 196 +
.../internal/builder/builder-set-property.cpp | 488 ++
dali-toolkit/internal/builder/builder-signals.cpp | 467 ++
dali-toolkit/internal/builder/json-parser-impl.cpp | 186 +
dali-toolkit/internal/builder/json-parser-impl.h | 156 +
.../internal/builder/json-parser-state.cpp | 966 ++++
dali-toolkit/internal/builder/json-parser-state.h | 313 ++
dali-toolkit/internal/builder/optional-value.h | 92 +
.../internal/builder/tree-node-manipulator.cpp | 522 ++
.../internal/builder/tree-node-manipulator.h | 260 +
.../internal/controls/alignment/alignment-impl.cpp | 642 +++
.../internal/controls/alignment/alignment-impl.h | 141 +
.../controls/bloom-view/bloom-view-impl.cpp | 595 +++
.../internal/controls/bloom-view/bloom-view-impl.h | 191 +
.../controls/bubble-effect/bubble-emitter-impl.cpp | 393 ++
.../controls/bubble-effect/bubble-emitter-impl.h | 241 +
.../internal/controls/buttons/button-impl.cpp | 241 +
.../internal/controls/buttons/button-impl.h | 243 +
.../controls/buttons/button-painter-impl.h | 109 +
.../check-box-button-default-painter-impl.cpp | 1051 ++++
.../check-box-button-default-painter-impl.h | 340 ++
.../controls/buttons/check-box-button-impl.cpp | 271 ++
.../controls/buttons/check-box-button-impl.h | 272 ++
.../buttons/check-box-button-painter-impl.h | 99 +
.../buttons/push-button-default-painter-impl.cpp | 1304 +++++
.../buttons/push-button-default-painter-impl.h | 355 ++
.../internal/controls/buttons/push-button-impl.cpp | 553 +++
.../internal/controls/buttons/push-button-impl.h | 422 ++
.../controls/buttons/push-button-painter-impl.h | 131 +
.../internal/controls/cluster/cluster-impl.cpp | 563 +++
.../internal/controls/cluster/cluster-impl.h | 316 ++
.../controls/cluster/cluster-style-impl.cpp | 641 +++
.../internal/controls/cluster/cluster-style-impl.h | 246 +
.../controls/effects-view/effects-view-impl.cpp | 524 ++
.../controls/effects-view/effects-view-impl.h | 275 ++
.../gaussian-blur-view/gaussian-blur-view-impl.cpp | 661 +++
.../gaussian-blur-view/gaussian-blur-view-impl.h | 219 +
.../controls/image-view/image-view-impl.cpp | 223 +
.../internal/controls/image-view/image-view-impl.h | 208 +
.../controls/image-view/masked-image-view-impl.cpp | 634 +++
.../controls/image-view/masked-image-view-impl.h | 272 ++
.../internal/controls/magnifier/magnifier-impl.cpp | 386 ++
.../internal/controls/magnifier/magnifier-impl.h | 162 +
.../controls/navigation-frame/navigation-bar.cpp | 122 +
.../controls/navigation-frame/navigation-bar.h | 139 +
.../navigation-frame/navigation-control-impl.cpp | 454 ++
.../navigation-frame/navigation-control-impl.h | 267 ++
.../navigation-frame/navigation-title-bar.cpp | 173 +
.../navigation-frame/navigation-title-bar.h | 95 +
.../navigation-frame/navigation-tool-bar.cpp | 181 +
.../navigation-frame/navigation-tool-bar.h | 101 +
.../controls/navigation-frame/page-impl.cpp | 187 +
.../internal/controls/navigation-frame/page-impl.h | 179 +
.../page-turn-landscape-view-impl.cpp | 141 +
.../page-turn-view/page-turn-landscape-view-impl.h | 102 +
.../page-turn-portrait-view-impl.cpp | 165 +
.../page-turn-view/page-turn-portrait-view-impl.h | 113 +
.../page-turn-view/page-turn-view-impl.cpp | 1063 ++++
.../controls/page-turn-view/page-turn-view-impl.h | 386 ++
.../internal/controls/popup/popup-impl.cpp | 1048 ++++
dali-toolkit/internal/controls/popup/popup-impl.h | 354 ++
.../internal/controls/popup/popup-style-impl.cpp | 114 +
.../internal/controls/popup/popup-style-impl.h | 113 +
.../internal/controls/relayout-controller-impl.cpp | 233 +
.../internal/controls/relayout-controller-impl.h | 109 +
.../internal/controls/relayout-controller.cpp | 94 +
.../internal/controls/relayout-controller.h | 74 +
dali-toolkit/internal/controls/relayout-helper.cpp | 95 +
dali-toolkit/internal/controls/relayout-helper.h | 54 +
.../controls/scroll-component/scroll-bar-impl.cpp | 615 +++
.../controls/scroll-component/scroll-bar-impl.h | 169 +
.../scroll-component/scroll-component-impl.cpp | 82 +
.../scroll-component/scroll-component-impl.h | 111 +
.../scrollable/item-view/item-view-impl.cpp | 1586 ++++++
.../controls/scrollable/item-view/item-view-impl.h | 595 +++
.../scrollable/scroll-view/scroll-base-impl.cpp | 158 +
.../scrollable/scroll-view/scroll-base-impl.h | 230 +
.../scroll-overshoot-indicator-impl.cpp | 629 +++
.../scroll-view/scroll-overshoot-indicator-impl.h | 388 ++
.../scroll-view-carousel-effect-impl.cpp | 307 ++
.../scroll-view/scroll-view-carousel-effect-impl.h | 115 +
.../scroll-view/scroll-view-cube-effect-impl.cpp | 393 ++
.../scroll-view/scroll-view-cube-effect-impl.h | 127 +
.../scroll-view/scroll-view-custom-effect-impl.cpp | 1295 +++++
.../scroll-view/scroll-view-custom-effect-impl.h | 418 ++
.../scroll-view/scroll-view-depth-effect-impl.cpp | 401 ++
.../scroll-view/scroll-view-depth-effect-impl.h | 119 +
.../scroll-view/scroll-view-effect-impl.cpp | 70 +
.../scroll-view/scroll-view-effect-impl.h | 136 +
.../scroll-view/scroll-view-helper-functions.cpp | 62 +
.../scroll-view/scroll-view-helper-functions.h | 69 +
.../scrollable/scroll-view/scroll-view-impl.cpp | 2628 ++++++++++
.../scrollable/scroll-view/scroll-view-impl.h | 931 ++++
.../scroll-view-page-carousel-effect-impl.cpp | 246 +
.../scroll-view-page-carousel-effect-impl.h | 113 +
.../scroll-view-page-cube-effect-impl.cpp | 327 ++
.../scroll-view-page-cube-effect-impl.h | 114 +
.../scroll-view-page-spiral-effect-impl.cpp | 424 ++
.../scroll-view-page-spiral-effect-impl.h | 113 +
.../scroll-view/scroll-view-slide-effect-impl.cpp | 651 +++
.../scroll-view/scroll-view-slide-effect-impl.h | 223 +
.../scroll-view/scroll-view-twist-effect-impl.cpp | 731 +++
.../scroll-view/scroll-view-twist-effect-impl.h | 230 +
.../scroll-view/scroll-view-wobble-effect-impl.cpp | 314 ++
.../scroll-view/scroll-view-wobble-effect-impl.h | 160 +
.../controls/scrollable/scrollable-impl.cpp | 198 +
.../internal/controls/scrollable/scrollable-impl.h | 235 +
.../controls/selectors/rotating-selector-impl.cpp | 273 ++
.../controls/selectors/rotating-selector-impl.h | 186 +
.../controls/shadow-view/shadow-view-impl.cpp | 390 ++
.../controls/shadow-view/shadow-view-impl.h | 199 +
.../internal/controls/slider/slider-impl.cpp | 1081 +++++
.../internal/controls/slider/slider-impl.h | 728 +++
.../internal/controls/style-change-processor.cpp | 122 +
.../internal/controls/style-change-processor.h | 125 +
.../super-blur-view/super-blur-view-impl.cpp | 258 +
.../super-blur-view/super-blur-view-impl.h | 164 +
.../internal/controls/table-view/array-2d.h | 274 ++
.../controls/table-view/table-view-impl.cpp | 1092 +++++
.../internal/controls/table-view/table-view-impl.h | 348 ++
.../controls/text-input/text-input-impl.cpp | 5072 ++++++++++++++++++++
.../internal/controls/text-input/text-input-impl.h | 1465 ++++++
.../controls/text-input/text-input-popup-impl.cpp | 561 +++
.../controls/text-input/text-input-popup-impl.h | 234 +
.../controls/text-view/relayout-utilities.cpp | 1958 ++++++++
.../controls/text-view/relayout-utilities.h | 501 ++
.../controls/text-view/split-by-char-policies.cpp | 296 ++
.../controls/text-view/split-by-char-policies.h | 59 +
.../text-view/split-by-new-line-char-policies.cpp | 352 ++
.../text-view/split-by-new-line-char-policies.h | 60 +
.../controls/text-view/split-by-word-policies.cpp | 695 +++
.../controls/text-view/split-by-word-policies.h | 59 +
.../controls/text-view/text-actor-cache.cpp | 71 +
.../internal/controls/text-view/text-actor-cache.h | 82 +
.../internal/controls/text-view/text-processor.cpp | 358 ++
.../internal/controls/text-view/text-processor.h | 118 +
.../text-view/text-view-character-processor.cpp | 113 +
.../internal/controls/text-view/text-view-impl.cpp | 2087 ++++++++
.../internal/controls/text-view/text-view-impl.h | 735 +++
.../text-view/text-view-line-processor.cpp | 427 ++
.../controls/text-view/text-view-line-processor.h | 144 +
.../controls/text-view/text-view-processor-dbg.cpp | 172 +
.../controls/text-view/text-view-processor-dbg.h | 53 +
.../text-view-processor-helper-functions.cpp | 196 +
.../text-view-processor-helper-functions.h | 113 +
.../controls/text-view/text-view-processor-types.h | 273 ++
.../controls/text-view/text-view-processor.cpp | 1208 +++++
.../controls/text-view/text-view-processor.h | 133 +
.../text-view/text-view-word-group-processor.cpp | 550 +++
.../text-view/text-view-word-group-processor.h | 138 +
.../text-view/text-view-word-processor.cpp | 415 ++
.../controls/text-view/text-view-word-processor.h | 162 +
.../internal/controls/tool-bar/tool-bar-impl.cpp | 357 ++
.../internal/controls/tool-bar/tool-bar-impl.h | 168 +
dali-toolkit/internal/controls/view/view-impl.cpp | 342 ++
dali-toolkit/internal/controls/view/view-impl.h | 205 +
.../factory/localized-control-factory-impl.cpp | 120 +
.../factory/localized-control-factory-impl.h | 138 +
dali-toolkit/internal/file.list | 97 +
.../internal/filters/blur-two-pass-filter.cpp | 327 ++
.../internal/filters/blur-two-pass-filter.h | 121 +
dali-toolkit/internal/filters/emboss-filter.cpp | 293 ++
dali-toolkit/internal/filters/emboss-filter.h | 98 +
dali-toolkit/internal/filters/image-filter.cpp | 127 +
dali-toolkit/internal/filters/image-filter.h | 164 +
dali-toolkit/internal/filters/spread-filter.cpp | 223 +
dali-toolkit/internal/filters/spread-filter.h | 105 +
.../internal/focus-manager/focus-manager-impl.cpp | 917 ++++
.../internal/focus-manager/focus-manager-impl.h | 406 ++
.../focus-manager/keyboard-focus-manager-impl.cpp | 720 +++
.../focus-manager/keyboard-focus-manager-impl.h | 285 ++
.../focus-manager/keyinput-focus-manager-impl.cpp | 234 +
.../focus-manager/keyinput-focus-manager-impl.h | 165 +
.../shader-effects/page-turn-effect-impl.cpp | 471 ++
.../shader-effects/page-turn-effect-impl.h | 143 +
.../internal/shader-effects/water-effect-impl.cpp | 198 +
.../internal/shader-effects/water-effect-impl.h | 146 +
.../cube-transition-cross-effect-impl.cpp | 139 +
.../cube-transition-cross-effect-impl.h | 118 +
.../cube-transition-effect-impl.cpp | 346 ++
.../cube-transition-effect-impl.h | 343 ++
.../cube-transition-fold-effect-impl.cpp | 138 +
.../cube-transition-fold-effect-impl.h | 116 +
.../cube-transition-wave-effect-impl.cpp | 201 +
.../cube-transition-wave-effect-impl.h | 132 +
dali-toolkit/public-api/builder/builder.cpp | 129 +
dali-toolkit/public-api/builder/builder.h | 270 ++
dali-toolkit/public-api/builder/json-parser.cpp | 114 +
dali-toolkit/public-api/builder/json-parser.h | 146 +
dali-toolkit/public-api/builder/tree-node.cpp | 197 +
dali-toolkit/public-api/builder/tree-node.h | 239 +
.../public-api/controls/alignment/alignment.cpp | 109 +
.../public-api/controls/bloom-view/bloom-view.cpp | 131 +
.../public-api/controls/bloom-view/bloom-view.h | 253 +
.../controls/bubble-effect/bubble-emitter.cpp | 122 +
.../public-api/controls/buttons/button.cpp | 98 +
.../controls/buttons/check-box-button.cpp | 154 +
.../public-api/controls/buttons/check-box-button.h | 206 +
.../public-api/controls/buttons/push-button.cpp | 238 +
.../public-api/controls/cluster/cluster-style.cpp | 97 +
.../public-api/controls/cluster/cluster.cpp | 176 +
dali-toolkit/public-api/controls/cluster/cluster.h | 256 +
dali-toolkit/public-api/controls/control-impl.cpp | 840 ++++
dali-toolkit/public-api/controls/control.cpp | 174 +
.../default-controls/check-button-factory.cpp | 144 +
.../default-controls/check-button-factory.h | 79 +
.../default-controls/push-button-factory.cpp | 145 +
.../default-controls/solid-color-actor.cpp | 99 +
.../controls/effects-view/effects-view.cpp | 153 +
.../controls/effects-view/effects-view.h | 227 +
.../gaussian-blur-view/gaussian-blur-view.cpp | 138 +
.../gaussian-blur-view/gaussian-blur-view.h | 274 ++
.../public-api/controls/image-view/image-view.cpp | 121 +
.../public-api/controls/image-view/image-view.h | 196 +
.../controls/image-view/masked-image-view.cpp | 167 +
.../public-api/controls/magnifier/magnifier.cpp | 110 +
.../public-api/controls/magnifier/magnifier.h | 151 +
.../navigation-frame/navigation-bar-style.h | 150 +
.../navigation-frame/navigation-control.cpp | 140 +
.../controls/navigation-frame/navigation-control.h | 246 +
.../public-api/controls/navigation-frame/page.cpp | 135 +
.../public-api/controls/navigation-frame/page.h | 209 +
.../controls/page-turn-view/page-factory.cpp | 85 +
.../controls/page-turn-view/page-factory.h | 122 +
.../page-turn-view/page-turn-landscape-view.cpp | 75 +
.../page-turn-view/page-turn-landscape-view.h | 100 +
.../page-turn-view/page-turn-portrait-view.cpp | 75 +
.../page-turn-view/page-turn-portrait-view.h | 98 +
.../controls/page-turn-view/page-turn-view.cpp | 133 +
.../controls/page-turn-view/page-turn-view.h | 218 +
dali-toolkit/public-api/controls/popup/popup.cpp | 153 +
.../controls/scroll-component/scroll-bar.cpp | 81 +
.../controls/scroll-component/scroll-component.cpp | 66 +
.../controls/scrollable/item-view/album-layout.cpp | 1393 ++++++
.../controls/scrollable/item-view/album-layout.h | 369 ++
.../controls/scrollable/item-view/depth-layout.cpp | 761 +++
.../controls/scrollable/item-view/depth-layout.h | 288 ++
.../controls/scrollable/item-view/grid-layout.cpp | 762 +++
.../controls/scrollable/item-view/item-factory.cpp | 31 +
.../controls/scrollable/item-view/item-layout.cpp | 241 +
.../controls/scrollable/item-view/item-view.cpp | 192 +
.../scrollable/item-view/navigation-layout.cpp | 579 +++
.../scrollable/item-view/navigation-layout.h | 246 +
.../controls/scrollable/item-view/roll-layout.cpp | 588 +++
.../controls/scrollable/item-view/roll-layout.h | 198 +
.../scrollable/item-view/spiral-layout.cpp | 599 +++
.../controls/scrollable/item-view/spiral-layout.h | 242 +
.../scroll-view/scroll-view-carousel-effect.cpp | 59 +
.../scroll-view/scroll-view-carousel-effect.h | 114 +
.../scroll-view/scroll-view-constraints.cpp | 92 +
.../scroll-view/scroll-view-constraints.h | 83 +
.../scroll-view/scroll-view-cube-effect.cpp | 69 +
.../scroll-view/scroll-view-custom-effect.cpp | 268 ++
.../scroll-view/scroll-view-depth-effect.cpp | 61 +
.../scroll-view/scroll-view-depth-effect.h | 119 +
.../scrollable/scroll-view/scroll-view-effect.cpp | 40 +
.../scroll-view-page-carousel-effect.cpp | 58 +
.../scroll-view/scroll-view-page-carousel-effect.h | 103 +
.../scroll-view/scroll-view-page-cube-effect.cpp | 58 +
.../scroll-view/scroll-view-page-cube-effect.h | 103 +
.../scroll-view/scroll-view-page-spiral-effect.cpp | 58 +
.../scroll-view/scroll-view-slide-effect.cpp | 94 +
.../scroll-view/scroll-view-twist-effect.cpp | 99 +
.../scroll-view/scroll-view-wobble-effect.cpp | 50 +
.../scroll-view/scroll-view-wobble-effect.h | 77 +
.../scrollable/scroll-view/scroll-view.cpp | 638 +++
.../public-api/controls/scrollable/scrollable.cpp | 113 +
.../controls/selectors/rotating-selector.cpp | 120 +
.../controls/selectors/rotating-selector.h | 160 +
.../controls/shadow-view/shadow-view.cpp | 138 +
.../public-api/controls/shadow-view/shadow-view.h | 258 +
dali-toolkit/public-api/controls/slider/slider.cpp | 125 +
dali-toolkit/public-api/controls/slider/slider.h | 152 +
.../controls/super-blur-view/super-blur-view.cpp | 103 +
.../public-api/controls/table-view/table-view.cpp | 206 +
.../public-api/controls/table-view/table-view.h | 322 ++
.../public-api/controls/text-input/text-input.cpp | 384 ++
.../public-api/controls/text-view/text-view.cpp | 388 ++
.../public-api/controls/tool-bar/tool-bar.cpp | 96 +
.../public-api/controls/tool-bar/tool-bar.h | 131 +
dali-toolkit/public-api/controls/view/view.cpp | 125 +
dali-toolkit/public-api/controls/view/view.h | 216 +
dali-toolkit/public-api/enums.cpp | 39 +
.../factory/localized-control-factory.cpp | 77 +
dali-toolkit/public-api/file.list | 233 +
.../public-api/focus-manager/focus-manager.cpp | 207 +
.../focus-manager/keyboard-focus-manager.cpp | 135 +
.../focus-manager/keyinput-focus-manager.cpp | 105 +
.../focus-manager/keyinput-focus-manager.h | 143 +
.../markup-processor/markup-processor.cpp | 1107 +++++
.../shader-effects/alpha-discard-effect.cpp | 60 +
.../shader-effects/alpha-discard-effect.h | 68 +
.../public-api/shader-effects/bendy-effect.cpp | 146 +
.../public-api/shader-effects/bendy-effect.h | 100 +
.../public-api/shader-effects/blind-effect.cpp | 96 +
.../public-api/shader-effects/blind-effect.h | 75 +
.../shader-effects/bubble-effect/bubble-effect.cpp | 251 +
.../shader-effects/bubble-effect/bubble-effect.h | 139 +
.../bubble-effect/color-adjuster.cpp | 97 +
.../shader-effects/bubble-effect/color-adjuster.h | 68 +
.../public-api/shader-effects/carousel-effect.cpp | 117 +
.../public-api/shader-effects/carousel-effect.h | 118 +
.../shader-effects/displacement-effect.cpp | 240 +
.../shader-effects/displacement-effect.h | 221 +
.../public-api/shader-effects/dissolve-effect.cpp | 198 +
.../shader-effects/dissolve-local-effect.cpp | 167 +
.../shader-effects/dissolve-local-effect.h | 129 +
.../shader-effects/distance-field-effect.cpp | 312 ++
.../shader-effects/distance-field-effect.h | 196 +
.../shader-effects/image-region-effect.cpp | 100 +
.../public-api/shader-effects/iris-effect.cpp | 120 +
.../public-api/shader-effects/mask-effect.cpp | 61 +
.../public-api/shader-effects/mirror-effect.cpp | 122 +
.../public-api/shader-effects/mirror-effect.h | 88 +
.../shader-effects/motion-blur-effect.cpp | 328 ++
.../public-api/shader-effects/motion-blur-effect.h | 213 +
.../shader-effects/motion-stretch-effect.cpp | 299 ++
.../shader-effects/motion-stretch-effect.h | 165 +
.../shader-effects/nine-patch-mask-effect.cpp | 117 +
.../public-api/shader-effects/overlay-effect.cpp | 70 +
.../public-api/shader-effects/overlay-effect.h | 68 +
.../shader-effects/page-turn-book-spine-effect.cpp | 130 +
.../public-api/shader-effects/page-turn-effect.cpp | 96 +
.../public-api/shader-effects/ripple-effect.cpp | 141 +
.../public-api/shader-effects/ripple2d-effect.cpp | 106 +
.../public-api/shader-effects/shear-effect.cpp | 119 +
.../public-api/shader-effects/shear-effect.h | 98 +
.../shader-effects/soft-button-effect.cpp | 423 ++
.../public-api/shader-effects/soft-button-effect.h | 175 +
.../public-api/shader-effects/spot-effect.cpp | 116 +
.../public-api/shader-effects/spot-effect.h | 86 +
.../shader-effects/square-dissolve-effect.cpp | 132 +
.../shader-effects/square-dissolve-effect.h | 113 +
.../public-api/shader-effects/swirl-effect.cpp | 136 +
.../public-api/shader-effects/water-effect.cpp | 101 +
.../public-api/shader-effects/water-effect.h | 165 +
.../cube-transition-cross-effect.cpp | 41 +
.../cube-transition-cross-effect.h | 70 +
.../transition-effects/cube-transition-effect.cpp | 116 +
.../transition-effects/cube-transition-effect.h | 204 +
.../cube-transition-fold-effect.cpp | 41 +
.../cube-transition-fold-effect.h | 70 +
.../cube-transition-wave-effect.cpp | 41 +
.../cube-transition-wave-effect.h | 69 +
packaging/dali-toolkit.spec | 110 +
658 files changed, 146680 insertions(+)
create mode 100644 .gitignore
create mode 100644 LICENSE
create mode 100644 automated-tests/.gitignore
create mode 100644 automated-tests/_export_desktop.sh
create mode 100755 automated-tests/_export_env.sh
create mode 100644 automated-tests/_export_sbs.sh
create mode 100755 automated-tests/_export_target_env.sh
create mode 100755 automated-tests/build.sh
create mode 100755 automated-tests/build_out.sh
create mode 100644 automated-tests/coverage.mk
create mode 100755 automated-tests/coverage.sh
create mode 100644 automated-tests/dali-internal-test-suite/master-makefile.mk
create mode 120000 automated-tests/dali-internal-test-suite/tc-gen.sh
create mode 100644 automated-tests/dali-internal-test-suite/text-input/.gitignore
create mode 120000 automated-tests/dali-internal-test-suite/text-input/Makefile
create mode 100644 automated-tests/dali-internal-test-suite/text-input/file.list
create mode 100644 automated-tests/dali-internal-test-suite/text-input/tslist
create mode 100644 automated-tests/dali-internal-test-suite/text-input/utc-Dali-TextInput.cpp
create mode 100644 automated-tests/dali-internal-test-suite/text-view/.gitignore
create mode 120000 automated-tests/dali-internal-test-suite/text-view/Makefile
create mode 100644 automated-tests/dali-internal-test-suite/text-view/file.list
create mode 100644 automated-tests/dali-internal-test-suite/text-view/tslist
create mode 100644 automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-HelperAndDebug.cpp
create mode 100644 automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor-Types.cpp
create mode 100644 automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor.cpp
create mode 100644 automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-Relayout-Utilities.cpp
create mode 100644 automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView.cpp
create mode 100644 automated-tests/dali-internal-test-suite/utc-MODULE-CLASS.cpp.in
create mode 100644 automated-tests/dali-test-suite/.gitignore
create mode 100644 automated-tests/dali-test-suite/alignment/.gitignore
create mode 120000 automated-tests/dali-test-suite/alignment/Makefile
create mode 100644 automated-tests/dali-test-suite/alignment/file.list
create mode 100644 automated-tests/dali-test-suite/alignment/tslist
create mode 100644 automated-tests/dali-test-suite/alignment/utc-Dali-Alignment.cpp
create mode 100644 automated-tests/dali-test-suite/bubble-emitter/.gitignore
create mode 120000 automated-tests/dali-test-suite/bubble-emitter/Makefile
create mode 100644 automated-tests/dali-test-suite/bubble-emitter/file.list
create mode 100644 automated-tests/dali-test-suite/bubble-emitter/tslist
create mode 100644 automated-tests/dali-test-suite/bubble-emitter/utc-Dali-BubbleEmitter.cpp
create mode 100644 automated-tests/dali-test-suite/builder/.gitignore
create mode 120000 automated-tests/dali-test-suite/builder/Makefile
create mode 100644 automated-tests/dali-test-suite/builder/file.list
create mode 100644 automated-tests/dali-test-suite/builder/tslist
create mode 100644 automated-tests/dali-test-suite/builder/utc-Dali-Builder.cpp
create mode 100644 automated-tests/dali-test-suite/builder/utc-Dali-JsonParser.cpp
create mode 100644 automated-tests/dali-test-suite/buttons/.gitignore
create mode 120000 automated-tests/dali-test-suite/buttons/Makefile
create mode 100644 automated-tests/dali-test-suite/buttons/file.list
create mode 100644 automated-tests/dali-test-suite/buttons/tslist
create mode 100644 automated-tests/dali-test-suite/buttons/utc-Dali-Button.cpp
create mode 100644 automated-tests/dali-test-suite/buttons/utc-Dali-CheckBoxButton.cpp
create mode 100644 automated-tests/dali-test-suite/buttons/utc-Dali-PushButton.cpp
create mode 100644 automated-tests/dali-test-suite/cluster/.gitignore
create mode 120000 automated-tests/dali-test-suite/cluster/Makefile
create mode 100644 automated-tests/dali-test-suite/cluster/file.list
create mode 100644 automated-tests/dali-test-suite/cluster/tslist
create mode 100644 automated-tests/dali-test-suite/cluster/utc-Dali-Cluster.cpp
create mode 100644 automated-tests/dali-test-suite/control/.gitignore
create mode 120000 automated-tests/dali-test-suite/control/Makefile
create mode 100644 automated-tests/dali-test-suite/control/dummy-control.h
create mode 100644 automated-tests/dali-test-suite/control/file.list
create mode 100644 automated-tests/dali-test-suite/control/tslist
create mode 100644 automated-tests/dali-test-suite/control/utc-Dali-Control.cpp
create mode 100644 automated-tests/dali-test-suite/control/utc-Dali-ControlImpl.cpp
create mode 100644 automated-tests/dali-test-suite/default-controls/.gitignore
create mode 120000 automated-tests/dali-test-suite/default-controls/Makefile
create mode 100644 automated-tests/dali-test-suite/default-controls/file.list
create mode 100644 automated-tests/dali-test-suite/default-controls/tslist
create mode 100644 automated-tests/dali-test-suite/default-controls/utc-Dali-DefaultControls.cpp
create mode 100644 automated-tests/dali-test-suite/focus-manager/.gitignore
create mode 120000 automated-tests/dali-test-suite/focus-manager/Makefile
create mode 100644 automated-tests/dali-test-suite/focus-manager/file.list
create mode 100644 automated-tests/dali-test-suite/focus-manager/tslist
create mode 100644 automated-tests/dali-test-suite/focus-manager/utc-Dali-FocusManager.cpp
create mode 100644 automated-tests/dali-test-suite/focus-manager/utc-Dali-KeyInputFocusManager.cpp
create mode 100644 automated-tests/dali-test-suite/focus-manager/utc-Dali-KeyboardFocusManager.cpp
create mode 100644 automated-tests/dali-test-suite/item-view/.gitignore
create mode 120000 automated-tests/dali-test-suite/item-view/Makefile
create mode 100644 automated-tests/dali-test-suite/item-view/file.list
create mode 100644 automated-tests/dali-test-suite/item-view/tslist
create mode 100755 automated-tests/dali-test-suite/item-view/utc-Dali-AlbumLayout.cpp
create mode 100644 automated-tests/dali-test-suite/item-view/utc-Dali-DepthLayout.cpp
create mode 100644 automated-tests/dali-test-suite/item-view/utc-Dali-GridLayout.cpp
create mode 100644 automated-tests/dali-test-suite/item-view/utc-Dali-ItemLayout.cpp
create mode 100644 automated-tests/dali-test-suite/item-view/utc-Dali-ItemView.cpp
create mode 100644 automated-tests/dali-test-suite/item-view/utc-Dali-NavigationLayout.cpp
create mode 100644 automated-tests/dali-test-suite/item-view/utc-Dali-RollLayout.cpp
create mode 100644 automated-tests/dali-test-suite/item-view/utc-Dali-SpiralLayout.cpp
create mode 100644 automated-tests/dali-test-suite/master-makefile.mk
create mode 100644 automated-tests/dali-test-suite/navigation-frame/.gitignore
create mode 120000 automated-tests/dali-test-suite/navigation-frame/Makefile
create mode 100644 automated-tests/dali-test-suite/navigation-frame/file.list
create mode 100644 automated-tests/dali-test-suite/navigation-frame/tslist
create mode 100644 automated-tests/dali-test-suite/navigation-frame/utc-Dali-NavigationControl.cpp
create mode 100644 automated-tests/dali-test-suite/navigation-frame/utc-Dali-Page.cpp
create mode 100644 automated-tests/dali-test-suite/page-turn-view/.gitignore
create mode 120000 automated-tests/dali-test-suite/page-turn-view/Makefile
create mode 100644 automated-tests/dali-test-suite/page-turn-view/file.list
create mode 100644 automated-tests/dali-test-suite/page-turn-view/tslist
create mode 100644 automated-tests/dali-test-suite/page-turn-view/utc-Dali-PageTurnView.cpp
create mode 100644 automated-tests/dali-test-suite/popup/.gitignore
create mode 120000 automated-tests/dali-test-suite/popup/Makefile
create mode 100644 automated-tests/dali-test-suite/popup/file.list
create mode 100644 automated-tests/dali-test-suite/popup/tslist
create mode 100644 automated-tests/dali-test-suite/popup/utc-Dali-Popup.cpp
create mode 100644 automated-tests/dali-test-suite/scroll-view/.gitignore
create mode 120000 automated-tests/dali-test-suite/scroll-view/Makefile
create mode 100644 automated-tests/dali-test-suite/scroll-view/file.list
create mode 100644 automated-tests/dali-test-suite/scroll-view/tslist
create mode 100644 automated-tests/dali-test-suite/scroll-view/utc-Dali-ScrollView.cpp
create mode 100644 automated-tests/dali-test-suite/scroll-view/utc-Dali-ScrollViewEffect.cpp
create mode 100644 automated-tests/dali-test-suite/selectors/.gitignore
create mode 120000 automated-tests/dali-test-suite/selectors/Makefile
create mode 100644 automated-tests/dali-test-suite/selectors/file.list
create mode 100644 automated-tests/dali-test-suite/selectors/tslist
create mode 100644 automated-tests/dali-test-suite/selectors/utc-Dali-RotatingSelector.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/.gitignore
create mode 120000 automated-tests/dali-test-suite/shader-effects/Makefile
create mode 100644 automated-tests/dali-test-suite/shader-effects/file.list
create mode 100644 automated-tests/dali-test-suite/shader-effects/tslist
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-BendyEffect.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-BlindEffect.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-BloomView.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-CarouselEffect.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-DisplacementEffect.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-DissolveEffect.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-DistanceFieldEffect.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-GaussianBlurView.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-IrisEffect.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-MaskEffect.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-NinePatchMaskEffect.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-OverlayEffect.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-PageTurnEffect.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-Ripple2DEffect.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-RippleEffect.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-ShadowView.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-ShearEffect.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-SoftButtonEffect.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-SpotEffect.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-SquareDissolveEffect.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-SwirlEffect.cpp
create mode 100644 automated-tests/dali-test-suite/shader-effects/utc-Dali-WaterEffect.cpp
create mode 100644 automated-tests/dali-test-suite/slider/.gitignore
create mode 120000 automated-tests/dali-test-suite/slider/Makefile
create mode 100644 automated-tests/dali-test-suite/slider/file.list
create mode 100644 automated-tests/dali-test-suite/slider/tslist
create mode 100644 automated-tests/dali-test-suite/slider/utc-Dali-Slider.cpp
create mode 100644 automated-tests/dali-test-suite/super-blur-view/.gitignore
create mode 120000 automated-tests/dali-test-suite/super-blur-view/Makefile
create mode 100644 automated-tests/dali-test-suite/super-blur-view/file.list
create mode 100644 automated-tests/dali-test-suite/super-blur-view/tslist
create mode 100644 automated-tests/dali-test-suite/super-blur-view/utc-Dali-SuperBlurView.cpp
create mode 100644 automated-tests/dali-test-suite/table-view/.gitignore
create mode 120000 automated-tests/dali-test-suite/table-view/Makefile
create mode 100644 automated-tests/dali-test-suite/table-view/file.list
create mode 100644 automated-tests/dali-test-suite/table-view/tslist
create mode 100644 automated-tests/dali-test-suite/table-view/utc-Dali-TableView.cpp
create mode 100755 automated-tests/dali-test-suite/tc-gen.sh
create mode 100644 automated-tests/dali-test-suite/text-input/.gitignore
create mode 120000 automated-tests/dali-test-suite/text-input/Makefile
create mode 100644 automated-tests/dali-test-suite/text-input/file.list
create mode 100644 automated-tests/dali-test-suite/text-input/tslist
create mode 100644 automated-tests/dali-test-suite/text-input/utc-Dali-TextInput.cpp
create mode 100644 automated-tests/dali-test-suite/text-view/.gitignore
create mode 120000 automated-tests/dali-test-suite/text-view/Makefile
create mode 100644 automated-tests/dali-test-suite/text-view/file.list
create mode 100644 automated-tests/dali-test-suite/text-view/tslist
create mode 100644 automated-tests/dali-test-suite/text-view/utc-Dali-MarkupProcessor.cpp
create mode 100644 automated-tests/dali-test-suite/text-view/utc-Dali-TextView.cpp
create mode 100644 automated-tests/dali-test-suite/toolbar/.gitignore
create mode 120000 automated-tests/dali-test-suite/toolbar/Makefile
create mode 100644 automated-tests/dali-test-suite/toolbar/file.list
create mode 100644 automated-tests/dali-test-suite/toolbar/tslist
create mode 100644 automated-tests/dali-test-suite/toolbar/utc-Dali-ToolBar.cpp
create mode 100644 automated-tests/dali-test-suite/transition-effects/.gitignore
create mode 120000 automated-tests/dali-test-suite/transition-effects/Makefile
create mode 100644 automated-tests/dali-test-suite/transition-effects/file.list
create mode 100644 automated-tests/dali-test-suite/transition-effects/tslist
create mode 100644 automated-tests/dali-test-suite/transition-effects/utc-Dali-CubeTransitionEffect.cpp
create mode 100644 automated-tests/dali-test-suite/ui-builder/.gitignore
create mode 100644 automated-tests/dali-test-suite/ui-builder/file.list
create mode 100644 automated-tests/dali-test-suite/utc-MODULE-CLASS.cpp.in
create mode 100644 automated-tests/dali-test-suite/view/.gitignore
create mode 120000 automated-tests/dali-test-suite/view/Makefile
create mode 100644 automated-tests/dali-test-suite/view/file.list
create mode 100644 automated-tests/dali-test-suite/view/tslist
create mode 100644 automated-tests/dali-test-suite/view/utc-Dali-View.cpp
create mode 100644 automated-tests/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.h
create mode 100644 automated-tests/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp
create mode 100644 automated-tests/dali-toolkit-test-utils/toolkit-accessibility-manager.h
create mode 100644 automated-tests/dali-toolkit-test-utils/toolkit-adaptor.cpp
create mode 100644 automated-tests/dali-toolkit-test-utils/toolkit-adaptor.h
create mode 100644 automated-tests/dali-toolkit-test-utils/toolkit-application.cpp
create mode 100644 automated-tests/dali-toolkit-test-utils/toolkit-application.h
create mode 100644 automated-tests/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp
create mode 100644 automated-tests/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.h
create mode 100644 automated-tests/dali-toolkit-test-utils/toolkit-orientation.cpp
create mode 100644 automated-tests/dali-toolkit-test-utils/toolkit-orientation.h
create mode 100644 automated-tests/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp
create mode 100644 automated-tests/dali-toolkit-test-utils/toolkit-physical-keyboard.h
create mode 100644 automated-tests/dali-toolkit-test-utils/toolkit-style-monitor.cpp
create mode 100644 automated-tests/dali-toolkit-test-utils/toolkit-style-monitor.h
create mode 100644 automated-tests/dali-toolkit-test-utils/toolkit-test-application.h
create mode 100644 automated-tests/dali-toolkit-test-utils/toolkit-timer.cpp
create mode 100644 automated-tests/dali-toolkit-test-utils/toolkit-timer.h
create mode 100755 automated-tests/debug.sh
create mode 100644 automated-tests/debug_target.sh
create mode 100755 automated-tests/execute.sh
create mode 100755 automated-tests/execute_target.sh
create mode 100644 automated-tests/rules.mk.in
create mode 100755 automated-tests/tbp.pl
create mode 100644 automated-tests/tet_scen
create mode 100644 automated-tests/tetbuild.cfg
create mode 100644 automated-tests/tetclean.cfg
create mode 100644 automated-tests/tetexec.cfg
create mode 100644 build/slp/.gitignore
create mode 100644 build/slp/Makefile.am
create mode 100644 build/slp/README
create mode 100644 build/slp/configure.ac
create mode 100644 build/slp/dali-toolkit.pc.in
create mode 100644 build/slp/dali-toolkit/Makefile.am
create mode 100644 capi/dali-toolkit/public-api/controls/alignment/alignment.h
create mode 100644 capi/dali-toolkit/public-api/controls/bubble-effect/bubble-emitter.h
create mode 100644 capi/dali-toolkit/public-api/controls/buttons/button.h
create mode 100644 capi/dali-toolkit/public-api/controls/buttons/push-button.h
create mode 100644 capi/dali-toolkit/public-api/controls/cluster/cluster-style.h
create mode 100644 capi/dali-toolkit/public-api/controls/control-impl.h
create mode 100644 capi/dali-toolkit/public-api/controls/control.h
create mode 100644 capi/dali-toolkit/public-api/controls/default-controls/push-button-factory.h
create mode 100644 capi/dali-toolkit/public-api/controls/default-controls/solid-color-actor.h
create mode 100644 capi/dali-toolkit/public-api/controls/image-view/masked-image-view.h
create mode 100644 capi/dali-toolkit/public-api/controls/popup/popup.h
create mode 100755 capi/dali-toolkit/public-api/controls/scroll-component/scroll-bar.h
create mode 100644 capi/dali-toolkit/public-api/controls/scroll-component/scroll-component.h
create mode 100644 capi/dali-toolkit/public-api/controls/scrollable/item-view/grid-layout.h
create mode 100644 capi/dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h
create mode 100644 capi/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h
create mode 100644 capi/dali-toolkit/public-api/controls/scrollable/item-view/item-view.h
create mode 100644 capi/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-cube-effect.h
create mode 100644 capi/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-custom-effect.h
create mode 100644 capi/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h
create mode 100644 capi/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-page-spiral-effect.h
create mode 100644 capi/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-slide-effect.h
create mode 100644 capi/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.h
create mode 100644 capi/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h
create mode 100644 capi/dali-toolkit/public-api/controls/scrollable/scrollable.h
create mode 100644 capi/dali-toolkit/public-api/controls/super-blur-view/super-blur-view.h
create mode 100644 capi/dali-toolkit/public-api/controls/text-input/text-input.h
create mode 100644 capi/dali-toolkit/public-api/controls/text-view/text-view.h
create mode 100644 capi/dali-toolkit/public-api/dali-toolkit-capi-internal.h
create mode 100644 capi/dali-toolkit/public-api/enums.h
create mode 100644 capi/dali-toolkit/public-api/factory/localized-control-factory.h
create mode 100644 capi/dali-toolkit/public-api/file.list
create mode 100644 capi/dali-toolkit/public-api/focus-manager/focus-manager.h
create mode 100644 capi/dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h
create mode 100644 capi/dali-toolkit/public-api/markup-processor/markup-processor.h
create mode 100644 capi/dali-toolkit/public-api/shader-effects/dissolve-effect.h
create mode 100644 capi/dali-toolkit/public-api/shader-effects/image-region-effect.h
create mode 100644 capi/dali-toolkit/public-api/shader-effects/iris-effect.h
create mode 100644 capi/dali-toolkit/public-api/shader-effects/mask-effect.h
create mode 100644 capi/dali-toolkit/public-api/shader-effects/nine-patch-mask-effect.h
create mode 100644 capi/dali-toolkit/public-api/shader-effects/page-turn-book-spine-effect.h
create mode 100644 capi/dali-toolkit/public-api/shader-effects/page-turn-effect.h
create mode 100644 capi/dali-toolkit/public-api/shader-effects/ripple-effect.h
create mode 100644 capi/dali-toolkit/public-api/shader-effects/ripple2d-effect.h
create mode 100644 capi/dali-toolkit/public-api/shader-effects/swirl-effect.h
create mode 100644 dali-toolkit.manifest
create mode 100644 dali-toolkit/dali-toolkit.h
create mode 100755 dali-toolkit/images/00_popup_bg.png
create mode 100755 dali-toolkit/images/00_popup_bottom_bg.png
create mode 100755 dali-toolkit/images/00_popup_bubble_bg.png
create mode 100755 dali-toolkit/images/00_popup_bubble_tail_bottom.png
create mode 100755 dali-toolkit/images/00_popup_button_bg.png
create mode 100755 dali-toolkit/images/00_popup_button_pressed.png
create mode 100644 dali-toolkit/images/B16-8_TTS_focus.png
create mode 100644 dali-toolkit/images/copy_paste_icon_clipboard.png
create mode 100644 dali-toolkit/images/copy_paste_icon_copy.png
create mode 100644 dali-toolkit/images/copy_paste_icon_cut.png
create mode 100644 dali-toolkit/images/copy_paste_icon_paste.png
create mode 100644 dali-toolkit/images/copy_paste_icon_select.png
create mode 100644 dali-toolkit/images/copy_paste_icon_select_all.png
create mode 100755 dali-toolkit/images/copypanelLine.png
create mode 100644 dali-toolkit/images/cursor.png
create mode 100644 dali-toolkit/images/cutCopyPastePopup_bg.png
create mode 100644 dali-toolkit/images/file.list
create mode 100755 dali-toolkit/images/insertpoint-icon.png
create mode 100644 dali-toolkit/images/keyboard_focus.png
create mode 100644 dali-toolkit/images/magnifier-image-frame.png
create mode 100644 dali-toolkit/images/magnifier.png
create mode 100644 dali-toolkit/images/overshoot_ripple.png
create mode 100755 dali-toolkit/images/popup_bg.png
create mode 100755 dali-toolkit/images/popup_scroll.png
create mode 100755 dali-toolkit/images/popup_tail_down.png
create mode 100644 dali-toolkit/images/popup_tail_left.png
create mode 100644 dali-toolkit/images/popup_tail_right.png
create mode 100644 dali-toolkit/images/popup_tail_up.png
create mode 100755 dali-toolkit/images/scroll_overshoot.png
create mode 100644 dali-toolkit/images/slider-popup-arrow.png
create mode 100644 dali-toolkit/images/slider-popup.png
create mode 100644 dali-toolkit/images/slider-skin-handle.png
create mode 100644 dali-toolkit/images/slider-skin-progress.png
create mode 100644 dali-toolkit/images/slider-skin.png
create mode 100755 dali-toolkit/images/text-input-selection-handle-left-press.png
create mode 100755 dali-toolkit/images/text-input-selection-handle-left.png
create mode 100755 dali-toolkit/images/text-input-selection-handle-right-press.png
create mode 100755 dali-toolkit/images/text-input-selection-handle-right.png
create mode 100644 dali-toolkit/internal/builder/builder-actor.cpp
create mode 100644 dali-toolkit/internal/builder/builder-animations.cpp
create mode 100644 dali-toolkit/internal/builder/builder-control.cpp
create mode 100644 dali-toolkit/internal/builder/builder-declarations.h
create mode 100644 dali-toolkit/internal/builder/builder-filesystem.h
create mode 100644 dali-toolkit/internal/builder/builder-get-is.inl.h
create mode 100755 dali-toolkit/internal/builder/builder-impl.cpp
create mode 100644 dali-toolkit/internal/builder/builder-impl.h
create mode 100644 dali-toolkit/internal/builder/builder-set-property.cpp
create mode 100644 dali-toolkit/internal/builder/builder-signals.cpp
create mode 100644 dali-toolkit/internal/builder/json-parser-impl.cpp
create mode 100644 dali-toolkit/internal/builder/json-parser-impl.h
create mode 100644 dali-toolkit/internal/builder/json-parser-state.cpp
create mode 100644 dali-toolkit/internal/builder/json-parser-state.h
create mode 100644 dali-toolkit/internal/builder/optional-value.h
create mode 100644 dali-toolkit/internal/builder/tree-node-manipulator.cpp
create mode 100644 dali-toolkit/internal/builder/tree-node-manipulator.h
create mode 100644 dali-toolkit/internal/controls/alignment/alignment-impl.cpp
create mode 100644 dali-toolkit/internal/controls/alignment/alignment-impl.h
create mode 100644 dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp
create mode 100644 dali-toolkit/internal/controls/bloom-view/bloom-view-impl.h
create mode 100644 dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp
create mode 100644 dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.h
create mode 100644 dali-toolkit/internal/controls/buttons/button-impl.cpp
create mode 100644 dali-toolkit/internal/controls/buttons/button-impl.h
create mode 100644 dali-toolkit/internal/controls/buttons/button-painter-impl.h
create mode 100644 dali-toolkit/internal/controls/buttons/check-box-button-default-painter-impl.cpp
create mode 100644 dali-toolkit/internal/controls/buttons/check-box-button-default-painter-impl.h
create mode 100644 dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp
create mode 100644 dali-toolkit/internal/controls/buttons/check-box-button-impl.h
create mode 100644 dali-toolkit/internal/controls/buttons/check-box-button-painter-impl.h
create mode 100644 dali-toolkit/internal/controls/buttons/push-button-default-painter-impl.cpp
create mode 100644 dali-toolkit/internal/controls/buttons/push-button-default-painter-impl.h
create mode 100644 dali-toolkit/internal/controls/buttons/push-button-impl.cpp
create mode 100644 dali-toolkit/internal/controls/buttons/push-button-impl.h
create mode 100644 dali-toolkit/internal/controls/buttons/push-button-painter-impl.h
create mode 100644 dali-toolkit/internal/controls/cluster/cluster-impl.cpp
create mode 100644 dali-toolkit/internal/controls/cluster/cluster-impl.h
create mode 100644 dali-toolkit/internal/controls/cluster/cluster-style-impl.cpp
create mode 100644 dali-toolkit/internal/controls/cluster/cluster-style-impl.h
create mode 100644 dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp
create mode 100644 dali-toolkit/internal/controls/effects-view/effects-view-impl.h
create mode 100644 dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp
create mode 100644 dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.h
create mode 100644 dali-toolkit/internal/controls/image-view/image-view-impl.cpp
create mode 100644 dali-toolkit/internal/controls/image-view/image-view-impl.h
create mode 100644 dali-toolkit/internal/controls/image-view/masked-image-view-impl.cpp
create mode 100644 dali-toolkit/internal/controls/image-view/masked-image-view-impl.h
create mode 100644 dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp
create mode 100644 dali-toolkit/internal/controls/magnifier/magnifier-impl.h
create mode 100644 dali-toolkit/internal/controls/navigation-frame/navigation-bar.cpp
create mode 100644 dali-toolkit/internal/controls/navigation-frame/navigation-bar.h
create mode 100644 dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp
create mode 100644 dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.h
create mode 100644 dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.cpp
create mode 100644 dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.h
create mode 100644 dali-toolkit/internal/controls/navigation-frame/navigation-tool-bar.cpp
create mode 100644 dali-toolkit/internal/controls/navigation-frame/navigation-tool-bar.h
create mode 100644 dali-toolkit/internal/controls/navigation-frame/page-impl.cpp
create mode 100644 dali-toolkit/internal/controls/navigation-frame/page-impl.h
create mode 100644 dali-toolkit/internal/controls/page-turn-view/page-turn-landscape-view-impl.cpp
create mode 100644 dali-toolkit/internal/controls/page-turn-view/page-turn-landscape-view-impl.h
create mode 100644 dali-toolkit/internal/controls/page-turn-view/page-turn-portrait-view-impl.cpp
create mode 100644 dali-toolkit/internal/controls/page-turn-view/page-turn-portrait-view-impl.h
create mode 100644 dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp
create mode 100644 dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.h
create mode 100755 dali-toolkit/internal/controls/popup/popup-impl.cpp
create mode 100755 dali-toolkit/internal/controls/popup/popup-impl.h
create mode 100644 dali-toolkit/internal/controls/popup/popup-style-impl.cpp
create mode 100644 dali-toolkit/internal/controls/popup/popup-style-impl.h
create mode 100644 dali-toolkit/internal/controls/relayout-controller-impl.cpp
create mode 100644 dali-toolkit/internal/controls/relayout-controller-impl.h
create mode 100644 dali-toolkit/internal/controls/relayout-controller.cpp
create mode 100644 dali-toolkit/internal/controls/relayout-controller.h
create mode 100644 dali-toolkit/internal/controls/relayout-helper.cpp
create mode 100644 dali-toolkit/internal/controls/relayout-helper.h
create mode 100755 dali-toolkit/internal/controls/scroll-component/scroll-bar-impl.cpp
create mode 100755 dali-toolkit/internal/controls/scroll-component/scroll-bar-impl.h
create mode 100644 dali-toolkit/internal/controls/scroll-component/scroll-component-impl.cpp
create mode 100644 dali-toolkit/internal/controls/scroll-component/scroll-component-impl.h
create mode 100644 dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp
create mode 100644 dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.cpp
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.h
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.h
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.h
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-custom-effect-impl.cpp
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-custom-effect-impl.h
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-depth-effect-impl.cpp
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-depth-effect-impl.h
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.cpp
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.h
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-helper-functions.cpp
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-helper-functions.h
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.cpp
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.h
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.h
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.h
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-slide-effect-impl.cpp
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-slide-effect-impl.h
create mode 100755 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.cpp
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.h
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-wobble-effect-impl.cpp
create mode 100644 dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-wobble-effect-impl.h
create mode 100644 dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp
create mode 100644 dali-toolkit/internal/controls/scrollable/scrollable-impl.h
create mode 100644 dali-toolkit/internal/controls/selectors/rotating-selector-impl.cpp
create mode 100644 dali-toolkit/internal/controls/selectors/rotating-selector-impl.h
create mode 100644 dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp
create mode 100644 dali-toolkit/internal/controls/shadow-view/shadow-view-impl.h
create mode 100755 dali-toolkit/internal/controls/slider/slider-impl.cpp
create mode 100755 dali-toolkit/internal/controls/slider/slider-impl.h
create mode 100644 dali-toolkit/internal/controls/style-change-processor.cpp
create mode 100644 dali-toolkit/internal/controls/style-change-processor.h
create mode 100644 dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp
create mode 100644 dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.h
create mode 100644 dali-toolkit/internal/controls/table-view/array-2d.h
create mode 100644 dali-toolkit/internal/controls/table-view/table-view-impl.cpp
create mode 100644 dali-toolkit/internal/controls/table-view/table-view-impl.h
create mode 100644 dali-toolkit/internal/controls/text-input/text-input-impl.cpp
create mode 100644 dali-toolkit/internal/controls/text-input/text-input-impl.h
create mode 100644 dali-toolkit/internal/controls/text-input/text-input-popup-impl.cpp
create mode 100644 dali-toolkit/internal/controls/text-input/text-input-popup-impl.h
create mode 100644 dali-toolkit/internal/controls/text-view/relayout-utilities.cpp
create mode 100644 dali-toolkit/internal/controls/text-view/relayout-utilities.h
create mode 100644 dali-toolkit/internal/controls/text-view/split-by-char-policies.cpp
create mode 100644 dali-toolkit/internal/controls/text-view/split-by-char-policies.h
create mode 100644 dali-toolkit/internal/controls/text-view/split-by-new-line-char-policies.cpp
create mode 100644 dali-toolkit/internal/controls/text-view/split-by-new-line-char-policies.h
create mode 100644 dali-toolkit/internal/controls/text-view/split-by-word-policies.cpp
create mode 100644 dali-toolkit/internal/controls/text-view/split-by-word-policies.h
create mode 100644 dali-toolkit/internal/controls/text-view/text-actor-cache.cpp
create mode 100644 dali-toolkit/internal/controls/text-view/text-actor-cache.h
create mode 100644 dali-toolkit/internal/controls/text-view/text-processor.cpp
create mode 100644 dali-toolkit/internal/controls/text-view/text-processor.h
create mode 100644 dali-toolkit/internal/controls/text-view/text-view-character-processor.cpp
create mode 100644 dali-toolkit/internal/controls/text-view/text-view-impl.cpp
create mode 100644 dali-toolkit/internal/controls/text-view/text-view-impl.h
create mode 100644 dali-toolkit/internal/controls/text-view/text-view-line-processor.cpp
create mode 100644 dali-toolkit/internal/controls/text-view/text-view-line-processor.h
create mode 100644 dali-toolkit/internal/controls/text-view/text-view-processor-dbg.cpp
create mode 100644 dali-toolkit/internal/controls/text-view/text-view-processor-dbg.h
create mode 100644 dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.cpp
create mode 100644 dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.h
create mode 100644 dali-toolkit/internal/controls/text-view/text-view-processor-types.h
create mode 100644 dali-toolkit/internal/controls/text-view/text-view-processor.cpp
create mode 100644 dali-toolkit/internal/controls/text-view/text-view-processor.h
create mode 100644 dali-toolkit/internal/controls/text-view/text-view-word-group-processor.cpp
create mode 100644 dali-toolkit/internal/controls/text-view/text-view-word-group-processor.h
create mode 100644 dali-toolkit/internal/controls/text-view/text-view-word-processor.cpp
create mode 100644 dali-toolkit/internal/controls/text-view/text-view-word-processor.h
create mode 100644 dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp
create mode 100644 dali-toolkit/internal/controls/tool-bar/tool-bar-impl.h
create mode 100644 dali-toolkit/internal/controls/view/view-impl.cpp
create mode 100644 dali-toolkit/internal/controls/view/view-impl.h
create mode 100644 dali-toolkit/internal/factory/localized-control-factory-impl.cpp
create mode 100644 dali-toolkit/internal/factory/localized-control-factory-impl.h
create mode 100644 dali-toolkit/internal/file.list
create mode 100644 dali-toolkit/internal/filters/blur-two-pass-filter.cpp
create mode 100644 dali-toolkit/internal/filters/blur-two-pass-filter.h
create mode 100644 dali-toolkit/internal/filters/emboss-filter.cpp
create mode 100644 dali-toolkit/internal/filters/emboss-filter.h
create mode 100644 dali-toolkit/internal/filters/image-filter.cpp
create mode 100644 dali-toolkit/internal/filters/image-filter.h
create mode 100644 dali-toolkit/internal/filters/spread-filter.cpp
create mode 100644 dali-toolkit/internal/filters/spread-filter.h
create mode 100644 dali-toolkit/internal/focus-manager/focus-manager-impl.cpp
create mode 100644 dali-toolkit/internal/focus-manager/focus-manager-impl.h
create mode 100644 dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp
create mode 100644 dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h
create mode 100644 dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.cpp
create mode 100644 dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.h
create mode 100644 dali-toolkit/internal/shader-effects/page-turn-effect-impl.cpp
create mode 100644 dali-toolkit/internal/shader-effects/page-turn-effect-impl.h
create mode 100644 dali-toolkit/internal/shader-effects/water-effect-impl.cpp
create mode 100644 dali-toolkit/internal/shader-effects/water-effect-impl.h
create mode 100644 dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.cpp
create mode 100644 dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.h
create mode 100644 dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp
create mode 100644 dali-toolkit/internal/transition-effects/cube-transition-effect-impl.h
create mode 100644 dali-toolkit/internal/transition-effects/cube-transition-fold-effect-impl.cpp
create mode 100644 dali-toolkit/internal/transition-effects/cube-transition-fold-effect-impl.h
create mode 100644 dali-toolkit/internal/transition-effects/cube-transition-wave-effect-impl.cpp
create mode 100644 dali-toolkit/internal/transition-effects/cube-transition-wave-effect-impl.h
create mode 100644 dali-toolkit/public-api/builder/builder.cpp
create mode 100644 dali-toolkit/public-api/builder/builder.h
create mode 100644 dali-toolkit/public-api/builder/json-parser.cpp
create mode 100644 dali-toolkit/public-api/builder/json-parser.h
create mode 100644 dali-toolkit/public-api/builder/tree-node.cpp
create mode 100644 dali-toolkit/public-api/builder/tree-node.h
create mode 100644 dali-toolkit/public-api/controls/alignment/alignment.cpp
create mode 100644 dali-toolkit/public-api/controls/bloom-view/bloom-view.cpp
create mode 100644 dali-toolkit/public-api/controls/bloom-view/bloom-view.h
create mode 100644 dali-toolkit/public-api/controls/bubble-effect/bubble-emitter.cpp
create mode 100644 dali-toolkit/public-api/controls/buttons/button.cpp
create mode 100644 dali-toolkit/public-api/controls/buttons/check-box-button.cpp
create mode 100644 dali-toolkit/public-api/controls/buttons/check-box-button.h
create mode 100644 dali-toolkit/public-api/controls/buttons/push-button.cpp
create mode 100644 dali-toolkit/public-api/controls/cluster/cluster-style.cpp
create mode 100644 dali-toolkit/public-api/controls/cluster/cluster.cpp
create mode 100644 dali-toolkit/public-api/controls/cluster/cluster.h
create mode 100644 dali-toolkit/public-api/controls/control-impl.cpp
create mode 100644 dali-toolkit/public-api/controls/control.cpp
create mode 100644 dali-toolkit/public-api/controls/default-controls/check-button-factory.cpp
create mode 100644 dali-toolkit/public-api/controls/default-controls/check-button-factory.h
create mode 100644 dali-toolkit/public-api/controls/default-controls/push-button-factory.cpp
create mode 100644 dali-toolkit/public-api/controls/default-controls/solid-color-actor.cpp
create mode 100644 dali-toolkit/public-api/controls/effects-view/effects-view.cpp
create mode 100644 dali-toolkit/public-api/controls/effects-view/effects-view.h
create mode 100644 dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.cpp
create mode 100644 dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h
create mode 100644 dali-toolkit/public-api/controls/image-view/image-view.cpp
create mode 100644 dali-toolkit/public-api/controls/image-view/image-view.h
create mode 100644 dali-toolkit/public-api/controls/image-view/masked-image-view.cpp
create mode 100644 dali-toolkit/public-api/controls/magnifier/magnifier.cpp
create mode 100644 dali-toolkit/public-api/controls/magnifier/magnifier.h
create mode 100644 dali-toolkit/public-api/controls/navigation-frame/navigation-bar-style.h
create mode 100644 dali-toolkit/public-api/controls/navigation-frame/navigation-control.cpp
create mode 100644 dali-toolkit/public-api/controls/navigation-frame/navigation-control.h
create mode 100644 dali-toolkit/public-api/controls/navigation-frame/page.cpp
create mode 100644 dali-toolkit/public-api/controls/navigation-frame/page.h
create mode 100644 dali-toolkit/public-api/controls/page-turn-view/page-factory.cpp
create mode 100644 dali-toolkit/public-api/controls/page-turn-view/page-factory.h
create mode 100644 dali-toolkit/public-api/controls/page-turn-view/page-turn-landscape-view.cpp
create mode 100644 dali-toolkit/public-api/controls/page-turn-view/page-turn-landscape-view.h
create mode 100644 dali-toolkit/public-api/controls/page-turn-view/page-turn-portrait-view.cpp
create mode 100644 dali-toolkit/public-api/controls/page-turn-view/page-turn-portrait-view.h
create mode 100644 dali-toolkit/public-api/controls/page-turn-view/page-turn-view.cpp
create mode 100644 dali-toolkit/public-api/controls/page-turn-view/page-turn-view.h
create mode 100644 dali-toolkit/public-api/controls/popup/popup.cpp
create mode 100755 dali-toolkit/public-api/controls/scroll-component/scroll-bar.cpp
create mode 100644 dali-toolkit/public-api/controls/scroll-component/scroll-component.cpp
create mode 100755 dali-toolkit/public-api/controls/scrollable/item-view/album-layout.cpp
create mode 100755 dali-toolkit/public-api/controls/scrollable/item-view/album-layout.h
create mode 100644 dali-toolkit/public-api/controls/scrollable/item-view/depth-layout.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/item-view/depth-layout.h
create mode 100644 dali-toolkit/public-api/controls/scrollable/item-view/grid-layout.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/item-view/item-factory.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/item-view/item-layout.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/item-view/item-view.cpp
create mode 100755 dali-toolkit/public-api/controls/scrollable/item-view/navigation-layout.cpp
create mode 100755 dali-toolkit/public-api/controls/scrollable/item-view/navigation-layout.h
create mode 100644 dali-toolkit/public-api/controls/scrollable/item-view/roll-layout.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/item-view/roll-layout.h
create mode 100644 dali-toolkit/public-api/controls/scrollable/item-view/spiral-layout.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/item-view/spiral-layout.h
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-carousel-effect.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-carousel-effect.h
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-constraints.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-constraints.h
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-cube-effect.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-custom-effect.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-depth-effect.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-depth-effect.h
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-page-carousel-effect.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-page-carousel-effect.h
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-page-cube-effect.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-page-cube-effect.h
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-page-spiral-effect.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-slide-effect.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-wobble-effect.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-wobble-effect.h
create mode 100644 dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp
create mode 100644 dali-toolkit/public-api/controls/scrollable/scrollable.cpp
create mode 100644 dali-toolkit/public-api/controls/selectors/rotating-selector.cpp
create mode 100644 dali-toolkit/public-api/controls/selectors/rotating-selector.h
create mode 100644 dali-toolkit/public-api/controls/shadow-view/shadow-view.cpp
create mode 100644 dali-toolkit/public-api/controls/shadow-view/shadow-view.h
create mode 100644 dali-toolkit/public-api/controls/slider/slider.cpp
create mode 100644 dali-toolkit/public-api/controls/slider/slider.h
create mode 100644 dali-toolkit/public-api/controls/super-blur-view/super-blur-view.cpp
create mode 100644 dali-toolkit/public-api/controls/table-view/table-view.cpp
create mode 100644 dali-toolkit/public-api/controls/table-view/table-view.h
create mode 100644 dali-toolkit/public-api/controls/text-input/text-input.cpp
create mode 100644 dali-toolkit/public-api/controls/text-view/text-view.cpp
create mode 100644 dali-toolkit/public-api/controls/tool-bar/tool-bar.cpp
create mode 100644 dali-toolkit/public-api/controls/tool-bar/tool-bar.h
create mode 100644 dali-toolkit/public-api/controls/view/view.cpp
create mode 100644 dali-toolkit/public-api/controls/view/view.h
create mode 100644 dali-toolkit/public-api/enums.cpp
create mode 100644 dali-toolkit/public-api/factory/localized-control-factory.cpp
create mode 100755 dali-toolkit/public-api/file.list
create mode 100644 dali-toolkit/public-api/focus-manager/focus-manager.cpp
create mode 100644 dali-toolkit/public-api/focus-manager/keyboard-focus-manager.cpp
create mode 100644 dali-toolkit/public-api/focus-manager/keyinput-focus-manager.cpp
create mode 100644 dali-toolkit/public-api/focus-manager/keyinput-focus-manager.h
create mode 100644 dali-toolkit/public-api/markup-processor/markup-processor.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/alpha-discard-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/alpha-discard-effect.h
create mode 100644 dali-toolkit/public-api/shader-effects/bendy-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/bendy-effect.h
create mode 100644 dali-toolkit/public-api/shader-effects/blind-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/blind-effect.h
create mode 100644 dali-toolkit/public-api/shader-effects/bubble-effect/bubble-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/bubble-effect/bubble-effect.h
create mode 100644 dali-toolkit/public-api/shader-effects/bubble-effect/color-adjuster.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/bubble-effect/color-adjuster.h
create mode 100644 dali-toolkit/public-api/shader-effects/carousel-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/carousel-effect.h
create mode 100644 dali-toolkit/public-api/shader-effects/displacement-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/displacement-effect.h
create mode 100644 dali-toolkit/public-api/shader-effects/dissolve-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/dissolve-local-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/dissolve-local-effect.h
create mode 100644 dali-toolkit/public-api/shader-effects/distance-field-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/distance-field-effect.h
create mode 100644 dali-toolkit/public-api/shader-effects/image-region-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/iris-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/mask-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/mirror-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/mirror-effect.h
create mode 100644 dali-toolkit/public-api/shader-effects/motion-blur-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/motion-blur-effect.h
create mode 100644 dali-toolkit/public-api/shader-effects/motion-stretch-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/motion-stretch-effect.h
create mode 100644 dali-toolkit/public-api/shader-effects/nine-patch-mask-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/overlay-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/overlay-effect.h
create mode 100644 dali-toolkit/public-api/shader-effects/page-turn-book-spine-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/page-turn-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/ripple-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/ripple2d-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/shear-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/shear-effect.h
create mode 100644 dali-toolkit/public-api/shader-effects/soft-button-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/soft-button-effect.h
create mode 100644 dali-toolkit/public-api/shader-effects/spot-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/spot-effect.h
create mode 100644 dali-toolkit/public-api/shader-effects/square-dissolve-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/square-dissolve-effect.h
create mode 100644 dali-toolkit/public-api/shader-effects/swirl-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/water-effect.cpp
create mode 100644 dali-toolkit/public-api/shader-effects/water-effect.h
create mode 100644 dali-toolkit/public-api/transition-effects/cube-transition-cross-effect.cpp
create mode 100644 dali-toolkit/public-api/transition-effects/cube-transition-cross-effect.h
create mode 100644 dali-toolkit/public-api/transition-effects/cube-transition-effect.cpp
create mode 100644 dali-toolkit/public-api/transition-effects/cube-transition-effect.h
create mode 100644 dali-toolkit/public-api/transition-effects/cube-transition-fold-effect.cpp
create mode 100644 dali-toolkit/public-api/transition-effects/cube-transition-fold-effect.h
create mode 100644 dali-toolkit/public-api/transition-effects/cube-transition-wave-effect.cpp
create mode 100644 dali-toolkit/public-api/transition-effects/cube-transition-wave-effect.h
create mode 100644 packaging/dali-toolkit.spec
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..8865c0b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,56 @@
+.cproject
+.project
+.settings
+.directory
+Makefile.in
+Makefile
+*~
+*.o
+*.o.d
+*.pc
+*.lo
+*.loT
+*.la
+*.so
+*.orig
+*.odt
+*.fodt
+*.test
+*.example
+*.a
+*.apk
+*.ap_
+*.class
+*.classpath
+*.dex
+*.gcno
+*.gcda
+*.gcov
+.deps
+.libs
+*.swp
+/docs/generated/*
+/build/slp/doc
+/build/slp/.cov
+/build/desktop
+/debian/build-stamp
+/debian/config.status
+/debian/libdali-toolkit-dbg.debhelper.log
+/debian/libdali-toolkit-dbg
+/debian/libdali-toolkit-dev.debhelper.log
+/debian/libdali-toolkit-dev
+/debian/libdali-toolkit.debhelper.log
+/debian/libdali-toolkit.postinst.debhelper
+/debian/libdali-toolkit.postrm.debhelper
+/debian/libdali-toolkit.substvars
+/debian/libdali-toolkit
+/debian/tmp
+/debian/files
+/debian/libdali-toolkit-dbg.substvars
+/debian/libdali-toolkit-dev.substvars
+/debian/libdali-nsplugin.debhelper.log
+/debian/libdali-nsplugin.postinst.debhelper
+/debian/libdali-nsplugin.postrm.debhelper
+/debian/libdali-nsplugin.substvars
+/debian/libdali-nsplugin
+/packaging/home*
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..87ed7f1
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,205 @@
+Flora License
+
+Version 1.1, April, 2013
+
+http://floralicense.org/license/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction,
+and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by
+the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and
+all other entities that control, are controlled by, or are
+under common control with that entity. For the purposes of
+this definition, "control" means (i) the power, direct or indirect,
+to cause the direction or management of such entity,
+whether by contract or otherwise, or (ii) ownership of fifty percent (50%)
+or more of the outstanding shares, or (iii) beneficial ownership of
+such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity
+exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation source,
+and configuration files.
+
+"Object" form shall mean any form resulting from mechanical
+transformation or translation of a Source form, including but
+not limited to compiled object code, generated documentation,
+and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form,
+made available under the License, as indicated by a copyright notice
+that is included in or attached to the work (an example is provided
+in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form,
+that is based on (or derived from) the Work and for which the editorial
+revisions, annotations, elaborations, or other modifications represent,
+as a whole, an original work of authorship. For the purposes of this License,
+Derivative Works shall not include works that remain separable from,
+or merely link (or bind by name) to the interfaces of, the Work and
+Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original
+version of the Work and any modifications or additions to that Work or
+Derivative Works thereof, that is intentionally submitted to Licensor
+for inclusion in the Work by the copyright owner or by an individual or
+Legal Entity authorized to submit on behalf of the copyright owner.
+For the purposes of this definition, "submitted" means any form of
+electronic, verbal, or written communication sent to the Licensor or
+its representatives, including but not limited to communication on
+electronic mailing lists, source code control systems, and issue
+tracking systems that are managed by, or on behalf of, the Licensor
+for the purpose of discussing and improving the Work, but excluding
+communication that is conspicuously marked or otherwise designated
+in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity
+on behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.
+
+"Tizen Certified Platform" shall mean a software platform that complies
+with the standards set forth in the Tizen Compliance Specification
+and passes the Tizen Compliance Tests as defined from time to time
+by the Tizen Technical Steering Group and certified by the Tizen
+Association or its designated agent.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the
+Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except as stated in this section) patent license to make, have made,
+use, offer to sell, sell, import, and otherwise transfer the Work
+solely as incorporated into a Tizen Certified Platform, where such
+license applies only to those patent claims licensable by such
+Contributor that are necessarily infringed by their Contribution(s)
+alone or by combination of their Contribution(s) with the Work solely
+as incorporated into a Tizen Certified Platform to which such
+Contribution(s) was submitted. If You institute patent litigation
+against any entity (including a cross-claim or counterclaim
+in a lawsuit) alleging that the Work or a Contribution incorporated
+within the Work constitutes direct or contributory patent infringement,
+then any patent licenses granted to You under this License for that
+Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+Work or Derivative Works thereof pursuant to the copyright license
+above, in any medium, with or without modifications, and in Source or
+Object form, provided that You meet the following conditions:
+
+ 1. You must give any other recipients of the Work or Derivative Works
+ a copy of this License; and
+ 2. You must cause any modified files to carry prominent notices stating
+ that You changed the files; and
+ 3. You must retain, in the Source form of any Derivative Works that
+ You distribute, all copyright, patent, trademark, and attribution
+ notices from the Source form of the Work, excluding those notices
+ that do not pertain to any part of the Derivative Works; and
+ 4. If the Work includes a "NOTICE" text file as part of its distribution,
+ then any Derivative Works that You distribute must include a readable
+ copy of the attribution notices contained within such NOTICE file,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works, in at least one of the following places:
+ within a NOTICE text file distributed as part of the Derivative Works;
+ within the Source form or documentation, if provided along with the
+ Derivative Works; or, within a display generated by the Derivative Works,
+ if and wherever such third-party notices normally appear.
+ The contents of the NOTICE file are for informational purposes only
+ and do not modify the License. You may add Your own attribution notices
+ within Derivative Works that You distribute, alongside or as an addendum
+ to the NOTICE text from the Work, provided that such additional attribution
+ notices cannot be construed as modifying the License. You may add Your own
+ copyright statement to Your modifications and may provide additional or
+ different license terms and conditions for use, reproduction, or
+ distribution of Your modifications, or for any such Derivative Works
+ as a whole, provided Your use, reproduction, and distribution of
+ the Work otherwise complies with the conditions stated in this License
+ and your own copyright statement or terms and conditions do not conflict
+ the conditions stated in the License including section 3.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+any Contribution intentionally submitted for inclusion in the Work
+by You to the Licensor shall be under the terms and conditions of
+this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify
+the terms of any separate license agreement you may have executed
+with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+names, trademarks, service marks, or product names of the Licensor,
+except as required for reasonable and customary use in describing the
+origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+agreed to in writing, Licensor provides the Work (and each
+Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied, including, without limitation, any warranties or conditions
+of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+PARTICULAR PURPOSE. You are solely responsible for determining the
+appropriateness of using or redistributing the Work and assume any
+risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+whether in tort (including negligence), contract, or otherwise,
+unless required by applicable law (such as deliberate and grossly
+negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special,
+incidental, or consequential damages of any character arising as a
+result of this License or out of the use or inability to use the
+Work (including but not limited to damages for loss of goodwill,
+work stoppage, computer failure or malfunction, or any and all
+other commercial damages or losses), even if such Contributor
+has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+the Work or Derivative Works thereof, You may choose to offer,
+and charge a fee for, acceptance of support, warranty, indemnity,
+or other liability obligations and/or rights consistent with this
+License. However, in accepting such obligations, You may act only
+on Your own behalf and on Your sole responsibility, not on behalf
+of any other Contributor, and only if You agree to indemnify,
+defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason
+of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Flora License to your work
+
+To apply the Flora License to your work, attach the following
+boilerplate notice, with the fields enclosed by brackets "[]"
+replaced with your own identifying information. (Don't include
+the brackets!) The text should be enclosed in the appropriate
+comment syntax for the file format. We also recommend that a
+file or class name and description of purpose be included on the
+same "printed page" as the copyright notice for easier
+identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Flora License, Version 1.1 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://floralicense.org/license/
+
+ 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.
diff --git a/automated-tests/.gitignore b/automated-tests/.gitignore
new file mode 100644
index 0000000..807a3b2
--- /dev/null
+++ b/automated-tests/.gitignore
@@ -0,0 +1,7 @@
+!Makefile
+tet_captured
+results-desktop
+results-target
+results
+rules.mk
+dali.info
diff --git a/automated-tests/_export_desktop.sh b/automated-tests/_export_desktop.sh
new file mode 100644
index 0000000..eeea3ed
--- /dev/null
+++ b/automated-tests/_export_desktop.sh
@@ -0,0 +1,33 @@
+export ARCH=desktop
+
+
+if [ -z "$DESKTOP_PREFIX" ] ; then
+ if [ -z "$PREFIX" ] ; then
+ echo "####################################################"
+ echo "# DESKTOP_PREFIX is not set. Recommend running #"
+ echo "# dali_env -s to create setenv script #"
+ echo "####################################################"
+ else
+ echo "####################################################"
+ echo "# DESKTOP_PREFIX is not set. Using PREFIX instead. #"
+ echo "# #"
+ echo "# Warning, PREFIX is deprecated, please use #"
+ echo "# dali_env to set up your environment. #"
+ echo "####################################################"
+ export DESKTOP_PREFIX=$PREFIX
+ fi
+fi
+
+export TET_INSTALL_PATH=$HOME/Packages/tetware-desktop # Your tetware root path
+export PATH=$TET_INSTALL_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_INSTALL_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_INSTALL_PATH
+export DALI_IMAGE_DIR=$DESKTOP_PREFIX/share/app.dalimenu/images/
+export DALI_MODEL_DIR=$DESKTOP_PREFIX/share/app.dalimenu/models/
+export DALI_STYLE_DIR=$DESKTOP_PREFIX/share/themes/dali/
+
+set $(pwd)
+export TET_SUITE_ROOT=$1
+
+set $(date +%s)
+FILE_NAME_EXTENSION=$1
diff --git a/automated-tests/_export_env.sh b/automated-tests/_export_env.sh
new file mode 100755
index 0000000..4e2dc90
--- /dev/null
+++ b/automated-tests/_export_env.sh
@@ -0,0 +1,17 @@
+export ARCH=target
+
+export TET_INSTALL_PATH=/scratchbox/TETware # tetware root path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export DALI_IMAGE_DIR=/opt/share/app.dalimenu/images/
+export DALI_MODEL_DIR=/opt/share/app.dalimenu/models/
+export DALI_STYLE_DIR=/opt/share/themes/dali/
+
+export TET_ROOT=$TET_TARGET_PATH
+
+set $(pwd)
+export TET_SUITE_ROOT=$1
+
+set $(date +%s)
+FILE_NAME_EXTENSION=$1
diff --git a/automated-tests/_export_sbs.sh b/automated-tests/_export_sbs.sh
new file mode 100644
index 0000000..bc5a4af
--- /dev/null
+++ b/automated-tests/_export_sbs.sh
@@ -0,0 +1,17 @@
+export ARCH=target
+
+export TET_INSTALL_PATH=$HOME/git/TETware # tetware root path
+export TET_TARGET_PATH=$TET_INSTALL_PATH
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export DALI_IMAGE_DIR=/opt/share/app.dalimenu/images/
+export DALI_MODEL_DIR=/opt/share/app.dalimenu/models/
+export DALI_STYLE_DIR=/opt/share/themes/dali/
+
+export TET_ROOT=$TET_TARGET_PATH
+
+set $(pwd)
+export TET_SUITE_ROOT=$1
+
+set $(date +%s)
+FILE_NAME_EXTENSION=$1
diff --git a/automated-tests/_export_target_env.sh b/automated-tests/_export_target_env.sh
new file mode 100755
index 0000000..4c1b135
--- /dev/null
+++ b/automated-tests/_export_target_env.sh
@@ -0,0 +1,17 @@
+export ARCH=target
+
+export TET_INSTALL_PATH=/mnt/nfs/git/TETware # path to mount
+export TET_TARGET_PATH=$TET_INSTALL_PATH
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export DALI_IMAGE_DIR=/opt/share/app.dalimenu/images/
+export DALI_MODEL_DIR=/opt/share/app.dalimenu/models/
+export DALI_STYLE_DIR=/opt/share/themes/dali/
+
+export TET_ROOT=$TET_TARGET_PATH
+
+set $(pwd)
+export TET_SUITE_ROOT=$1
+
+set $(date +%s)
+FILE_NAME_EXTENSION=$1
diff --git a/automated-tests/build.sh b/automated-tests/build.sh
new file mode 100755
index 0000000..d857de3
--- /dev/null
+++ b/automated-tests/build.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+TEMP=`getopt -o 2vds: --long 2,verbose,desktop,scenario: \
+ -n 'build_out.sh' -- "$@"`
+
+if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
+
+# Note the quotes around `$TEMP': they are essential!
+eval set -- "$TEMP"
+
+scenario=all
+opt_verbose=0
+opt_env=scratchbox
+
+while true ; do
+ case "$1" in
+ -d|--desktop) opt_env=desktop ; shift ;;
+ -s|--scenario) scenario="$2" ; shift 2 ;;
+ -v|--verbose) opt_verbose=1 ; shift ;;
+ -2|--2) opt_env=sbs ; shift ;;
+ --) shift ; break ;;
+ *) echo "Internal error!" ; exit 1 ;;
+ esac
+done
+
+
+case "$opt_env" in
+ desktop)
+ . _export_desktop.sh
+ cat < coverage.mk
+LDFLAGS += --coverage
+EOF
+ ;;
+ scratchbox)
+ . _export_env.sh
+ cat < coverage.mk
+LDFLAGS +=
+EOF
+ ;;
+ sbs)
+ . _export_sbs.sh
+ cat < coverage.mk
+LDFLAGS +=
+EOF
+ ;;
+esac
+
+
+echo PATH=$PATH
+echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH
+echo TET_ROOT=$TET_ROOT
+echo TET_SUITE_ROOT=$TET_SUITE_ROOT
+echo ARCH=$ARCH
+
+RESULT_DIR=results-$ARCH
+HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
+
+# Faster cleanup.
+find . -name Makefile -execdir make -f {} clean \;
+
+mkdir -p $RESULT_DIR
+if [ $opt_verbose -eq 1 ] ; then
+ tcc -b -j - ./ $scenario | tee $JOURNAL_RESULT
+else
+ tcc -b -j $JOURNAL_RESULT -p ./ $scenario
+fi
+./tbp.pl $JOURNAL_RESULT
+
+
diff --git a/automated-tests/build_out.sh b/automated-tests/build_out.sh
new file mode 100755
index 0000000..efb93a1
--- /dev/null
+++ b/automated-tests/build_out.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+./build.sh -v $*
diff --git a/automated-tests/coverage.mk b/automated-tests/coverage.mk
new file mode 100644
index 0000000..5012fd4
--- /dev/null
+++ b/automated-tests/coverage.mk
@@ -0,0 +1 @@
+LDFLAGS += --coverage
diff --git a/automated-tests/coverage.sh b/automated-tests/coverage.sh
new file mode 100755
index 0000000..98798db
--- /dev/null
+++ b/automated-tests/coverage.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+( cd ../build/slp ; make cov_data )
+
+for i in `find . -name Makefile` ; do
+ (
+ cd $(dirname $i)
+ echo `pwd`
+ covs=( `ls *.gcda 2>/dev/null` )
+ if [[ $? -eq 0 ]]
+ then
+ make coverage
+ fi
+ )
+done
+
+(
+ cd .. ;
+ genhtml -o build/slp/doc/coverage `find . -name dali.info`
+)
+
+
diff --git a/automated-tests/dali-internal-test-suite/master-makefile.mk b/automated-tests/dali-internal-test-suite/master-makefile.mk
new file mode 100644
index 0000000..a8e9921
--- /dev/null
+++ b/automated-tests/dali-internal-test-suite/master-makefile.mk
@@ -0,0 +1,53 @@
+#
+# Copyright (c) 2014 Samsung Electronics Co., Ltd.
+#
+# Licensed under the Flora License, Version 1.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://floralicense.org/license/
+#
+# 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.
+#
+
+CC = g++
+
+TARGETS =
+include file.list
+
+PKGS = dali-core dali dali-toolkit dali-test-suite-utils
+include ../../rules.mk
+include ../../coverage.mk
+
+TOOLKIT_TEST_UTILS_DIR=../../dali-toolkit-test-utils/
+
+CXXFLAGS += -I$(TOOLKIT_TEST_UTILS_DIR)
+
+TOOLKIT_TEST_UTILS_SRC_FILES = \
+ $(TOOLKIT_TEST_UTILS_DIR)/toolkit-application.cpp \
+ $(TOOLKIT_TEST_UTILS_DIR)/toolkit-adaptor.cpp \
+ $(TOOLKIT_TEST_UTILS_DIR)/toolkit-clipboard-event-notifier.cpp \
+ $(TOOLKIT_TEST_UTILS_DIR)/toolkit-accessibility-manager.cpp \
+ $(TOOLKIT_TEST_UTILS_DIR)/toolkit-physical-keyboard.cpp \
+ $(TOOLKIT_TEST_UTILS_DIR)/toolkit-style-monitor.cpp \
+ $(TOOLKIT_TEST_UTILS_DIR)/toolkit-timer.cpp \
+ $(TOOLKIT_TEST_UTILS_DIR)/toolkit-orientation.cpp
+
+all: $(TARGETS)
+
+%: %.cpp $(TOOLKIT_TEST_UTILS_SRC_FILES)
+ $(CC) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
+
+clean:
+ @rm -f $(notdir $(TARGETS))
+ @rm -f tet_captured
+ @rm -f *~
+ @rm -f *.gcda *.gcno
+
+coverage:
+ @lcov --directory . -c -o dali.info
+ @lcov --remove dali.info "*boost*" "/usr/include/*" "*/automated-tests/*" -o dali.info
diff --git a/automated-tests/dali-internal-test-suite/tc-gen.sh b/automated-tests/dali-internal-test-suite/tc-gen.sh
new file mode 120000
index 0000000..b8e6201
--- /dev/null
+++ b/automated-tests/dali-internal-test-suite/tc-gen.sh
@@ -0,0 +1 @@
+../dali-test-suite/tc-gen.sh
\ No newline at end of file
diff --git a/automated-tests/dali-internal-test-suite/text-input/.gitignore b/automated-tests/dali-internal-test-suite/text-input/.gitignore
new file mode 100644
index 0000000..0f77dca
--- /dev/null
+++ b/automated-tests/dali-internal-test-suite/text-input/.gitignore
@@ -0,0 +1 @@
+utc-Dali-TextInput
diff --git a/automated-tests/dali-internal-test-suite/text-input/Makefile b/automated-tests/dali-internal-test-suite/text-input/Makefile
new file mode 120000
index 0000000..c88d5a7
--- /dev/null
+++ b/automated-tests/dali-internal-test-suite/text-input/Makefile
@@ -0,0 +1 @@
+../master-makefile.mk
\ No newline at end of file
diff --git a/automated-tests/dali-internal-test-suite/text-input/file.list b/automated-tests/dali-internal-test-suite/text-input/file.list
new file mode 100644
index 0000000..1e6d688
--- /dev/null
+++ b/automated-tests/dali-internal-test-suite/text-input/file.list
@@ -0,0 +1,2 @@
+TARGETS += \
+ utc-Dali-TextInput \
diff --git a/automated-tests/dali-internal-test-suite/text-input/tslist b/automated-tests/dali-internal-test-suite/text-input/tslist
new file mode 100644
index 0000000..7bbabc6
--- /dev/null
+++ b/automated-tests/dali-internal-test-suite/text-input/tslist
@@ -0,0 +1 @@
+/dali-internal-test-suite/text-input/utc-Dali-TextInput
diff --git a/automated-tests/dali-internal-test-suite/text-input/utc-Dali-TextInput.cpp b/automated-tests/dali-internal-test-suite/text-input/utc-Dali-TextInput.cpp
new file mode 100644
index 0000000..6315dde
--- /dev/null
+++ b/automated-tests/dali-internal-test-suite/text-input/utc-Dali-TextInput.cpp
@@ -0,0 +1,145 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+
+#include
+
+#include
+
+// Internal includes
+#include
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( UtcDaliInternalTextInputTextSelection, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliTextInputSetGetExceedEnabled, POSITIVE_TC_IDX );
+// TEST_FUNCTION( UtcDaliTextInputMethod02, NEGATIVE_TC_IDX );
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+
+/**
+ * Test: Selected is replaced by new input text.
+ **/
+static void UtcDaliInternalTextInputTextSelection()
+{
+ const char* testChar = "v";
+
+ ToolkitTestApplication application;
+
+ Dali::Integration::Core& core ( application.GetCore() );
+
+ tet_infoline("Testing Text Selection with replace.");
+
+ Toolkit::TextInput textInput = Toolkit::TextInput::New();
+
+ DALI_TEST_CHECK(textInput);
+
+ Stage::GetCurrent().Add(textInput);
+
+ textInput.SetInitialText("Test String");
+
+ std::string initialText = textInput.GetText();
+
+ tet_printf("Set Initial text: %s\n", initialText.c_str() );
+
+ textInput.SetKeyInputFocus();
+
+ GetImpl(textInput).SelectText(0,11);
+
+ tet_printf("Select all of Initial text\n");
+
+ Integration::KeyEvent event(testChar, testChar, 0, 0, 0, Integration::KeyEvent::Down );
+
+ core.SendEvent( event );
+
+ tet_printf("Simulate pressing of a key: %s\n", testChar );
+
+ std::string newText = textInput.GetText();
+
+ tet_printf("Check current text (%s) is the new text \n", newText.c_str() );
+
+ DALI_TEST_EQUALS("v",textInput.GetText(), TEST_LOCATION);
+}
+
+static void UtcDaliTextInputSetGetExceedEnabled()
+{
+ tet_infoline("UtcDaliTextInputSetGetExceedEnabled: ");
+
+ ToolkitTestApplication application;
+
+ Toolkit::TextInput textInput = Toolkit::TextInput::New();
+ textInput.SetMultilinePolicy( Toolkit::TextView::SplitByWord );
+ textInput.SetWidthExceedPolicy( Toolkit::TextView::Split );
+ textInput.SetHeightExceedPolicy( Toolkit::TextView::Original );
+
+ DALI_TEST_CHECK( textInput.GetExceedEnabled() );
+
+ Toolkit::Internal::TextInput& textInputImpl = static_cast( textInput.GetImplementation() );
+
+ textInput.SetSize( 50.f, 50.f );
+ textInput.SetExceedEnabled( false );
+
+ DALI_TEST_CHECK( !textInput.GetExceedEnabled() );
+
+
+ textInputImpl.InsertAt( Text("He"), 0 );
+
+ DALI_TEST_EQUALS("He",textInput.GetText(), TEST_LOCATION);
+
+ textInputImpl.InsertAt( Text("llo"), 2 );
+
+ DALI_TEST_EQUALS("Hello",textInput.GetText(), TEST_LOCATION);
+
+ textInputImpl.InsertAt( Text(" world! hello world hello world hello world"), 5 ); // Doesn't fit so is not added.
+
+ DALI_TEST_EQUALS("Hello",textInput.GetText(), TEST_LOCATION);
+}
diff --git a/automated-tests/dali-internal-test-suite/text-view/.gitignore b/automated-tests/dali-internal-test-suite/text-view/.gitignore
new file mode 100644
index 0000000..881389b
--- /dev/null
+++ b/automated-tests/dali-internal-test-suite/text-view/.gitignore
@@ -0,0 +1,5 @@
+utc-Dali-TextView
+utc-Dali-TextView-HelperAndDebug
+utc-Dali-TextView-Processor
+utc-Dali-TextView-Processor-Types
+utc-Dali-TextView-Relayout-Utilities
diff --git a/automated-tests/dali-internal-test-suite/text-view/Makefile b/automated-tests/dali-internal-test-suite/text-view/Makefile
new file mode 120000
index 0000000..c88d5a7
--- /dev/null
+++ b/automated-tests/dali-internal-test-suite/text-view/Makefile
@@ -0,0 +1 @@
+../master-makefile.mk
\ No newline at end of file
diff --git a/automated-tests/dali-internal-test-suite/text-view/file.list b/automated-tests/dali-internal-test-suite/text-view/file.list
new file mode 100644
index 0000000..7e75352
--- /dev/null
+++ b/automated-tests/dali-internal-test-suite/text-view/file.list
@@ -0,0 +1,6 @@
+TARGETS += \
+ utc-Dali-TextView \
+ utc-Dali-TextView-HelperAndDebug \
+ utc-Dali-TextView-Processor \
+ utc-Dali-TextView-Processor-Types \
+ utc-Dali-TextView-Relayout-Utilities \
\ No newline at end of file
diff --git a/automated-tests/dali-internal-test-suite/text-view/tslist b/automated-tests/dali-internal-test-suite/text-view/tslist
new file mode 100644
index 0000000..5ee4f51
--- /dev/null
+++ b/automated-tests/dali-internal-test-suite/text-view/tslist
@@ -0,0 +1,5 @@
+/dali-internal-test-suite/text-view/utc-Dali-TextView
+/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor
+/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor-Types
+/dali-internal-test-suite/text-view/utc-Dali-TextView-Relayout-Utilities
+/dali-internal-test-suite/text-view/utc-Dali-TextView-HelperAndDebug
diff --git a/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-HelperAndDebug.cpp b/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-HelperAndDebug.cpp
new file mode 100644
index 0000000..494039b
--- /dev/null
+++ b/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-HelperAndDebug.cpp
@@ -0,0 +1,304 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+
+#include
+
+// Internal headers are allowed here
+#include
+#include
+#include
+#include
+#include
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+using namespace Dali::Toolkit::Internal;
+
+namespace
+{
+// Data structures used to create an 'experiment' in TET cases
+
+const Toolkit::Internal::TextView::LayoutParameters DEFAULT_LAYOUT_PARAMETERS;
+const Toolkit::Internal::TextView::VisualParameters DEFAULT_VISUAL_PARAMETERS;
+
+struct GetIndicesFromGlobalCharacterIndexTest
+{
+ std::string description;
+ std::string input;
+ std::size_t position;
+ std::size_t lineIndex;
+ std::size_t groupIndex;
+ std::size_t wordIndex;
+ std::size_t characterIndex;
+};
+
+/**
+ * Gets the line, group, word, and character indices for a given text and a given position and checks the results with the given indices.
+ *
+ * If the test fails it prints a short description and the line where this function was called.
+ *
+ * @param description Short description of the experiment.
+ * @param input The input text.
+ * @param position Global position of the character. i.e in a text with with 1000 characters, position could be any value from 0 to 1000.
+ * @param resultLineIndex Index to the line where the character is located.
+ * @param resultGroupIndex Index to the group within the line where the character is located.
+ * @param resultWordIndex Index to the word within the group where the character is located.
+ * @param resultCharacterIndex Index to the character within the word where the character is located.
+ * @param location Where this function has been called.
+ *
+ * @return \e true if the experiment is successful. Otherwise returns \e false.
+ */
+bool TestGetIndicesFromGlobalCharacterIndex( const std::string& description,
+ const std::string& input,
+ const std::size_t position,
+ const std::size_t resultLineIndex,
+ const std::size_t resultGroupIndex,
+ const std::size_t resultWordIndex,
+ const std::size_t resultCharacterIndex,
+ const char* location )
+{
+ tet_printf( "%s", description.c_str() );
+
+ // Create natural size, layout and text-actor info for the input word.
+ Toolkit::Internal::TextView::RelayoutData relayoutData;
+ TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( input, inputStyledText );
+
+ TextViewProcessor::CreateTextInfo( inputStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData );
+
+ TextViewProcessor::TextInfoIndices indices;
+ TextViewProcessor::GetIndicesFromGlobalCharacterIndex( position,
+ inputLayout,
+ indices );
+
+ if( indices.mLineIndex != resultLineIndex )
+ {
+ tet_printf( "Fail. different line index. %s", location );
+ return false;
+ }
+ if( indices.mGroupIndex != resultGroupIndex )
+ {
+ tet_printf( "Fail. different group index. %s", location );
+ return false;
+ }
+ if( indices.mWordIndex != resultWordIndex )
+ {
+ tet_printf( "Fail. different word index. %s", location );
+ return false;
+ }
+ if( indices.mCharacterIndex != resultCharacterIndex )
+ {
+ tet_printf( "Fail. different character index. %s", location );
+ return false;
+ }
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////
+} // namespace
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( UtcDaliTextViewGetIndicesFromGlobalCharacterIndex, POSITIVE_TC_IDX ); // Tests correctness when indices to lines, groups, words and characters are worked out from a given global position.
+TEST_FUNCTION( UtcDaliTextViewDebugCouts, POSITIVE_TC_IDX ); // Tests debug functions just to not to penalize the coverage.
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliTextViewGetIndicesFromGlobalCharacterIndex()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewGetIndicesFromGlobalCharacterIndex : ");
+ struct GetIndicesFromGlobalCharacterIndexTest getIndicesFromGlobalCharacterIndexTests[] =
+ {
+ {
+ std::string( "Test position 0" ),
+ std::string( "text text text text text\n"
+ "text text ××§×¡× ××§×¡× text\n"
+ "text text text text text\n"
+ "\n" ),
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ },
+ {
+ std::string( "Test position 76. (just after the last \\n)" ),
+ std::string( "text text text text text\n"
+ "text text ××§×¡× ××§×¡× text\n"
+ "text text text text text\n"
+ "\n" ),
+ 76,
+ 4,
+ 0,
+ 0,
+ 0
+ },
+ {
+ std::string( "Test position 73. (the last \\n)" ),
+ std::string( "text text text text text\n"
+ "text text ××§×¡× ××§×¡× text\n"
+ "text text text text text\n"
+ "\n" ),
+ 75,
+ 3,
+ 0,
+ 0,
+ 0
+ },
+ {
+ std::string( "Test position 35. (first hebrew character)" ),
+ std::string( "text text text text text\n"
+ "text text ××§×¡× ××§×¡× text\n"
+ "text text text text text\n"
+ "\n" ),
+ 35,
+ 1,
+ 1,
+ 0,
+ 0
+ },
+ {
+ std::string( "Test position 3. (end of the first word)" ),
+ std::string( "text text text text text\n"
+ "text text ××§×¡× ××§×¡× text\n"
+ "text text text text text\n"
+ "\n" ),
+ 3,
+ 0,
+ 0,
+ 0,
+ 3
+ },
+ /* TODO Check for mixed RTL and LTR text.
+ {
+ std::string( "Test position 33. (end of the second word of the second line)" ),
+ std::string( "text text text text text\n"
+ "text text ××§×¡× ××§×¡× text\n"
+ "text text text text text\n"
+ "\n" ),
+ 33,
+ 1,
+ 0,
+ 2,
+ 3
+ },
+ {
+ std::string( "Test position 43. (last hebrew character)" ),
+ std::string( "text text text text text\n"
+ "text text ××§×¡× ××§×¡× text\n"
+ "text text text text text\n"
+ "\n" ),
+ 43,
+ 1,
+ 1,
+ 3,
+ 3
+ },
+ */
+ };
+ const std::size_t numberOfTests( 5 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const GetIndicesFromGlobalCharacterIndexTest& test = getIndicesFromGlobalCharacterIndexTests[index];
+
+ if( !TestGetIndicesFromGlobalCharacterIndex( test.description, test.input, test.position, test.lineIndex, test.groupIndex, test.wordIndex, test.characterIndex, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
+
+static void UtcDaliTextViewDebugCouts()
+{
+ /////////////////////////////////////////////////////
+ // Text debug functions to not to penalize coverage
+ /////////////////////////////////////////////////////
+
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewDebugCouts : ");
+
+ Toolkit::Internal::TextView::RelayoutData relayoutData;
+
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( std::string( "Hello world\nhello world" ), inputStyledText );
+
+ TextViewProcessor::CreateTextInfo( inputStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData );
+
+ Actor dummy = Actor::New();
+ Toolkit::Internal::SplitByNewLineChar::Relayout( dummy,
+ Toolkit::Internal::TextView::RELAYOUT_ALL,
+ DEFAULT_LAYOUT_PARAMETERS,
+ DEFAULT_VISUAL_PARAMETERS,
+ relayoutData );
+
+ TextViewProcessor::dbgPrint( relayoutData.mTextLayoutInfo );
+
+ TextStyle textStyle;
+ TextViewProcessor::dbgPrint( textStyle );
+
+ TextViewProcessor::TextInfoIndices indices;
+ TextViewProcessor::dbgPrint( indices );
+
+ TextViewProcessor::dbgPrint( inputStyledText );
+
+ tet_result( TET_PASS );
+}
diff --git a/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor-Types.cpp b/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor-Types.cpp
new file mode 100644
index 0000000..3591c26
--- /dev/null
+++ b/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor-Types.cpp
@@ -0,0 +1,311 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+
+#include
+
+// Internal headers are allowed here
+#include
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+using namespace Dali::Toolkit::Internal;
+
+namespace
+{
+// Data structures used to create an 'experiment' in TET cases
+
+//////////////////////////////////////////////////////////////////
+} // namespace
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( UtcDaliTextViewDefaultConstructorDestructor, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliTextViewCopyConstructorOperator, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliTextViewEqualityOperator, POSITIVE_TC_IDX );
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliTextViewDefaultConstructorDestructor()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewDefaultConstructorDestructor : ");
+
+ TextViewProcessor::TextInfoIndices indices;
+ DALI_TEST_EQUALS( indices.mLineIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( indices.mGroupIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( indices.mWordIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( indices.mCharacterIndex, 0u, TEST_LOCATION );
+
+ TextViewProcessor::CharacterLayoutInfo characterLayoutInfo;
+ DALI_TEST_EQUALS( characterLayoutInfo.mHeight, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mAdvance, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mBearing, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mPosition, Vector3::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mOffset, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mUnderlineThickness, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mUnderlinePosition, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_CHECK( !characterLayoutInfo.mTextActor );
+ DALI_TEST_CHECK( characterLayoutInfo.mStyledText.mText.IsEmpty() );
+ DALI_TEST_EQUALS( characterLayoutInfo.mColorAlpha, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mGradientColor, Vector4::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mStartPoint, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo.mEndPoint, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_CHECK( characterLayoutInfo.mIsVisible );
+ DALI_TEST_CHECK( characterLayoutInfo.mSetText );
+ DALI_TEST_CHECK( characterLayoutInfo.mSetStyle );
+
+ TextViewProcessor::WordLayoutInfo wordLayoutInfo;
+ DALI_TEST_EQUALS( wordLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordLayoutInfo.mAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordLayoutInfo.mType, TextViewProcessor::NoSeparator, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordLayoutInfo.mCharactersLayoutInfo.size(), 0u, TEST_LOCATION );
+
+ TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo;
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mDirection, TextViewProcessor::LTR, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mWordsLayoutInfo.size(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mNumberOfCharacters, 0u, TEST_LOCATION );
+
+ TextViewProcessor::LineLayoutInfo lineLayoutInfo;
+ DALI_TEST_EQUALS( lineLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo.mAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo.mLineHeightOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo.mWordGroupsLayoutInfo.size(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo.mNumberOfCharacters, 0u, TEST_LOCATION );
+
+ TextViewProcessor::TextLayoutInfo textLayoutInfo;
+ DALI_TEST_EQUALS( textLayoutInfo.mWholeTextSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mMaxWordWidth, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mLinesLayoutInfo.size(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mNumberOfCharacters, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mMaxItalicsOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mEllipsizeLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mEllipsizeLayoutInfo.mAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mEllipsizeLayoutInfo.mType, TextViewProcessor::NoSeparator, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo.mEllipsizeLayoutInfo.mCharactersLayoutInfo.size(), 0u, TEST_LOCATION );
+}
+
+static void UtcDaliTextViewCopyConstructorOperator()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewCopyConstructorOperator : ");
+
+ TextViewProcessor::CharacterLayoutInfo characterLayoutInfo;
+ characterLayoutInfo.mHeight = 1.f;
+ characterLayoutInfo.mAdvance = 1.f;
+ characterLayoutInfo.mBearing = 1.f;
+ characterLayoutInfo.mPosition = Vector3( 1.f, 1.f, 1.f );
+ characterLayoutInfo.mOffset = Vector2( 1.f, 1.f );
+ characterLayoutInfo.mSize = Vector2( 1.f, 1.f );
+ characterLayoutInfo.mAscender = 1.f;
+ characterLayoutInfo.mUnderlineThickness = 1.f;
+ characterLayoutInfo.mUnderlinePosition = 1.f;
+
+ characterLayoutInfo.mTextActor = TextActor::New( "Hello" );
+ characterLayoutInfo.mStyledText.mText = Text( "Hello" );
+
+ characterLayoutInfo.mColorAlpha = 0.f;
+ characterLayoutInfo.mGradientColor = Vector4( 1.f, 1.f, 1.f, 1.f );
+ characterLayoutInfo.mStartPoint = Vector2( 1.f, 1.f );
+ characterLayoutInfo.mEndPoint = Vector2( 1.f, 1.f );
+ characterLayoutInfo.mIsVisible = false;
+ characterLayoutInfo.mSetText = false;
+ characterLayoutInfo.mSetStyle = false;
+
+ TextViewProcessor::CharacterLayoutInfo characterLayoutInfo1;
+ characterLayoutInfo1 = characterLayoutInfo;
+
+ DALI_TEST_EQUALS( characterLayoutInfo1.mHeight, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mAdvance, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mBearing, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mPosition, Vector3( 1.f, 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mOffset, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mUnderlineThickness, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mUnderlinePosition, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_CHECK( characterLayoutInfo1.mTextActor );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mStyledText.mText.GetLength(), 5u, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mColorAlpha, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mGradientColor, Vector4( 1.f, 1.f, 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mStartPoint, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo1.mEndPoint, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_CHECK( !characterLayoutInfo1.mIsVisible );
+ DALI_TEST_CHECK( !characterLayoutInfo1.mSetText );
+ DALI_TEST_CHECK( !characterLayoutInfo1.mSetStyle );
+
+ TextViewProcessor::CharacterLayoutInfo characterLayoutInfo2( characterLayoutInfo );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mHeight, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mAdvance, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mBearing, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mPosition, Vector3( 1.f, 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mOffset, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mUnderlineThickness, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mUnderlinePosition, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_CHECK( characterLayoutInfo2.mTextActor );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mStyledText.mText.GetLength(), 5u, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mColorAlpha, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mGradientColor, Vector4( 1.f, 1.f, 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mStartPoint, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( characterLayoutInfo2.mEndPoint, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_CHECK( !characterLayoutInfo2.mIsVisible );
+ DALI_TEST_CHECK( !characterLayoutInfo2.mSetText );
+ DALI_TEST_CHECK( !characterLayoutInfo2.mSetStyle );
+
+ // Increases coverage.
+ characterLayoutInfo2.mTextActor.Reset();
+ characterLayoutInfo1 = characterLayoutInfo2;
+ DALI_TEST_CHECK( !characterLayoutInfo1.mTextActor );
+
+ TextViewProcessor::WordLayoutInfo wordLayoutInfo;
+ wordLayoutInfo.mSize = Vector2( 1.f, 1.f );
+ wordLayoutInfo.mAscender = 1.f;
+ wordLayoutInfo.mType = TextViewProcessor::LineSeparator;
+
+ TextViewProcessor::WordLayoutInfo wordLayoutInfo1;
+ wordLayoutInfo1 = wordLayoutInfo;
+
+ DALI_TEST_EQUALS( wordLayoutInfo1.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordLayoutInfo1.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordLayoutInfo1.mType, TextViewProcessor::LineSeparator, TEST_LOCATION );
+
+ TextViewProcessor::WordLayoutInfo wordLayoutInfo2( wordLayoutInfo );
+
+ DALI_TEST_EQUALS( wordLayoutInfo2.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordLayoutInfo2.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordLayoutInfo2.mType, TextViewProcessor::LineSeparator, TEST_LOCATION );
+
+
+ TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo;
+ wordGroupLayoutInfo.mSize = Vector2( 1.f, 1.f );
+ wordGroupLayoutInfo.mAscender = 1.f;
+ wordGroupLayoutInfo.mDirection = TextViewProcessor::RTL;
+ wordGroupLayoutInfo.mNumberOfCharacters = 1u;
+
+ TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo1;
+ wordGroupLayoutInfo1 = wordGroupLayoutInfo;
+
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mDirection, TextViewProcessor::RTL, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mNumberOfCharacters, 1u, TEST_LOCATION );
+
+ TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo2( wordGroupLayoutInfo );
+
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mDirection, TextViewProcessor::RTL, TEST_LOCATION );
+ DALI_TEST_EQUALS( wordGroupLayoutInfo.mNumberOfCharacters, 1u, TEST_LOCATION );
+
+
+ TextViewProcessor::LineLayoutInfo lineLayoutInfo;
+ lineLayoutInfo.mSize = Vector2( 1.f, 1.f );
+ lineLayoutInfo.mAscender = 1.f;
+ lineLayoutInfo.mLineHeightOffset = 1.f;
+ lineLayoutInfo.mNumberOfCharacters = 1u;
+
+ TextViewProcessor::LineLayoutInfo lineLayoutInfo1;
+ lineLayoutInfo1 = lineLayoutInfo;
+
+ DALI_TEST_EQUALS( lineLayoutInfo1.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo1.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo1.mLineHeightOffset, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo1.mNumberOfCharacters, 1u, TEST_LOCATION );
+
+ TextViewProcessor::LineLayoutInfo lineLayoutInfo2( lineLayoutInfo );
+
+ DALI_TEST_EQUALS( lineLayoutInfo2.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo2.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo2.mLineHeightOffset, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo2.mNumberOfCharacters, 1u, TEST_LOCATION );
+
+ TextViewProcessor::TextLayoutInfo textLayoutInfo;
+ textLayoutInfo.mWholeTextSize = Vector2( 1.f, 1.f );
+ textLayoutInfo.mMaxWordWidth = 1.f;
+ textLayoutInfo.mNumberOfCharacters = 1u;
+ textLayoutInfo.mMaxItalicsOffset = 1.f;
+
+ TextViewProcessor::TextLayoutInfo textLayoutInfo1;
+ textLayoutInfo1 = textLayoutInfo;
+
+ DALI_TEST_EQUALS( textLayoutInfo1.mWholeTextSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo1.mMaxWordWidth, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo1.mNumberOfCharacters, 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo1.mMaxItalicsOffset, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ TextViewProcessor::TextLayoutInfo textLayoutInfo2( textLayoutInfo );
+
+ DALI_TEST_EQUALS( textLayoutInfo2.mWholeTextSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo2.mMaxWordWidth, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo2.mNumberOfCharacters, 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textLayoutInfo2.mMaxItalicsOffset, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+}
+
+static void UtcDaliTextViewEqualityOperator()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewEqualityOperator : ");
+
+ TextViewProcessor::TextInfoIndices indices;
+ TextViewProcessor::TextInfoIndices indices1( 1u, 1u, 1u, 1u );
+
+ DALI_TEST_CHECK( !( indices == indices1 ) );
+
+ indices = indices1;
+
+ DALI_TEST_CHECK( indices == indices1 );
+}
diff --git a/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor.cpp b/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor.cpp
new file mode 100644
index 0000000..8f9a85e
--- /dev/null
+++ b/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-Processor.cpp
@@ -0,0 +1,428 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+
+#include
+
+// Internal headers are allowed here
+#include
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+using namespace Dali::Toolkit::Internal;
+
+namespace
+{
+// Data structures used to create an 'experiment' in TET cases
+
+//////////////////////////////////////////////////////////////////
+
+struct BeginsRightToLeftCharacterTest
+{
+ std::string description;
+ std::string input;
+ bool result;
+};
+
+bool TestBeginsRightToLeftCharacter( const std::string& description, const std::string& input, const bool result, const char* location )
+{
+ // Creates a styled text with the markup or plain string.
+ MarkupProcessor::StyledTextArray styledText;
+ MarkupProcessor::GetStyledTextArray( input, styledText );
+
+ const bool ret = ( result == TextProcessor::BeginsRightToLeftCharacter( styledText ) );
+
+ if( !ret )
+ {
+ tet_printf( "Fail. %s", location );
+ tet_printf( "Input : %s", input.c_str() );
+ }
+
+ return ret;
+}
+
+//////////////////////////////////////////////////////////////////
+
+struct ContainsRightToLeftCharacterTest
+{
+ std::string description;
+ std::string input;
+ bool result;
+};
+
+bool TestContainsRightToLeftCharacter( const std::string& description, const std::string& input, const bool result, const char* location )
+{
+ // Creates a styled text with the markup or plain string.
+ MarkupProcessor::StyledTextArray styledText;
+ MarkupProcessor::GetStyledTextArray( input, styledText );
+
+ const bool ret = ( result == TextProcessor::ContainsRightToLeftCharacter( styledText ) );
+
+ if( !ret )
+ {
+ tet_printf( "Fail. %s", location );
+ tet_printf( "Input : %s", input.c_str() );
+ }
+
+ return ret;
+}
+
+//////////////////////////////////////////////////////////////////
+
+struct FindNearestWordTest
+{
+ std::string description;
+ std::string input;
+ std::size_t offset;
+ std::size_t start;
+ std::size_t end;
+};
+
+bool TestFindNearestWord( const std::string& description, const std::string& input, const std::size_t offset, const std::size_t startResult, const std::size_t endResult, const char* location )
+{
+ // Creates a styled text with the markup or plain string.
+ MarkupProcessor::StyledTextArray styledText;
+ MarkupProcessor::GetStyledTextArray( input, styledText );
+
+ std::size_t start;
+ std::size_t end;
+ TextProcessor::FindNearestWord( styledText, offset, start, end );
+
+ const bool ret = ( start == startResult ) && ( end == endResult );
+
+ if( !ret )
+ {
+ tet_printf( "Fail. %s", location );
+ tet_printf( "Input : %s, offset %d, start %d, end %d", input.c_str(), offset, start, end );
+ }
+
+ return ret;
+}
+
+//////////////////////////////////////////////////////////////////
+
+struct SplitInLinesTest
+{
+ std::string inputText;
+
+ std::size_t resultNumberOfLines;
+};
+
+bool TestSplitInLines( const SplitInLinesTest& test, const char* location )
+{
+ // Creates a styled text with the markup or plain string.
+ MarkupProcessor::StyledTextArray styledText;
+ MarkupProcessor::GetStyledTextArray( test.inputText, styledText );
+
+ std::vector lines;
+
+ TextProcessor::SplitInLines( styledText,
+ lines );
+
+ if( lines.size() != test.resultNumberOfLines )
+ {
+ tet_printf( "Fail. %s", location );
+ tet_printf( "Different number of lines, result %d, expected result %d", lines.size(), test.resultNumberOfLines );
+
+ return false;
+ }
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////
+
+struct SplitInWordsTest
+{
+ std::string inputText;
+
+ std::size_t resultNumberOfWords;
+};
+
+bool TestSplitInWords( const SplitInWordsTest& test, const char* location )
+{
+ // Creates a styled text with the markup or plain string.
+ MarkupProcessor::StyledTextArray styledText;
+ MarkupProcessor::GetStyledTextArray( test.inputText, styledText );
+
+ std::vector words;
+
+ TextProcessor::SplitInWords( styledText,
+ words );
+
+ if( words.size() != test.resultNumberOfWords )
+ {
+ tet_printf( "Fail. %s", location );
+ tet_printf( "Different number of words, result %d, expected result %d", words.size(), test.resultNumberOfWords );
+
+ return false;
+ }
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////
+
+} // namespace
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( UtcDaliTextViewSplitInLines, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliTextViewSplitInWords, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliTextViewBeginsRightToLeftCharacter, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliTextViewContainsRightToLeftCharacter, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliTextViewFindNearestWord, POSITIVE_TC_IDX );
+// TEST_FUNCTION( , POSITIVE_TC_IDX );
+// TEST_FUNCTION( , NEGATIVE_TC_IDX );
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliTextViewSplitInLines()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewSplitInLines : ");
+
+ struct SplitInLinesTest splitInLinesTest[] =
+ {
+ {
+ std::string( "Hello world\nhello world." ),
+ 2
+ },
+ {
+ std::string( "Hello world\nhello world.\n\n" ),
+ 4
+ }
+ };
+ const std::size_t numberOfTests( 2 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const SplitInLinesTest& test = splitInLinesTest[index];
+
+ if( !TestSplitInLines( test, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
+
+static void UtcDaliTextViewSplitInWords()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewSplitInWords : ");
+
+ struct SplitInWordsTest splitInWordsTest[] =
+ {
+ {
+ std::string( "Hello world, hello word!" ),
+ 7
+ },
+ };
+ const std::size_t numberOfTests( 1 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const SplitInWordsTest& test = splitInWordsTest[index];
+
+ if( !TestSplitInWords( test, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
+
+static void UtcDaliTextViewBeginsRightToLeftCharacter()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewBeginsRightToLeftCharacter : ");
+
+ struct BeginsRightToLeftCharacterTest beginsRightToLeftCharacterTest[] =
+ {
+ {
+ std::string( "Test if it begins with a right to left character. Should return false." ),
+ std::string( "Hello world Ù
رØبا اÙعاÙÙ
." ),
+ false
+ },
+ {
+ std::string( "Test if it begins with a right to left character. Should return true." ),
+ std::string( "Ù
رØبا اÙعاÙÙ
Hola mundo." ),
+ true
+ }
+ };
+ const std::size_t numberOfTests( 2 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const BeginsRightToLeftCharacterTest& test = beginsRightToLeftCharacterTest[index];
+
+ if( !TestBeginsRightToLeftCharacter( test.description, test.input, test.result, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
+
+static void UtcDaliTextViewContainsRightToLeftCharacter()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewContainsRightToLeftCharacter : ");
+
+ struct ContainsRightToLeftCharacterTest containsRightToLeftCharacterTest[] =
+ {
+ {
+ std::string( "Test if it contains a right to left character. Should return true." ),
+ std::string( "Hello world Ù
رØبا اÙعاÙÙ
." ),
+ true
+ },
+ {
+ std::string( "Test if it contains a right to left character. Should return true." ),
+ std::string( "Ù
رØبا اÙعاÙÙ
Hola mundo." ),
+ true
+ },
+ {
+ std::string( "Test if it contains a right to left character. Should return false." ),
+ std::string( "Hello world." ),
+ false
+ },
+ {
+ std::string( "Test if it contains a right to left character. Should return true." ),
+ std::string( "Ù
رØبا اÙعاÙÙ
." ),
+ true
+ }
+ };
+ const std::size_t numberOfTests( 4 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const ContainsRightToLeftCharacterTest& test = containsRightToLeftCharacterTest[index];
+
+ if( !TestContainsRightToLeftCharacter( test.description, test.input, test.result, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
+
+static void UtcDaliTextViewFindNearestWord()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewFindNearestWord : ");
+
+ struct FindNearestWordTest findNearestWordTest[] =
+ {
+ {
+ std::string( "" ),
+ std::string( "Hello world, hola mundo" ),
+ 0u,
+ 0u,
+ 5u
+ },
+ {
+ std::string( "" ),
+ std::string( "Hello world, hola mundo" ),
+ 7u,
+ 6u,
+ 12u
+ },
+ {
+ std::string( "" ),
+ std::string( "Hello world, hola mundo" ),
+ 11u,
+ 6u,
+ 12u
+ },
+ {
+ std::string( "" ),
+ std::string( "Hello world, hola mundo" ),
+ 23u,
+ 18u,
+ 23u
+ },
+ {
+ std::string( "" ),
+ std::string( "Hello world, hola mundo" ),
+ 5u,
+ 0u,
+ 5u
+ },
+ {
+ std::string( "" ),
+ std::string( "Hello world, hola mundo Ù
رØبا اÙعاÙÙ
" ),
+ 24u,
+ 25u,
+ 30u
+ }
+ };
+
+ const std::size_t numberOfTests( 6 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const FindNearestWordTest& test = findNearestWordTest[index];
+
+ if( !TestFindNearestWord( test.description, test.input, test.offset, test.start, test.end, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
diff --git a/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-Relayout-Utilities.cpp b/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-Relayout-Utilities.cpp
new file mode 100644
index 0000000..9b5ddef
--- /dev/null
+++ b/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView-Relayout-Utilities.cpp
@@ -0,0 +1,856 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+
+#include
+
+// Internal headers are allowed here
+#include
+#include
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+using namespace Dali::Toolkit::Internal;
+
+namespace
+{
+
+const Toolkit::Internal::TextView::LayoutParameters DEFAULT_LAYOUT_PARAMETERS;
+
+// Data structures used to create an 'experiment' in TET cases
+
+
+bool TestEqual( float x, float y )
+{
+ return ( fabsf( x - y ) < Math::MACHINE_EPSILON_1000 );
+}
+
+//////////////////////////////////////////////////////////////////
+
+struct CalculateSubLineLayoutTest
+{
+ std::string description;
+ std::string inputLine;
+ float parentWidth;
+ std::size_t groupIndex;
+ std::size_t wordIndex;
+ std::size_t characterIndex;
+ TextViewRelayout::HorizontalWrapType splitPolicy;
+ float shrinkFactor;
+
+ float resultLineLength;
+ float resultMaxCharHeight;
+ float resultMaxAscender;
+};
+
+bool TestCalculateSubLineLayout( const CalculateSubLineLayoutTest& test, const char* location )
+{
+ tet_printf( "%s", test.description.c_str() );
+
+ // Create styled text.
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( test.inputLine, inputStyledText );
+
+ // Create styled text layout info.
+ Toolkit::Internal::TextView::RelayoutData relayoutData;
+ TextViewProcessor::CreateTextInfo( inputStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData );
+
+ // Prepare input parameters and the result structure and call the function to be tested.
+
+ // Creaqte indices.
+ TextViewProcessor::TextInfoIndices indices( 0, test.groupIndex, test.wordIndex, test.characterIndex );
+
+ // Get the input line.
+ TextViewProcessor::LineLayoutInfo inputLineLayout;
+
+ if( !relayoutData.mTextLayoutInfo.mLinesLayoutInfo.empty() )
+ {
+ inputLineLayout = *relayoutData.mTextLayoutInfo.mLinesLayoutInfo.begin();
+ }
+
+ // Result struct.
+ TextViewRelayout::SubLineLayoutInfo resultLayoutInfo;
+
+ CalculateSubLineLayout( test.parentWidth,
+ indices,
+ inputLineLayout,
+ test.splitPolicy,
+ test.shrinkFactor,
+ resultLayoutInfo );
+
+ // Check results.
+ if( !TestEqual( test.resultLineLength, resultLayoutInfo.mLineLength ) )
+ {
+ tet_printf( "Fail. different line length %f == %f. %s", test.resultLineLength, resultLayoutInfo.mLineLength, location );
+ return false;
+ }
+
+ if( !TestEqual( test.resultMaxCharHeight, resultLayoutInfo.mMaxCharHeight ) )
+ {
+ tet_printf( "Fail. different max character height %f == %f. %s", test.resultMaxCharHeight, resultLayoutInfo.mMaxCharHeight, location );
+ return false;
+ }
+
+ if( !TestEqual( test.resultMaxAscender, resultLayoutInfo.mMaxAscender ) )
+ {
+ tet_printf( "Fail. different max ascender %f == %f. %s", test.resultMaxAscender, resultLayoutInfo.mMaxAscender, location );
+ return false;
+ }
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////
+
+struct AlignmentOffsetTest
+{
+ Toolkit::Alignment::Type alignment;
+ float parentSize;
+ float wholeTextSize;
+
+ float resultOffset;
+};
+
+bool TestAlignmentOffset( const AlignmentOffsetTest& test, const char* location )
+{
+ float offset = 0.f;
+
+ switch( test.alignment )
+ {
+ case Toolkit::Alignment::HorizontalLeft:
+ case Toolkit::Alignment::HorizontalCenter:
+ case Toolkit::Alignment::HorizontalRight:
+ {
+ offset = TextViewRelayout::CalculateXoffset( test.alignment, test.parentSize, test.wholeTextSize );
+ break;
+ }
+ case Toolkit::Alignment::VerticalTop:
+ case Toolkit::Alignment::VerticalCenter:
+ case Toolkit::Alignment::VerticalBottom:
+ {
+ offset = TextViewRelayout::CalculateYoffset( test.alignment, test.parentSize, test.wholeTextSize );
+ break;
+ }
+ }
+
+ // Check results.
+ if( !TestEqual( test.resultOffset, offset ) )
+ {
+ tet_printf( "Fail. different offset %f == %f. %s", test.resultOffset, offset, location );
+ return false;
+ }
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////
+
+struct JustificationOffsetTest
+{
+ Toolkit::TextView::LineJustification justification;
+ float wholeTextWidth;
+ float lineLength;
+
+ float resultOffset;
+};
+
+bool TestJustificationOffset( const JustificationOffsetTest& test, const char* location )
+{
+ float offset = TextViewRelayout::CalculateJustificationOffset( test.justification, test.wholeTextWidth, test.lineLength );
+
+ // Check results.
+ if( !TestEqual( test.resultOffset, offset ) )
+ {
+ tet_printf( "Fail. different offset %f == %f. %s", test.resultOffset, offset, location );
+ return false;
+ }
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////
+
+struct CalculateVisibilityTest
+{
+ Vector3 position;
+ Size size;
+ Size parentSize;
+ TextViewRelayout::VisibilityTestType type;
+
+ bool resultVisible;
+};
+
+bool TestCalculateVisibility( const CalculateVisibilityTest& test, const char* location )
+{
+ if( test.resultVisible != TextViewRelayout::IsVisible( test.position, test.size, test.parentSize, test.type ) )
+ {
+ tet_printf( "Fail. different visibility. Type %d, %s", test.type, location );
+ return false;
+ }
+
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////
+
+} // namespace
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( UtcDaliTextViewDefaultConstructorDestructor, POSITIVE_TC_IDX ); // Calls structs's default constructor and destructors and checks their default values.
+TEST_FUNCTION( UtcDaliTextViewCalculateSubLineLayout, POSITIVE_TC_IDX ); // Checks the function which calculates the layout info of the portion of the line which fits on the text-view width.
+TEST_FUNCTION( UtcDaliTextViewCalculateAlignmentOffsets, POSITIVE_TC_IDX ); // Checks the horizontal and vertical alignaments (for the whole text).
+TEST_FUNCTION( UtcDaliTextViewCalculateJustificationOffsets, POSITIVE_TC_IDX ); // Checks the justification alignment (line per line).
+TEST_FUNCTION( UtcDaliTextViewCalculateVisibility, POSITIVE_TC_IDX ); // Checks the text-actor visibility within the text-view with a rectangle intersection test.
+
+TEST_FUNCTION( UtcDaliTextViewMiscelaneousAsserts, NEGATIVE_TC_IDX ); // Tests some strange asserts.
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliTextViewDefaultConstructorDestructor()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewDefaultConstructorDestructor : ");
+
+ // Test RelayoutParameters defaults.
+ TextViewRelayout::RelayoutParameters relayoutParameters;
+
+ DALI_TEST_EQUALS( relayoutParameters.mPositionOffset, Vector3::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( relayoutParameters.mLineSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( relayoutParameters.mWordSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( relayoutParameters.mCharacterSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( relayoutParameters.mIndices.mLineIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( relayoutParameters.mIndices.mGroupIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( relayoutParameters.mIndices.mWordIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( relayoutParameters.mIndices.mCharacterIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( relayoutParameters.mCharacterGlobalIndex, 0u, TEST_LOCATION );
+ DALI_TEST_CHECK( !relayoutParameters.mIsFirstCharacter );
+ DALI_TEST_CHECK( !relayoutParameters.mIsFirstCharacterOfWord );
+ DALI_TEST_CHECK( !relayoutParameters.mIsNewLine );
+ DALI_TEST_CHECK( !relayoutParameters.mIsNewLineCharacter );
+ DALI_TEST_CHECK( !relayoutParameters.mIsWhiteSpace );
+ DALI_TEST_CHECK( !relayoutParameters.mIsVisible );
+
+ // Test FadeParameter defaults
+ TextViewRelayout::FadeParameters fadeParameters;
+
+ DALI_TEST_EQUALS( fadeParameters.mRightFadeBoundary, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mRightFadeThreshold, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mRightFadeBoundaryOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mRightFadeThresholdOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mRightAlphaCoeficients, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mLeftFadeBoundary, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mLeftFadeThreshold, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mLeftFadeBoundaryOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mLeftFadeThresholdOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mLeftAlphaCoeficients, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mTopFadeBoundary, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mTopFadeThreshold, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mTopFadeBoundaryOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mTopFadeThresholdOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mTopAlphaCoeficients, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mBottomFadeBoundary, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mBottomFadeThreshold, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mBottomFadeBoundaryOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mBottomFadeThresholdOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( fadeParameters.mBottomAlphaCoeficients, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_CHECK( !fadeParameters.mIsPartiallyVisible );
+
+ // Test EllipsizeParameters defaults
+ TextViewRelayout::EllipsizeParameters ellipsizeParameters;
+
+ DALI_TEST_EQUALS( ellipsizeParameters.mPosition, Vector3::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( ellipsizeParameters.mLineDescender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( ellipsizeParameters.mLineWidth, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( ellipsizeParameters.mEllipsizeBoundary, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( ellipsizeParameters.mFirstIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( ellipsizeParameters.mLastIndex, 0u, TEST_LOCATION );
+ DALI_TEST_CHECK( !ellipsizeParameters.mEllipsizeLine );
+ DALI_TEST_CHECK( !ellipsizeParameters.mIsLineWidthFullyVisible );
+ DALI_TEST_CHECK( !ellipsizeParameters.mIsLineHeightFullyVisible );
+ DALI_TEST_CHECK( !ellipsizeParameters.mIsNextLineFullyVisibleHeight );
+ DALI_TEST_CHECK( !ellipsizeParameters.mCreateEllipsizedTextActors );
+ DALI_TEST_CHECK( !ellipsizeParameters.mLineFits );
+ DALI_TEST_CHECK( !ellipsizeParameters.mWordFits );
+
+ // Test UnderlineInfo defaults
+ TextViewRelayout::UnderlineInfo underlineInfo;
+
+ DALI_TEST_EQUALS( underlineInfo.mMaxHeight, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( underlineInfo.mMaxThickness, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( underlineInfo.mPosition, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ // Test TextUnderlineStatus defaults
+ TextViewRelayout::TextUnderlineStatus textUnderlineStatus;
+
+ DALI_TEST_CHECK( textUnderlineStatus.mUnderlineInfo.empty() );
+ DALI_TEST_EQUALS( textUnderlineStatus.mCharacterGlobalIndex, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textUnderlineStatus.mLineGlobalIndex, 0u, TEST_LOCATION );
+ DALI_TEST_CHECK( !textUnderlineStatus.mCurrentUnderlineStatus );
+
+ // Test SubLineLayoutInfo defaults
+ TextViewRelayout::SubLineLayoutInfo subLineLayoutInfo;
+
+ DALI_TEST_EQUALS( subLineLayoutInfo.mLineLength, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( subLineLayoutInfo.mMaxCharHeight, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( subLineLayoutInfo.mMaxAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+}
+
+static void UtcDaliTextViewCalculateSubLineLayout()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewCalculateSubLineLayout : ");
+
+ struct CalculateSubLineLayoutTest calculateSubLineLayoutTest[] =
+ {
+ //WrapByCharacter
+ {
+ "The line is wraped by character. All characters have the same size.",
+ "Hello world", // input line
+ 100.f, // parent width
+ 0,
+ 0, // indices
+ 0,
+ TextViewRelayout::WrapByCharacter, // split policy
+ 1.f,
+ // results
+ 91.041672f, // line length. (only fits 8 characters 8x11.38)
+ 11.380209f, // max character height
+ 10.242188f // max ascender
+ },
+ {
+ "The line is wraped by character. There are characters with different sizes.",
+ "Hello world", // input line
+ 100.f, // parent width
+ 0,
+ 0, // indices
+ 0,
+ TextViewRelayout::WrapByCharacter, // split policy
+ 1.f,
+ // results
+ 94.835075f, // line length. (only fits 8 characters 6x11.38 + 2x13.27)
+ 13.276911f, // max character height
+ 11.949220f // max ascender
+ },
+ {
+ "The line is wraped by character. There are characters with different sizes. It calculates the layout for the second line.",
+ "Hello world hello world", // input line
+ 100.f, // parent width
+ 0,
+ 2, // indices. The third character of the third word starts in a new line.
+ 2,
+ TextViewRelayout::WrapByCharacter, // split policy
+ 1.f,
+ // results
+ 91.041672f, // line length. (only fits 8 characters 8x11.38)
+ 11.380209f, // max character height
+ 10.242188f // max ascender
+ },
+ {
+ "The line is wraped by character. There are characters with different sizes. It calculates the layout for the third line.",
+ "Hello world hello world", // input line
+ 100.f, // parent width
+ 0,
+ 4, // indices. The fifth character of the fifth word starts in a new line.
+ 4,
+ TextViewRelayout::WrapByCharacter, // split policy
+ 1.f,
+ // results
+ 92.938377f, // line length. (only fits 8 characters 8x11.38)
+ 13.276911f, // max character height
+ 11.949220f // max ascender
+ },
+
+ //WrapByWord
+ {
+ "The line is wraped by word. All characters have the same size.",
+ "Hello world", // input line
+ 100.f, // parent width
+ 0,
+ 0, // indices. It shouldn't use the index character so 9999999 shouldn't make it crash.
+ 9999999,
+ TextViewRelayout::WrapByWord, // split policy
+ 1.f,
+ // results
+ 56.901047f, // line length. (only fits 5 characters 5x11.38, white space is not counted)
+ 11.380209f, // max character height
+ 10.242188f // max ascender
+ },
+ {
+ "The line is wraped by word. There are characters with different sizes.",
+ "Hello world", // input line
+ 100.f, // parent width
+ 0,
+ 0, // indices.
+ 0,
+ TextViewRelayout::WrapByWord, // split policy
+ 1.f,
+ // results
+ 58.797747f, // line length. (only fits 5 characters 4x11.38 + 13.276911, white space is not counted)
+ 13.276911f, // max character height
+ 11.949220f // max ascender
+ },
+ {
+ "The line is wraped by word. There are characters with different sizes. It calculates the layout for the second line.",
+ "Hello world hello world", // input line
+ 100.f, // parent width
+ 0,
+ 2, // indices. The third word starts in a new line.
+ 0,
+ TextViewRelayout::WrapByWord, // split policy
+ 1.f,
+ // results
+ 60.694449f, // line length. (only fits 5 characters 2x13.276911 + 3x11.38)
+ 13.276911f, // max character height
+ 11.949220f // max ascender
+ },
+ {
+ "The line is wraped by word. The word doen't fit.",
+ "Hello world", // input line
+ 40.f, // parent width
+ 0,
+ 0, // indices. The third word starts in a new line.
+ 0,
+ TextViewRelayout::WrapByWord, // split policy
+ 1.f,
+ // results
+ 0.f, // line length. (The word doesn't fit)
+ 11.380209f, // max character height
+ 10.242188f // max ascender
+ },
+
+ //WrapByWordAndSplit
+ {
+ "The line is wraped by word and by character. All characters have the same size. There is not a long word.",
+ "Hello world hello world", // input line
+ 100.f, // parent width
+ 0,
+ 0, // indices.
+ 0,
+ TextViewRelayout::WrapByWordAndSplit, // split policy
+ 1.f,
+ // results
+ 56.901047f, // line length. (only fits 5 characters 5x11.38, white space is not counted)
+ 11.380209f, // max character height
+ 10.242188f // max ascender
+ },
+ {
+ "The line is wraped by word and by character. All characters have the same size. There is a long word.",
+ "Helloooooooo world", // input line
+ 100.f, // parent width
+ 0,
+ 0, // indices.
+ 0,
+ TextViewRelayout::WrapByWordAndSplit, // split policy
+ 1.f,
+ // results
+ 91.041672f, // line length. (only fits 8 characters 8x11.38)
+ 11.380209f, // max character height
+ 10.242188f // max ascender
+ },
+ {
+ "The line is wraped by word and by character. There are characters with different sizes. There is a long word. It calculates the layout for the second line.",
+ "Helloooooooo world", // input line
+ 100.f, // parent width
+ 0,
+ 0, // indices.
+ 8,
+ TextViewRelayout::WrapByWordAndSplit, // split policy
+ 1.f,
+ // results
+ 45.520836f, // line length. (only fits 8 characters 8x11.38)
+ 11.380209f, // max character height
+ 10.242188f // max ascender
+ },
+ {
+ "The line is wraped by word and by character. There are characters with different sizes. There is a shrink factor.",
+ "Helloooooooo world", // input line
+ 100.f, // parent width
+ 0,
+ 0, // indices.
+ 8,
+ TextViewRelayout::WrapByWordAndSplit, // split policy
+ 0.7f,
+ // results
+ 95.593755f, // line length. (only fits 12 characters 8x11.38)
+ 7.9661463f, // max character height
+ 7.169531f // max ascender
+ },
+
+ //WrapByLineAndSplit
+ {
+ "The line is wraped by end of line and by character. All characters have the same size.",
+ "Hello world", // input line
+ 100.f, // parent width
+ 0,
+ 0, // indices
+ 0,
+ TextViewRelayout::WrapByLineAndSplit, // split policy
+ 1.f,
+ // results
+ 91.041672f, // line length. (only fits 8 characters 8x11.38)
+ 11.380209f, // max character height
+ 10.242188f // max ascender
+ },
+ {
+ "The line fits in the width.",
+ "Hello", // input line
+ 100.f, // parent width
+ 0,
+ 0, // indices
+ 0,
+ TextViewRelayout::WrapByLineAndSplit, // split policy
+ 1.f,
+ // results
+ 56.901047f, // line length. (only fits 5 characters 5x11.38)
+ 11.380209f, // max character height
+ 10.242188f // max ascender
+ },
+ {
+ "The line is wraped by end of line and by character. All characters have the same size. It calculates the layout for the second line.",
+ "Hello world, hello world", // input line
+ 100.f, // parent width
+ 0,
+ 2, // indices
+ 2,
+ TextViewRelayout::WrapByLineAndSplit, // split policy
+ 1.f,
+ // results
+ 91.041672f, // line length. (only fits 8 characters 8x11.38)
+ 11.380209f, // max character height
+ 10.242188f // max ascender
+ },
+ };
+ const std::size_t numberOfTests( 15 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const CalculateSubLineLayoutTest& test = calculateSubLineLayoutTest[index];
+
+ if( !TestCalculateSubLineLayout( test, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
+
+static void UtcDaliTextViewCalculateAlignmentOffsets()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewCalculateAlignmentOffsets : ");
+
+ struct AlignmentOffsetTest alignmentOffsetTest[] =
+ {
+ {
+ Toolkit::Alignment::HorizontalLeft,
+ 100.f,
+ 75.f,
+ 0.f
+ },
+ {
+ Toolkit::Alignment::HorizontalCenter,
+ 100.f,
+ 75.f,
+ 12.5f
+ },
+ {
+ Toolkit::Alignment::HorizontalRight,
+ 100.f,
+ 75.f,
+ 25.f
+ },
+ {
+ Toolkit::Alignment::VerticalTop,
+ 100.f,
+ 75.f,
+ 0.f
+ },
+ {
+ Toolkit::Alignment::VerticalCenter,
+ 100.f,
+ 75.f,
+ 12.5f
+ },
+ {
+ Toolkit::Alignment::VerticalBottom,
+ 100.f,
+ 75.f,
+ 25.f
+ }
+ };
+ const std::size_t numberOfTests( 6 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const AlignmentOffsetTest& test = alignmentOffsetTest[index];
+
+ if( !TestAlignmentOffset( test, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
+
+static void UtcDaliTextViewCalculateJustificationOffsets()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewCalculateJustificationOffsets : ");
+
+ struct JustificationOffsetTest justificationOffsetTest[] =
+ {
+ {
+ Toolkit::TextView::Left,
+ 100.f,
+ 75.f,
+ 0.f
+ },
+ {
+ Toolkit::TextView::Justified,
+ 100.f,
+ 75.f,
+ 0.f
+ },
+ {
+ Toolkit::TextView::Center,
+ 100.f,
+ 150.f,
+ -25.f
+ },
+ {
+ Toolkit::TextView::Right,
+ 100.f,
+ 75.f,
+ 25.f
+ },
+ };
+ const std::size_t numberOfTests( 4 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const JustificationOffsetTest& test = justificationOffsetTest[index];
+
+ if( !TestJustificationOffset( test, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
+
+
+static void UtcDaliTextViewCalculateVisibility()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewCalculateVisibility : ");
+
+ struct CalculateVisibilityTest calculateVisibilityTest[] =
+ {
+ {
+ Vector3( 0.f, 10.f, 0.f ),
+ Size( 10.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::FULLY_VISIBLE,
+ true
+ },
+ {
+ Vector3( 10.f, 10.f, 0.f ),
+ Size( 10.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::FULLY_VISIBLE,
+ true
+ },
+ {
+ Vector3( 0.f, 10.f, 0.f ),
+ Size( 150.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::FULLY_VISIBLE,
+ false
+ },
+ {
+ Vector3( 0.f, 10.f, 0.f ),
+ Size( 10.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::FULLY_VISIBLE_WIDTH,
+ true
+ },
+ {
+ Vector3( 95.f, 10.f, 0.f ),
+ Size( 10.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::FULLY_VISIBLE_WIDTH,
+ false
+ },
+ {
+ Vector3( 0.f, 10.f, 0.f ),
+ Size( 10.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::FULLY_VISIBLE_HEIGHT,
+ true
+ },
+ {
+ Vector3( 0.f, 0.f, 0.f ),
+ Size( 10.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::FULLY_VISIBLE_HEIGHT,
+ false
+ },
+ {
+ Vector3( -10.f, 10.f, 0.f ),
+ Size( 150.f, 150.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::PARTIALLY_VISIBLE,
+ true
+ },
+ {
+ Vector3( -100.f, -100.f, 0.f ),
+ Size( 10.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::PARTIALLY_VISIBLE,
+ false
+ },
+ {
+ Vector3( -10.f, 10.f, 0.f ),
+ Size( 50.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::PARTIALLY_VISIBLE_WIDTH,
+ true
+ },
+ {
+ Vector3( 110.f, 10.f, 0.f ),
+ Size( 10.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::PARTIALLY_VISIBLE_WIDTH,
+ false
+ },
+ {
+ Vector3( 0.f, 20.f, 0.f ),
+ Size( 10.f, 50.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::PARTIALLY_VISIBLE_HEIGHT,
+ true
+ },
+ {
+ Vector3( 0.f, -10.f, 0.f ),
+ Size( 10.f, 10.f ),
+ Size( 100.f, 100.f ),
+ TextViewRelayout::PARTIALLY_VISIBLE_HEIGHT,
+ false
+ },
+ };
+ const std::size_t numberOfTests( 13 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const CalculateVisibilityTest& test = calculateVisibilityTest[index];
+
+ if( !TestCalculateVisibility( test, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
+
+static void UtcDaliTextViewMiscelaneousAsserts()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewMiscelaneousAsserts : ");
+
+ float offset = 0.f;
+
+ bool assert1 = false;
+ bool assert2 = false;
+ try
+ {
+ offset = Toolkit::Internal::TextViewRelayout::CalculateXoffset( Toolkit::Alignment::VerticalTop, 100.f, 50.f );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewRelayout::CalculateXoffset: Wrong horizontal text alignment. Did you set a vertical one?\"", TEST_LOCATION );
+ assert1 = true;
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+ DALI_TEST_EQUALS( offset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ try
+ {
+ offset = Toolkit::Internal::TextViewRelayout::CalculateYoffset( Toolkit::Alignment::HorizontalRight, 100.f, 50.f );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewRelayout::CalculateXoffset: Wrong vertical text alignment. Did you set an horizontal one?\"", TEST_LOCATION );
+ assert2 = true;
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+ DALI_TEST_EQUALS( offset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ DALI_TEST_CHECK( assert1 && assert2 );
+
+}
diff --git a/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView.cpp b/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView.cpp
new file mode 100644
index 0000000..6312da8
--- /dev/null
+++ b/automated-tests/dali-internal-test-suite/text-view/utc-Dali-TextView.cpp
@@ -0,0 +1,2917 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+
+#include
+
+// Internal headers are allowed here
+#include
+#include
+#include
+#include
+#include
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+using namespace Dali::Toolkit::Internal;
+
+namespace
+{
+
+const Toolkit::Internal::TextView::LayoutParameters DEFAULT_LAYOUT_PARAMETERS;
+const Toolkit::Internal::TextView::VisualParameters DEFAULT_VISUAL_PARAMETERS;
+
+// Data structures used to create an 'experiment' in TET cases
+
+struct SplitWordTest
+{
+ std::string description;
+ std::string input;
+ std::size_t position;
+ std::string firstResult;
+ std::string lastResult;
+};
+
+struct SplitWordGroupTest
+{
+ std::string description;
+ std::string input;
+ std::size_t wordPosition;
+ std::size_t position;
+ std::string firstResult;
+ std::string lastResult;
+};
+
+struct SplitLineTest
+{
+ std::string description;
+ std::string input;
+ std::size_t groupPosition;
+ std::size_t wordPosition;
+ std::size_t position;
+ float lineHeightOffset;
+ std::string firstResult;
+ std::string lastResult;
+};
+
+struct MergeWordsTest
+{
+ std::string description;
+ std::string inputFirst;
+ std::string inputLast;
+ std::string result;
+};
+
+struct MergeWordGroupsTest
+{
+ std::string description;
+ std::string inputFirst;
+ std::string inputLast;
+ std::string result;
+};
+
+struct MergeLinesTest
+{
+ std::string description;
+ std::string inputFirst;
+ std::string inputLast;
+ float lineHeightOffset;
+ std::string result;
+};
+
+struct RemoveCharactersFromWordTest
+{
+ std::string description;
+ std::string input;
+ std::size_t position;
+ std::size_t numberOfCharacters;
+ std::string result;
+};
+
+struct RemoveWordsFromGroupTest
+{
+ std::string description;
+ std::string input;
+ std::size_t wordIndex;
+ std::size_t numberOfWords;
+ std::string result;
+};
+
+struct RemoveGroupsFromLineTest
+{
+ std::string description;
+ std::string input;
+ std::size_t groupIndex;
+ std::size_t numberOfGroups;
+ float lineHeightOffset;
+ std::string result;
+};
+
+enum UpdateTextInfoOperation
+{
+ Insert,
+ Remove,
+ Replace
+};
+
+struct UpdateTextInfoTest
+{
+ std::string description;
+ UpdateTextInfoOperation operation;
+ std::string input;
+ std::size_t position;
+ std::size_t numberOfCharacters;
+ std::string inputText;
+ float lineHeightOffset;
+ std::string result;
+};
+
+// Useful Print functions when something goes wrong.
+
+void Print( const TextViewProcessor::CharacterLayoutInfo& character )
+{
+ std::cout << " height : " << character.mHeight << std::endl;
+ std::cout << " advance : " << character.mAdvance << std::endl;
+ std::cout << " bearing : " << character.mBearing << std::endl;
+ std::cout << " mPosition : " << character.mPosition << std::endl;
+ std::cout << " mSize : " << character.mSize << std::endl;
+ std::cout << " mAscender : " << character.mAscender << std::endl;
+
+ if( character.mTextActor )
+ {
+ std::cout << "[" << character.mTextActor.GetText() << "]";
+ }
+ else
+ {
+ std::cout << "{" << character.mStyledText.mText.GetText() << "}";
+ }
+}
+
+void Print( const TextViewProcessor::WordLayoutInfo& word )
+{
+ std::cout << "[";
+ std::cout << " mSize : " << word.mSize << std::endl;
+ std::cout << " mAscender : " << word.mAscender << std::endl;
+ std::cout << " mType : " << word.mType << std::endl;
+ std::cout << "mNumberOfCharacters : " << word.mCharactersLayoutInfo.size() << std::endl;
+ std::cout << "[";
+ for( TextViewProcessor::CharacterLayoutInfoContainer::const_iterator it = word.mCharactersLayoutInfo.begin(), endIt = word.mCharactersLayoutInfo.end(); it != endIt; ++it )
+ {
+ Print( *it );
+ }
+ std::cout << "]"; std::cout << std::endl;
+ std::cout << "]"; std::cout << std::endl;
+}
+
+void Print( const TextViewProcessor::WordGroupLayoutInfo& wordGroup )
+{
+ std::cout << "(";
+ std::cout << " mSize : " << wordGroup.mSize << std::endl;
+ std::cout << " mAscender : " << wordGroup.mAscender << std::endl;
+ std::cout << " mDirection : " << wordGroup.mDirection << std::endl;
+ std::cout << "mNumberOfCharacters : " << wordGroup.mNumberOfCharacters << std::endl;
+ for( TextViewProcessor::WordLayoutInfoContainer::const_iterator it = wordGroup.mWordsLayoutInfo.begin(), endIt = wordGroup.mWordsLayoutInfo.end(); it != endIt; ++it )
+ {
+ Print( *it );
+ }
+ std::cout << ")"; std::cout << std::endl;
+}
+
+void Print( const TextViewProcessor::LineLayoutInfo& line )
+{
+ std::cout << "<";
+ std::cout << " mSize : " << line.mSize << std::endl;
+ std::cout << " mAscender : " << line.mAscender << std::endl;
+ std::cout << "mNumberOfCharacters : " << line.mNumberOfCharacters << std::endl;
+ for( TextViewProcessor::WordGroupLayoutInfoContainer::const_iterator it = line.mWordGroupsLayoutInfo.begin(), endIt = line.mWordGroupsLayoutInfo.end(); it != endIt; ++it )
+ {
+ Print( *it );
+ }
+ std::cout << ">" << std::endl;
+}
+
+void Print( const TextViewProcessor::TextLayoutInfo& text )
+{
+ std::cout << "||";
+ for( TextViewProcessor::LineLayoutInfoContainer::const_iterator it = text.mLinesLayoutInfo.begin(), endIt = text.mLinesLayoutInfo.end(); it != endIt; ++it )
+ {
+ Print( *it );
+ }
+ std::cout << "||" << std::endl;
+}
+
+void Print( const TextStyle& style )
+{
+ std::cout << " font name : " << style.GetFontName() << std::endl;
+ std::cout << " : " << style.GetFontStyle() << std::endl;
+ std::cout << " : " << style.GetFontPointSize() << std::endl;
+ std::cout << " : " << style.GetWeight() << std::endl;
+ std::cout << " : " << style.GetTextColor() << std::endl;
+ std::cout << " : " << style.GetItalics() << std::endl;
+ std::cout << " : " << style.GetUnderline() << std::endl;
+ std::cout << " : " << style.GetShadow() << std::endl;
+ std::cout << " : " << style.GetShadowColor() << std::endl;
+ std::cout << " : " << style.GetShadowOffset() << std::endl;
+ std::cout << " : " << style.GetGlow() << std::endl;
+ std::cout << " : " << style.GetGlowColor() << std::endl;
+ std::cout << " : " << style.GetGlowIntensity() << std::endl;
+ std::cout << " : " << style.GetSmoothEdge() << std::endl;
+ std::cout << " : " << style.GetOutline() << std::endl;
+ std::cout << " : " << style.GetOutlineThickness() << std::endl;
+}
+
+// Test functions used to check if two data structures are equal.
+
+bool TestEqual( float x, float y )
+{
+ return ( fabsf( x - y ) < Math::MACHINE_EPSILON_1000 );
+}
+
+bool TestEqual( const TextViewProcessor::CharacterLayoutInfo& character1,
+ const TextViewProcessor::CharacterLayoutInfo& character2 )
+{
+ if( !TestEqual( character1.mHeight, character2.mHeight ) )
+ {
+ return false;
+ }
+ if( !TestEqual( character1.mAdvance, character2.mAdvance ) )
+ {
+ return false;
+ }
+ if( !TestEqual( character1.mBearing, character2.mBearing ) )
+ {
+ return false;
+ }
+
+ if( !TestEqual( character1.mPosition.x, character2.mPosition.x ) )
+ {
+ return false;
+ }
+ if( !TestEqual( character1.mPosition.y, character2.mPosition.y ) )
+ {
+ return false;
+ }
+
+ if( !TestEqual( character1.mSize.x, character2.mSize.x ) )
+ {
+ return false;
+ }
+ if( !TestEqual( character1.mSize.y, character2.mSize.y ) )
+ {
+ return false;
+ }
+
+ if( !TestEqual( character1.mAscender, character2.mAscender ) )
+ {
+ return false;
+ }
+
+ if( character1.mTextActor && !character2.mTextActor )
+ {
+ return false;
+ }
+
+ if( !character1.mTextActor && character2.mTextActor )
+ {
+ return false;
+ }
+
+ std::string text1;
+ std::string text2;
+ TextStyle style1;
+ TextStyle style2;
+
+ if( character1.mTextActor )
+ {
+ text1 = character1.mTextActor.GetText();
+ style1 = character1.mTextActor.GetTextStyle();
+
+ text2 = character2.mTextActor.GetText();
+ style2 = character2.mTextActor.GetTextStyle();
+ }
+
+ if( text1 != text2 )
+ {
+ return false;
+ }
+
+ if( style1 != style2 )
+ {
+ return false;
+ }
+
+ text1 = character1.mStyledText.mText.GetText();
+ style1 = character1.mStyledText.mStyle;
+
+ text2 = character2.mStyledText.mText.GetText();
+ style2 = character2.mStyledText.mStyle;
+
+ if( text1 != text2 )
+ {
+ return false;
+ }
+
+ if( style1 != style2 )
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool TestEqual( const TextViewProcessor::WordLayoutInfo& word1,
+ const TextViewProcessor::WordLayoutInfo& word2 )
+{
+ if( !TestEqual( word1.mSize.x, word2.mSize.x ) )
+ {
+ return false;
+ }
+ if( !TestEqual( word1.mSize.y, word2.mSize.y ) )
+ {
+ return false;
+ }
+
+ if( !TestEqual( word1.mAscender, word2.mAscender ) )
+ {
+ return false;
+ }
+
+ if( word1.mType != word2.mType )
+ {
+ return false;
+ }
+
+ if( word1.mCharactersLayoutInfo.size() != word2.mCharactersLayoutInfo.size() )
+ {
+ return false;
+ }
+
+ for( TextViewProcessor::CharacterLayoutInfoContainer::const_iterator it1 = word1.mCharactersLayoutInfo.begin(), endIt1 = word1.mCharactersLayoutInfo.end(),
+ it2 = word2.mCharactersLayoutInfo.begin(), endIt2 = word2.mCharactersLayoutInfo.end();
+ ( it1 != endIt1 ) && ( it2 != endIt2 );
+ ++it1, ++it2 )
+ {
+ if( !TestEqual( *it1, *it2 ) )
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool TestEqual( const TextViewProcessor::WordGroupLayoutInfo& group1,
+ const TextViewProcessor::WordGroupLayoutInfo& group2 )
+{
+
+ if( group1.mNumberOfCharacters != group2.mNumberOfCharacters )
+ {
+ return false;
+ }
+
+ if( group1.mWordsLayoutInfo.size() != group2.mWordsLayoutInfo.size() )
+ {
+ return false;
+ }
+
+ if( !TestEqual( group1.mSize.x, group2.mSize.x ) )
+ {
+ return false;
+ }
+ if( !TestEqual( group1.mSize.y, group2.mSize.y ) )
+ {
+ return false;
+ }
+
+ if( !TestEqual( group1.mAscender, group2.mAscender ) )
+ {
+ return false;
+ }
+
+ if( group1.mDirection != group2.mDirection )
+ {
+ return false;
+ }
+
+ for( TextViewProcessor::WordLayoutInfoContainer::const_iterator it1 = group1.mWordsLayoutInfo.begin(), endIt1 = group1.mWordsLayoutInfo.end(),
+ it2 = group2.mWordsLayoutInfo.begin(), endIt2 = group2.mWordsLayoutInfo.end();
+ ( it1 != endIt1 ) && ( it2 != endIt2 );
+ ++it1, ++it2 )
+ {
+ if( !TestEqual( *it1, *it2 ) )
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool TestEqual( const TextViewProcessor::LineLayoutInfo& line1,
+ const TextViewProcessor::LineLayoutInfo& line2 )
+{
+ if( !TestEqual( line1.mSize.x, line2.mSize.x ) )
+ {
+ return false;
+ }
+ if( !TestEqual( line1.mSize.y, line2.mSize.y ) )
+ {
+ return false;
+ }
+
+ if( !TestEqual( line1.mAscender, line2.mAscender ) )
+ {
+ return false;
+ }
+
+ if( line1.mNumberOfCharacters != line2.mNumberOfCharacters )
+ {
+ return false;
+ }
+
+ if( line1.mWordGroupsLayoutInfo.size() != line2.mWordGroupsLayoutInfo.size() )
+ {
+ return false;
+ }
+
+ for( TextViewProcessor::WordGroupLayoutInfoContainer::const_iterator it1 = line1.mWordGroupsLayoutInfo.begin(), endIt1 = line1.mWordGroupsLayoutInfo.end(),
+ it2 = line2.mWordGroupsLayoutInfo.begin(), endIt2 = line2.mWordGroupsLayoutInfo.end();
+ ( it1 != endIt1 ) && ( it2 != endIt2 );
+ ++it1, ++it2 )
+ {
+ if( !TestEqual( *it1, *it2 ) )
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool TestEqual( const TextViewProcessor::TextLayoutInfo& text1,
+ const TextViewProcessor::TextLayoutInfo& text2 )
+{
+ if( !TestEqual( text1.mWholeTextSize.x, text2.mWholeTextSize.x ) )
+ {
+ return false;
+ }
+ if( !TestEqual( text1.mWholeTextSize.y, text2.mWholeTextSize.y ) )
+ {
+ return false;
+ }
+
+ if( !TestEqual( text1.mMaxWordWidth, text2.mMaxWordWidth ) )
+ {
+ return false;
+ }
+
+ if( text1.mNumberOfCharacters != text2.mNumberOfCharacters )
+ {
+ return false;
+ }
+
+ if( text1.mLinesLayoutInfo.size() != text2.mLinesLayoutInfo.size() )
+ {
+ return false;
+ }
+
+ for( TextViewProcessor::LineLayoutInfoContainer::const_iterator it1 = text1.mLinesLayoutInfo.begin(), endIt1 = text1.mLinesLayoutInfo.end(),
+ it2 = text2.mLinesLayoutInfo.begin(), endIt2 = text2.mLinesLayoutInfo.end();
+ ( it1 != endIt1 ) && ( it2 != endIt2 );
+ ++it1, ++it2 )
+ {
+ if( !TestEqual( *it1, *it2 ) )
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+/**
+ * Splits the \e input word in two by the given \e position and checks the results with \e firstResult and \e lastResult.
+ *
+ * If the test fails it prints a short description and the line where this function was called.
+ *
+ * @param description Short description of the experiment. i.e. "Split the word from the beginning. (position 0)".
+ * @param input The input word.
+ * @param position Where to split the word.
+ * @param firstResult First part of the split word.
+ * @param lastResult Last part of the split word.
+ * @param location Where this function has been called.
+ *
+ * @return \e true if the experiment is successful. Otherwise returns \e false.
+ */
+bool TestSplitWord( const std::string& description, const std::string& input, const size_t position, const std::string& firstResult, const std::string& lastResult, const char* location )
+{
+ tet_printf( "%s", description.c_str() );
+
+ // Create layout info for the input word.
+ Toolkit::Internal::TextView::RelayoutData relayoutData;
+ TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( input, inputStyledText );
+
+ TextViewProcessor::CreateTextInfo( inputStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData );
+
+ // Get the input word
+ TextViewProcessor::WordLayoutInfo inputWordLayout;
+
+ if( !inputLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
+ if( !group.mWordsLayoutInfo.empty() )
+ {
+ inputWordLayout = *( *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+ }
+ }
+ }
+
+ // Create layout info for the first part of the result (after split the word)
+
+ Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
+ TextViewProcessor::TextLayoutInfo& firstResultLayout( firstRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray firstResultStyledText;
+ MarkupProcessor::GetStyledTextArray( firstResult, firstResultStyledText );
+
+ TextViewProcessor::CreateTextInfo( firstResultStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ firstRelayoutData );
+
+ // Get the first result word
+ TextViewProcessor::WordLayoutInfo firstResultWordLayout;
+
+ if( !firstResultLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *firstResultLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
+ if( !group.mWordsLayoutInfo.empty() )
+ {
+ firstResultWordLayout = *( *( *firstResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+ }
+ }
+ }
+
+ // Create layout info for the last part of the result (after split the word)
+
+ Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
+ TextViewProcessor::TextLayoutInfo& lastResultLayout( lastRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray lastResultStyledText;
+ MarkupProcessor::GetStyledTextArray( lastResult, lastResultStyledText );
+
+ TextViewProcessor::CreateTextInfo( lastResultStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ lastRelayoutData );
+
+ // Get the last result word
+ TextViewProcessor::WordLayoutInfo lastResultWordLayout;
+
+ if( !lastResultLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *lastResultLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
+ if( !group.mWordsLayoutInfo.empty() )
+ {
+ lastResultWordLayout = *( *( *lastResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+ }
+ }
+ }
+
+ // Split the word.
+
+ TextViewProcessor::WordLayoutInfo lastWordLayoutInfo;
+
+ SplitWord( position,
+ inputWordLayout,
+ lastWordLayoutInfo );
+
+ // Test results
+ if( !TestEqual( inputWordLayout, firstResultWordLayout ) )
+ {
+ tet_printf( "Fail. different layout info. %s", location );
+ return false;
+ }
+
+ if( !TestEqual( lastWordLayoutInfo, lastResultWordLayout ) )
+ {
+ tet_printf( "Fail. different layout info. %s", location );
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Splits the \e input group of words in two by the given \e wordPosition and \e position and checks the results with \e firstResult and \e lastResult.
+ *
+ * If the test fails it prints a short description and the line where this function was called.
+ *
+ * @param description Short description of the experiment. i.e. "Split the group of words from the beginning. (wordPosition 0 and position 0)".
+ * @param input The input word.
+ * @param wordPosition Index to the word within the group where to split the group.
+ * @param position Where to split the word.
+ * @param firstResult First part of the split group of words.
+ * @param lastResult Last part of the split group of words.
+ * @param location Where this function has been called.
+ *
+ * @return \e true if the experiment is successful. Otherwise returns \e false.
+ */
+bool TestSplitWordGroup( const std::string& description,
+ const std::string& input,
+ const size_t wordPosition,
+ const size_t position,
+ const std::string& firstResult,
+ const std::string& lastResult,
+ const char* location )
+{
+ tet_printf( "%s", description.c_str() );
+
+ // Create layout info for the input group of words.
+ Toolkit::Internal::TextView::RelayoutData relayoutData;
+ TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( input, inputStyledText );
+
+ TextViewProcessor::CreateTextInfo( inputStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData );
+
+ // Get the input group of words
+ TextViewProcessor::WordGroupLayoutInfo inputWordGroupLayout;
+
+ if( !inputLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ inputWordGroupLayout = *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+ }
+ }
+
+ // Create layout info for the first part of the result (after split the group of words)
+
+ Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
+ TextViewProcessor::TextLayoutInfo& firstResultLayout( firstRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray firstResultStyledText;
+ MarkupProcessor::GetStyledTextArray( firstResult, firstResultStyledText );
+
+ TextViewProcessor::CreateTextInfo( firstResultStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ firstRelayoutData );
+
+ // Get the first result group of words
+ TextViewProcessor::WordGroupLayoutInfo firstResultWordGroupLayout;
+
+ if( !firstResultLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *firstResultLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ firstResultWordGroupLayout = *( *firstResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+ }
+ }
+
+ // Create layout info for the last part of the result (after split the group of words)
+
+ Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
+ TextViewProcessor::TextLayoutInfo& lastResultLayout( lastRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray lastResultStyledText;
+ MarkupProcessor::GetStyledTextArray( lastResult, lastResultStyledText );
+
+ TextViewProcessor::CreateTextInfo( lastResultStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ lastRelayoutData );
+
+ // Get the last result group of words
+ TextViewProcessor::WordGroupLayoutInfo lastResultWordGroupLayout;
+
+ if( !lastResultLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *lastResultLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ lastResultWordGroupLayout = *( *lastResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+ }
+ }
+
+ // Split the group of words.
+
+ TextViewProcessor::WordGroupLayoutInfo lastWordGroupLayoutInfo;
+
+ TextViewProcessor::TextInfoIndices indices( 0, 0, wordPosition, position );
+ SplitWordGroup( indices,
+ inputWordGroupLayout,
+ lastWordGroupLayoutInfo );
+
+ // Test results
+ if( !TestEqual( inputWordGroupLayout, firstResultWordGroupLayout ) )
+ {
+ tet_printf( "Fail. different layout info. %s", location );
+ return false;
+ }
+
+ if( !TestEqual( lastWordGroupLayoutInfo, lastResultWordGroupLayout ) )
+ {
+ tet_printf( "Fail. different layout info. %s", location );
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Splits the \e input line in two by the given \e groupPosition, \e wordPosition and \e position and checks the results with \e firstResult and \e lastResult.
+ *
+ * If the test fails it prints a short description and the line where this function was called.
+ *
+ * @param description Short description of the experiment. i.e. "Split the line from the beginning. (groupPosition 0, wordPosition 0 and position 0)".
+ * @param input The input word.
+ * @param groupPosition Index to the group of words within the line where to split the line.
+ * @param wordPosition Index to the word within the group where to split the group.
+ * @param position Where to split the word.
+ * @param lineHeightOffset Offset between lines.
+ * @param firstResult First part of the split line.
+ * @param lastResult Last part of the split line.
+ * @param location Where this function has been called.
+ *
+ * @return \e true if the experiment is successful. Otherwise returns \e false.
+ */
+bool TestSplitLine( const std::string& description,
+ const std::string& input,
+ const size_t groupPosition,
+ const size_t wordPosition,
+ const size_t position,
+ const float lineHeightOffset,
+ const std::string& firstResult,
+ const std::string& lastResult,
+ const char* location )
+{
+ tet_printf( "%s", description.c_str() );
+
+ // Create layout info for the input line.
+ Toolkit::Internal::TextView::RelayoutData relayoutData;
+ TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( input, inputStyledText );
+
+ TextViewProcessor::CreateTextInfo( inputStyledText,
+ Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
+ Toolkit::TextView::Original,
+ Toolkit::TextView::Original,
+ static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
+ Toolkit::TextView::Center,
+ PointSize( lineHeightOffset ),
+ std::string( "..." ) ),
+ relayoutData );
+
+ // Get the input line
+ TextViewProcessor::LineLayoutInfo inputLineLayout;
+
+ if( !inputLayout.mLinesLayoutInfo.empty() )
+ {
+ inputLineLayout = *inputLayout.mLinesLayoutInfo.begin();
+ }
+
+ // Create layout info for the first part of the result (after split the line)
+
+ Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
+ TextViewProcessor::TextLayoutInfo& firstResultLayout( firstRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray firstResultStyledText;
+ MarkupProcessor::GetStyledTextArray( firstResult, firstResultStyledText );
+
+ TextViewProcessor::CreateTextInfo( firstResultStyledText,
+ Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
+ Toolkit::TextView::Original,
+ Toolkit::TextView::Original,
+ static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
+ Toolkit::TextView::Center,
+ PointSize( lineHeightOffset ),
+ std::string( "..." ) ),
+ firstRelayoutData );
+
+ // Get the first result line
+ TextViewProcessor::LineLayoutInfo firstResultLineLayout;
+
+ if( !firstResultLayout.mLinesLayoutInfo.empty() )
+ {
+ firstResultLineLayout = *firstResultLayout.mLinesLayoutInfo.begin();
+ }
+
+ // Create layout info for the last part of the result (after split the line)
+
+ Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
+ TextViewProcessor::TextLayoutInfo& lastResultLayout( lastRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray lastResultStyledText;
+ MarkupProcessor::GetStyledTextArray( lastResult, lastResultStyledText );
+
+ TextViewProcessor::CreateTextInfo( lastResultStyledText,
+ Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
+ Toolkit::TextView::Original,
+ Toolkit::TextView::Original,
+ static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
+ Toolkit::TextView::Center,
+ PointSize( lineHeightOffset ),
+ std::string( "..." ) ),
+ lastRelayoutData );
+
+ // Get the last result line
+ TextViewProcessor::LineLayoutInfo lastResultLineLayout;
+
+ if( !lastResultLayout.mLinesLayoutInfo.empty() )
+ {
+ lastResultLineLayout = *lastResultLayout.mLinesLayoutInfo.begin();
+ }
+
+ // Split the line.
+
+ TextViewProcessor::LineLayoutInfo lastLineLayoutInfo;
+
+ TextViewProcessor::TextInfoIndices indices( 0, groupPosition, wordPosition, position );
+ SplitLine( indices,
+ PointSize( lineHeightOffset ),
+ inputLineLayout,
+ lastLineLayoutInfo );
+
+ // Test results
+ if( !TestEqual( inputLineLayout, firstResultLineLayout ) )
+ {
+ tet_printf( "Fail. different layout info. %s", location );
+ return false;
+ }
+
+ if( !TestEqual( lastLineLayoutInfo, lastResultLineLayout ) )
+ {
+ tet_printf( "Fail. different layout info. %s", location );
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Merges the \e inputFirst word and the \e inputLast word, and checks the results with \e result.
+ *
+ * If the test fails it prints a short description and the line where this function was called.
+ *
+ * @param description Short description of the experiment. i.e. "Merge two words with same style".
+ * @param inputFirst The first part of the word.
+ * @param inputLast The last part of the word.
+ * @param result The merged word.
+ * @param location Where this function has been called.
+ *
+ * @return \e true if the experiment is successful. Otherwise returns \e false.
+ */
+bool TestMergeWords( const std::string& description, const std::string& inputFirst, const std::string& inputLast, const std::string& result, const char* location )
+{
+ tet_printf( "%s", description.c_str() );
+
+ // Create layout info for the inputFirst word.
+ Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
+ TextViewProcessor::TextLayoutInfo& inputFirstLayout( firstRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray inputFirstStyledText;
+ MarkupProcessor::GetStyledTextArray( inputFirst, inputFirstStyledText );
+
+ TextViewProcessor::CreateTextInfo( inputFirstStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ firstRelayoutData );
+
+ // Get the input word
+ TextViewProcessor::WordLayoutInfo inputFirstWordLayout;
+
+ if( !inputFirstLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *inputFirstLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
+ if( !group.mWordsLayoutInfo.empty() )
+ {
+ inputFirstWordLayout = *( *( *inputFirstLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+ }
+ }
+ }
+
+ // Create layout info for the inputLast word.
+ Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
+ TextViewProcessor::TextLayoutInfo& inputLastLayout( lastRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray inputLastStyledText;
+ MarkupProcessor::GetStyledTextArray( inputLast, inputLastStyledText );
+
+ TextViewProcessor::CreateTextInfo( inputLastStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ lastRelayoutData );
+
+ // Get the input word
+ TextViewProcessor::WordLayoutInfo inputLastWordLayout;
+
+ if( !inputLastLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *inputLastLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
+ if( !group.mWordsLayoutInfo.empty() )
+ {
+ inputLastWordLayout = *( *( *inputLastLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+ }
+ }
+ }
+
+ // Create layout info for the result word.
+ Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
+ TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray resultStyledText;
+ MarkupProcessor::GetStyledTextArray( result, resultStyledText );
+
+ TextViewProcessor::CreateTextInfo( resultStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ resultRelayoutData );
+
+ // Get the result word
+ TextViewProcessor::WordLayoutInfo resultWordLayout;
+
+ if( !resultLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
+ if( !group.mWordsLayoutInfo.empty() )
+ {
+ resultWordLayout = *( *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+ }
+ }
+ }
+
+ MergeWord( inputFirstWordLayout,
+ inputLastWordLayout );
+
+ if( !TestEqual( inputFirstWordLayout, resultWordLayout ) )
+ {
+ tet_printf( "Fail. different layout info. %s", location );
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Merges the \e inputFirst group of words and the \e inputLast group of words, and checks the results with \e result.
+ *
+ * If the test fails it prints a short description and the line where this function was called.
+ *
+ * @param description Short description of the experiment.
+ * @param inputFirst The first part of the group of words.
+ * @param inputLast The last part of the group of words.
+ * @param result The merged group of word.
+ * @param location Where this function has been called.
+ *
+ * @return \e true if the experiment is successful. Otherwise returns \e false.
+ */
+bool TestMergeGroupsOfWords( const std::string& description, const std::string& inputFirst, const std::string& inputLast, const std::string& result, const char* location )
+{
+ tet_printf( "%s", description.c_str() );
+
+ // Create layout info for the inputFirst group of word.
+ Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
+ TextViewProcessor::TextLayoutInfo& inputFirstLayout( firstRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray inputFirstStyledText;
+ MarkupProcessor::GetStyledTextArray( inputFirst, inputFirstStyledText );
+
+ TextViewProcessor::CreateTextInfo( inputFirstStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ firstRelayoutData );
+
+ // Get the input group of words.
+ TextViewProcessor::WordGroupLayoutInfo inputFirstWordGroupLayout;
+
+ if( !inputFirstLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *inputFirstLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ inputFirstWordGroupLayout = *( *inputFirstLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+ }
+ }
+
+ // Create layout info for the inputLast group of words.
+ Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
+ TextViewProcessor::TextLayoutInfo& inputLastLayout( lastRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray inputLastStyledText;
+ MarkupProcessor::GetStyledTextArray( inputLast, inputLastStyledText );
+
+ TextViewProcessor::CreateTextInfo( inputLastStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ lastRelayoutData );
+
+ // Get the input group of words
+ TextViewProcessor::WordGroupLayoutInfo inputLastWordGroupLayout;
+
+ if( !inputLastLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *inputLastLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ inputLastWordGroupLayout = *( *inputLastLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+ }
+ }
+
+ // Create layout info for the result group of words.
+ Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
+ TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray resultStyledText;
+ MarkupProcessor::GetStyledTextArray( result, resultStyledText );
+
+ TextViewProcessor::CreateTextInfo( resultStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ resultRelayoutData );
+
+ // Get the result word
+ TextViewProcessor::WordGroupLayoutInfo resultWordGroupLayout;
+
+ if( !resultLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ resultWordGroupLayout = *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+ }
+ }
+
+ MergeWordGroup( inputFirstWordGroupLayout,
+ inputLastWordGroupLayout );
+
+ if( !TestEqual( inputFirstWordGroupLayout, resultWordGroupLayout ) )
+ {
+ tet_printf( "Fail. different layout info. %s", location );
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Merges the \e inputFirst line and the \e inputLast line, and checks the results with \e result.
+ *
+ * If the test fails it prints a short description and the line where this function was called.
+ *
+ * @param description Short description of the experiment.
+ * @param inputFirst The first part of the line.
+ * @param inputLast The last part of the line.
+ * @param lineHeightOffset Offset between lines.
+ * @param result The merged line.
+ * @param location Where this function has been called.
+ *
+ * @return \e true if the experiment is successful. Otherwise returns \e false.
+ */
+bool TestMergeLines( const std::string& description, const std::string& inputFirst, const std::string& inputLast, const float lineHeightOffset, const std::string& result, const char* location )
+{
+ tet_printf( "%s", description.c_str() );
+
+ // Create layout info for the inputFirst line.
+ Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
+ TextViewProcessor::TextLayoutInfo& inputFirstLayout( firstRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray inputFirstStyledText;
+ MarkupProcessor::GetStyledTextArray( inputFirst, inputFirstStyledText );
+
+ TextViewProcessor::CreateTextInfo( inputFirstStyledText,
+ Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
+ Toolkit::TextView::Original,
+ Toolkit::TextView::Original,
+ static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
+ Toolkit::TextView::Center,
+ PointSize( lineHeightOffset ),
+ std::string( "..." ) ),
+ firstRelayoutData );
+
+ // Get the input word
+ TextViewProcessor::LineLayoutInfo inputFirstLineLayout;
+
+ if( !inputFirstLayout.mLinesLayoutInfo.empty() )
+ {
+ inputFirstLineLayout = *inputFirstLayout.mLinesLayoutInfo.begin();
+ }
+
+ // Create layout info for the inputLast line.
+ Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
+ TextViewProcessor::TextLayoutInfo& inputLastLayout( lastRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray inputLastStyledText;
+ MarkupProcessor::GetStyledTextArray( inputLast, inputLastStyledText );
+
+ TextViewProcessor::CreateTextInfo( inputLastStyledText,
+ Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
+ Toolkit::TextView::Original,
+ Toolkit::TextView::Original,
+ static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
+ Toolkit::TextView::Center,
+ PointSize( lineHeightOffset ),
+ std::string( "..." ) ),
+ lastRelayoutData );
+
+ // Get the input word
+ TextViewProcessor::LineLayoutInfo inputLastLineLayout;
+
+ if( !inputLastLayout.mLinesLayoutInfo.empty() )
+ {
+ inputLastLineLayout = *inputLastLayout.mLinesLayoutInfo.begin();
+ }
+
+ // Create layout info for the result word.
+ Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
+ TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray resultStyledText;
+ MarkupProcessor::GetStyledTextArray( result, resultStyledText );
+
+ TextViewProcessor::CreateTextInfo( resultStyledText,
+ Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
+ Toolkit::TextView::Original,
+ Toolkit::TextView::Original,
+ static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
+ Toolkit::TextView::Center,
+ PointSize( lineHeightOffset ),
+ std::string( "..." ) ),
+ resultRelayoutData );
+
+ // Get the result word
+ TextViewProcessor::LineLayoutInfo resultLineLayout;
+
+ if( !resultLayout.mLinesLayoutInfo.empty() )
+ {
+ resultLineLayout = *resultLayout.mLinesLayoutInfo.begin();
+ }
+
+ MergeLine( inputFirstLineLayout,
+ inputLastLineLayout );
+
+ if( !TestEqual( inputFirstLineLayout, resultLineLayout ) )
+ {
+ tet_printf( "Fail. different layout info. %s", location );
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Removes from the \e input word the \e numberOfCharacters characters starting from the given \e position and checks the results with \e result.
+ *
+ * If the test fails it prints a short description and the line where this function was called.
+ *
+ * @param description Short description of the experiment. i.e. "Remove a whole group of characters. Merge".
+ * @param input The input word.
+ * @param position Where to start to remove characters
+ * @param numberOfCharacters The number of characters to remove.
+ * @param result The word without the removed characters.
+ * @param location Where this function has been called.
+ *
+ * @return \e true if the experiment is successful. Otherwise returns \e false.
+ */
+bool TestRemoveCharactersFromWord( const std::string& description, const std::string& input, const std::size_t position, const std::size_t numberOfCharacters, const std::string& result, const char* location )
+{
+ tet_printf( "%s", description.c_str() );
+
+ // Create layout info for the input word.
+ Toolkit::Internal::TextView::RelayoutData relayoutData;
+ TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( input, inputStyledText );
+
+ TextViewProcessor::CreateTextInfo( inputStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData );
+
+ // Get the input word
+ TextViewProcessor::WordLayoutInfo inputWordLayout;
+
+ if( !inputLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
+ if( !group.mWordsLayoutInfo.empty() )
+ {
+ inputWordLayout = *( *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+ }
+ }
+ }
+
+ // Create layout info for the result word.
+ Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
+ TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray resultStyledText;
+ MarkupProcessor::GetStyledTextArray( result, resultStyledText );
+
+ TextViewProcessor::CreateTextInfo( resultStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ resultRelayoutData );
+
+ // Get the result word
+ TextViewProcessor::WordLayoutInfo resultWordLayout;
+
+ if( !resultLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
+ if( !group.mWordsLayoutInfo.empty() )
+ {
+ resultWordLayout = *( *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+ }
+ }
+ }
+
+ RemoveCharactersFromWord( position,
+ numberOfCharacters,
+ inputWordLayout );
+
+ if( !TestEqual( inputWordLayout, resultWordLayout ) )
+ {
+ tet_printf( "Fail. different layout info. %s", location );
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Removes from the \e input group of words the \e numberOfWords words starting from the given \e wordIndex and checks the results with \e result.
+ *
+ * If the test fails it prints a short description and the line where this function was called.
+ *
+ * @param description Short description of the experiment.
+ * @param input The input group of words.
+ * @param wordIndex Where to start to remove words.
+ * @param numberOfWords The number of words to remove.
+ * @param result The group of words without the removed words.
+ * @param location Where this function has been called.
+ *
+ * @return \e true if the experiment is successful. Otherwise returns \e false.
+ */
+bool TestRemoveWordsFromGroup( const std::string& description, const std::string& input, const std::size_t wordIndex, const std::size_t numberOfWords, const std::string& result, const char* location )
+{
+ tet_printf( "%s", description.c_str() );
+
+ // Create layout info for the input group of words.
+ Toolkit::Internal::TextView::RelayoutData relayoutData;
+ TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( input, inputStyledText );
+
+ TextViewProcessor::CreateTextInfo( inputStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData );
+
+ // Get the input group of words
+ TextViewProcessor::WordGroupLayoutInfo inputWordGroupLayout;
+
+ if( !inputLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ inputWordGroupLayout = *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+ }
+ }
+
+ // Create layout info for the result group of words.
+ Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
+ TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray resultStyledText;
+ MarkupProcessor::GetStyledTextArray( result, resultStyledText );
+
+ TextViewProcessor::CreateTextInfo( resultStyledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ resultRelayoutData );
+
+ // Get the result group of words.
+ TextViewProcessor::WordGroupLayoutInfo resultWordGroupLayout;
+
+ if( !resultLayout.mLinesLayoutInfo.empty() )
+ {
+ const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() );
+ if( !line.mWordGroupsLayoutInfo.empty() )
+ {
+ resultWordGroupLayout = *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+ }
+ }
+
+ RemoveWordsFromWordGroup( wordIndex,
+ numberOfWords,
+ inputWordGroupLayout );
+
+ if( !TestEqual( inputWordGroupLayout, resultWordGroupLayout ) )
+ {
+ tet_printf( "Fail. different layout info. %s", location );
+ return false;
+ }
+
+ return true;
+}
+
+
+/**
+ * Removes from the \e input line the \e numberOfGroups groups of words starting from the given \e groupIndex and checks the results with \e result.
+ *
+ * If the test fails it prints a short description and the line where this function was called.
+ *
+ * @param description Short description of the experiment.
+ * @param input The input line.
+ * @param groupIndex Where to start to remove groups of words
+ * @param numberOfGroups The number of groups of words to remove.
+ * @param lineHeightOffset Offset between lines.
+ * @param result The line without the removed groups of words.
+ * @param location Where this function has been called.
+ *
+ * @return \e true if the experiment is successful. Otherwise returns \e false.
+ */
+bool TestRemoveGroupsFromLine( const std::string& description, const std::string& input, const std::size_t groupIndex, const std::size_t numberOfGroups, const float lineHeightOffset, const std::string& result, const char* location )
+{
+ tet_printf( "%s", description.c_str() );
+
+ // Create layout info for the input line.
+ Toolkit::Internal::TextView::RelayoutData relayoutData;
+ TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( input, inputStyledText );
+
+ TextViewProcessor::CreateTextInfo( inputStyledText,
+ Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
+ Toolkit::TextView::Original,
+ Toolkit::TextView::Original,
+ static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
+ Toolkit::TextView::Center,
+ PointSize( lineHeightOffset ),
+ std::string( "..." ) ),
+ relayoutData );
+
+ // Get the input line
+ TextViewProcessor::LineLayoutInfo inputLineLayout;
+
+ if( !inputLayout.mLinesLayoutInfo.empty() )
+ {
+ inputLineLayout = *inputLayout.mLinesLayoutInfo.begin();
+ }
+
+ // Create layout info for the result line.
+ Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
+ TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray resultStyledText;
+ MarkupProcessor::GetStyledTextArray( result, resultStyledText );
+
+ TextViewProcessor::CreateTextInfo( resultStyledText,
+ Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
+ Toolkit::TextView::Original,
+ Toolkit::TextView::Original,
+ static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
+ Toolkit::TextView::Center,
+ PointSize( lineHeightOffset ),
+ std::string( "..." ) ),
+ resultRelayoutData );
+
+ // Get the result line
+ TextViewProcessor::LineLayoutInfo resultLineLayout;
+
+ if( !resultLayout.mLinesLayoutInfo.empty() )
+ {
+ resultLineLayout = *resultLayout.mLinesLayoutInfo.begin();
+ }
+
+ RemoveWordGroupsFromLine( groupIndex,
+ numberOfGroups,
+ PointSize( lineHeightOffset ),
+ inputLineLayout );
+
+ if( !TestEqual( inputLineLayout, resultLineLayout ) )
+ {
+ tet_printf( "Fail. different layout info. %s", location );
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Tests inserts, removes and updates operation in the given \e input text and checks with the given \e result.
+ *
+ * If the test fails it prints a short description and the line where this function was called.
+ *
+ * @param description Short description of the experiment.
+ * @param operation Type of update operation (insert, remove, replace)
+ * @param input The input text.
+ * @param position Where to insert, remove or replace text.
+ * @param numberOfCharacters Number of characters to remove or replace.
+ * @param inputText Inserted or updated text.
+ * @param lineHeightOffset Offset between lines.
+ * @param result Expected result.
+ * @param location Where this function has been called.
+ *
+ * @return \e true if the experiment is successful. Otherwise returns \e false.
+ */
+bool TestUpdateTextInfo( const std::string& description,
+ const UpdateTextInfoOperation operation,
+ const std::string& input,
+ const std::size_t position,
+ const std::size_t numberOfCharacters,
+ const std::string& inputText,
+ const float lineHeightOffset,
+ const std::string& result,
+ const char* location )
+{
+ tet_printf( "%s", description.c_str() );
+
+ // Create layout info for the input.
+ Toolkit::Internal::TextView::RelayoutData relayoutData;
+ TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( input, inputStyledText );
+
+ TextViewProcessor::CreateTextInfo( inputStyledText,
+ Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
+ Toolkit::TextView::Original,
+ Toolkit::TextView::Original,
+ static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
+ Toolkit::TextView::Center,
+ PointSize( lineHeightOffset ),
+ std::string( "..." ) ),
+ relayoutData );
+
+ // Create layout info for the result.
+ Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
+ TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
+
+ MarkupProcessor::StyledTextArray resultStyledText;
+ MarkupProcessor::GetStyledTextArray( result, resultStyledText );
+
+ TextViewProcessor::CreateTextInfo( resultStyledText,
+ Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
+ Toolkit::TextView::Original,
+ Toolkit::TextView::Original,
+ static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
+ Toolkit::TextView::Center,
+ PointSize( lineHeightOffset ),
+ std::string( "..." ) ),
+ resultRelayoutData );
+
+ // Choose operation and call appropiate UpdateTextInfo() method.
+ const Toolkit::Internal::TextView::LayoutParameters layoutParameters( Toolkit::TextView::SplitByNewLineChar,
+ Toolkit::TextView::Original,
+ Toolkit::TextView::Original,
+ static_cast( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
+ Toolkit::TextView::Center,
+ PointSize( lineHeightOffset ),
+ std::string( "..." ) );
+
+ switch( operation )
+ {
+ case Insert:
+ {
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( inputText, inputStyledText );
+
+ TextViewProcessor::UpdateTextInfo( position,
+ inputStyledText,
+ layoutParameters,
+ relayoutData );
+ break;
+ }
+ case Remove:
+ {
+ TextViewProcessor::UpdateTextInfo( position,
+ numberOfCharacters,
+ layoutParameters,
+ relayoutData,
+ TextViewProcessor::CLEAR_TEXT );
+ break;
+ }
+ case Replace:
+ {
+ MarkupProcessor::StyledTextArray inputStyledText;
+ MarkupProcessor::GetStyledTextArray( inputText, inputStyledText );
+
+ TextViewProcessor::UpdateTextInfo( position,
+ numberOfCharacters,
+ inputStyledText,
+ layoutParameters,
+ relayoutData );
+ break;
+ }
+ default:
+ {
+ tet_printf( "TestUpdateTextInfo: unknown update operation. %s", location );
+ return false;
+ }
+ }
+
+ if( !TestEqual( inputLayout, resultLayout ) )
+ {
+ tet_printf( "Fail. different layout info. %s", location );
+
+ std::cout << " result : "; Print( inputLayout );
+ std::cout << " expected result : "; Print( resultLayout );
+ return false;
+ }
+
+ return true;
+}
+
+} // namespace
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( UtcDaliTextViewCreateTextInfo, POSITIVE_TC_IDX ); // Tests data structures are built well.
+TEST_FUNCTION( UtcDaliTextViewUpdateTextInfo, POSITIVE_TC_IDX ); // Tests update operations within a whole text (insert, remove, replace).
+TEST_FUNCTION( UtcDaliTextViewSplitWord, POSITIVE_TC_IDX ); // Tests the split word operation.
+TEST_FUNCTION( UtcDaliTextViewSplitWordGroup, POSITIVE_TC_IDX ); // Tests the split group of words operation.
+TEST_FUNCTION( UtcDaliTextViewSplitLine, POSITIVE_TC_IDX ); // Tests the split line operation.
+TEST_FUNCTION( UtcDaliTextViewMergeWord01, POSITIVE_TC_IDX ); // Tests the merge word operation.
+TEST_FUNCTION( UtcDaliTextViewMergeWord02, NEGATIVE_TC_IDX ); // Tests invalid inputs in the merge word operation.
+TEST_FUNCTION( UtcDaliTextViewMergeGroup01, POSITIVE_TC_IDX ); // Tests the merge group of words operation.
+TEST_FUNCTION( UtcDaliTextViewMergeGroup02, NEGATIVE_TC_IDX ); // Tests invalid inputs in the merge group of words operation.
+TEST_FUNCTION( UtcDaliTextViewMergeLine01, POSITIVE_TC_IDX ); // Tests the merge line operation.
+TEST_FUNCTION( UtcDaliTextViewMergeLine02, NEGATIVE_TC_IDX ); // Tests invalid inputs in the merge line operation.
+TEST_FUNCTION( UtcDaliTextViewRemoveCharactersFromWord, POSITIVE_TC_IDX ); // Tests the remove characters from a word operation.
+TEST_FUNCTION( UtcDaliTextViewRemoveWordsFromGroup, POSITIVE_TC_IDX ); // Tests the remove words from a group of words operation.
+TEST_FUNCTION( UtcDaliTextViewRemoveGroupsFromLine, POSITIVE_TC_IDX ); // Tests the remove groups of words from a line operation.
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliTextViewCreateTextInfo()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewCreateTextInfo : ");
+
+ // Metrics for characters
+
+ // Font size = 10
+ // size : [9.48351, 9.48351]
+ // advance : 9.48351
+ // bearing : 8.53516
+ // ascender : 8.53516
+
+ // Font size = 12
+ // size : [11.3802, 11.3802]
+ // advance : 11.3802
+ // bearing : 10.2422
+ // ascender : 10.2422
+
+ // Font size = 14
+ // size : [13.2769, 13.2769]
+ // advance : 13.2769
+ // bearing : 11.9492
+ // ascender : 11.9492
+
+ const float WIDTH_10( 9.48351f );
+ const float HEIGHT_10( 9.48351f );
+ const float ADVANCE_10( 9.48351f );
+ const float BEARING_10( 8.53516f );
+ const float ASCENDER_10( 8.53516f );
+
+ const float WIDTH_12( 11.3802f );
+ const float HEIGHT_12( 11.3802f );
+ const float ADVANCE_12( 11.3802f );
+ const float BEARING_12( 10.2422f );
+ const float ASCENDER_12( 10.2422f );
+
+
+ // Generate a text.
+ Toolkit::Internal::TextView::RelayoutData relayoutData;
+ TextViewProcessor::TextLayoutInfo& textLayoutInfo( relayoutData.mTextLayoutInfo );
+
+ std::string text( "Hello world!\n"
+ "\n" );
+
+ MarkupProcessor::StyledTextArray styledText;
+ MarkupProcessor::GetStyledTextArray( text, styledText );
+
+ TextViewProcessor::CreateTextInfo( styledText,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData );
+
+
+ // Build the text info with metric values.
+
+ // Characters
+
+ TextViewProcessor::CharacterLayoutInfo layoutInfo10; // ( [lo wo])
+ layoutInfo10.mHeight = HEIGHT_10;
+ layoutInfo10.mAdvance = ADVANCE_10;
+ layoutInfo10.mBearing = BEARING_10;
+ layoutInfo10.mSize = Size( WIDTH_10, HEIGHT_10 );
+ layoutInfo10.mAscender = ASCENDER_10;
+ TextViewProcessor::CharacterLayoutInfo layoutInfo12; // ( [Hel], [rld!] and [CR])
+ layoutInfo12.mHeight = HEIGHT_12;
+ layoutInfo12.mAdvance = ADVANCE_12;
+ layoutInfo12.mBearing = BEARING_12;
+ layoutInfo12.mSize = Size( WIDTH_12, HEIGHT_12 );
+ layoutInfo12.mAscender = ASCENDER_12;
+
+ TextStyle style10;
+ style10.SetFontPointSize( PointSize( 10.f ) );
+ TextStyle style12;
+ style12.SetFontPointSize( PointSize( 0.f ) ); // point size is set to zero because is a default point size.
+
+ layoutInfo12.mStyledText.mStyle = style12;
+ layoutInfo10.mStyledText.mStyle = style10;
+
+ // Words
+
+ TextViewProcessor::WordLayoutInfo wordLayout1, wordLayout2, wordLayout3, wordLayout4;
+
+ // Hello
+ wordLayout1.mSize = Size( 3.f * WIDTH_12 + 2.f * WIDTH_10, HEIGHT_12 );
+ wordLayout1.mAscender = ASCENDER_12;
+ wordLayout1.mType = TextViewProcessor::NoSeparator;
+
+ layoutInfo12.mStyledText.mText = Text( "H" );
+ wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo12 ); // H
+ layoutInfo12.mStyledText.mText = Text( "e" );
+ wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo12 ); // e
+ layoutInfo12.mStyledText.mText = Text( "l" );
+ wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo12 ); // l
+ layoutInfo10.mStyledText.mText = Text( "l" );
+ wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo10 ); // l
+ layoutInfo10.mStyledText.mText = Text( "o" );
+ wordLayout1.mCharactersLayoutInfo.push_back( layoutInfo10 ); // o
+
+ // (white space)
+ wordLayout2.mSize = Size( WIDTH_10, HEIGHT_10 );
+ wordLayout2.mAscender = ASCENDER_10;
+ wordLayout2.mType = TextViewProcessor::WordSeparator;
+ layoutInfo10.mStyledText.mText = Text( " " );
+ wordLayout2.mCharactersLayoutInfo.push_back( layoutInfo10 ); // (white space)
+
+ // world!
+ wordLayout3.mSize = Size( 2.f * WIDTH_10 + 4.f * WIDTH_12, HEIGHT_12 );
+ wordLayout3.mAscender = ASCENDER_12;
+ wordLayout3.mType = TextViewProcessor::NoSeparator;
+ layoutInfo10.mStyledText.mText = Text( "w" );
+ wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo10 ); // w
+ layoutInfo10.mStyledText.mText = Text( "o" );
+ wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo10 ); // o
+ layoutInfo12.mStyledText.mText = Text( "r" );
+ wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // r
+ layoutInfo12.mStyledText.mText = Text( "l" );
+ wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // l
+ layoutInfo12.mStyledText.mText = Text( "d" );
+ wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // d
+ layoutInfo12.mStyledText.mText = Text( "!" );
+ wordLayout3.mCharactersLayoutInfo.push_back( layoutInfo12 ); // !
+
+ // (new line character)
+ wordLayout4.mSize = Size( 0.f, HEIGHT_12 );
+ wordLayout4.mAscender = ASCENDER_12;
+ wordLayout4.mType = TextViewProcessor::LineSeparator;
+ layoutInfo12.mStyledText.mText = Text( "\n" );
+ layoutInfo12.mSize.width = 0.f;
+ wordLayout4.mCharactersLayoutInfo.push_back( layoutInfo12 ); // (new line char)
+
+ // Groups
+
+ TextViewProcessor::WordGroupLayoutInfo groupLayout1, groupLayout2;
+
+ groupLayout1.mSize = Size( 5.f * WIDTH_10 + 7.f * WIDTH_12, HEIGHT_12 );
+ groupLayout1.mAscender = ASCENDER_12;
+ groupLayout1.mDirection = TextViewProcessor::LTR;
+ groupLayout1.mNumberOfCharacters = 13;
+ groupLayout1.mWordsLayoutInfo.push_back( wordLayout1 );
+ groupLayout1.mWordsLayoutInfo.push_back( wordLayout2 );
+ groupLayout1.mWordsLayoutInfo.push_back( wordLayout3 );
+ groupLayout1.mWordsLayoutInfo.push_back( wordLayout4 );
+
+ groupLayout2.mSize = Size( 0.f, HEIGHT_12 );
+ groupLayout2.mAscender = ASCENDER_12;
+ groupLayout2.mDirection = TextViewProcessor::LTR;
+ groupLayout2.mNumberOfCharacters = 1;
+ groupLayout2.mWordsLayoutInfo.push_back( wordLayout4 );
+
+ // Lines
+
+ TextViewProcessor::LineLayoutInfo lineLayout1, lineLayout2, lineLayout3;
+
+ lineLayout1.mSize = Size( 5.f * WIDTH_10 + 7.f * WIDTH_12, HEIGHT_12 );
+ lineLayout1.mAscender = ASCENDER_12;
+ lineLayout1.mNumberOfCharacters = 13;
+ lineLayout1.mWordGroupsLayoutInfo.push_back( groupLayout1 );
+
+ lineLayout2.mSize = Size( 0.f, HEIGHT_12 );
+ lineLayout2.mAscender = ASCENDER_12;
+ lineLayout2.mNumberOfCharacters = 1;
+ lineLayout2.mWordGroupsLayoutInfo.push_back( groupLayout2 );
+
+ lineLayout3.mSize = Size( 0.f, HEIGHT_12 );
+
+ // Text (layout)
+ TextViewProcessor::TextLayoutInfo textLayout;
+
+ textLayout.mWholeTextSize = Size( 5.f * WIDTH_10 + 7.f * WIDTH_12, 3.f * HEIGHT_12 );
+ textLayout.mMaxWordWidth = 2.f * WIDTH_10 + 4.f * WIDTH_12;
+ textLayout.mNumberOfCharacters = 14;
+ textLayout.mLinesLayoutInfo.push_back( lineLayout1 );
+ textLayout.mLinesLayoutInfo.push_back( lineLayout2 );
+ textLayout.mLinesLayoutInfo.push_back( lineLayout3 );
+
+ if(!TestEqual( textLayout, textLayoutInfo ))
+ {
+ std::cout << "Layout fails" << std::endl;
+ Print(textLayout); std::cout << std::endl;
+ Print(textLayoutInfo); std::cout << std::endl;
+ }
+
+ DALI_TEST_CHECK( TestEqual( textLayout, textLayoutInfo ) );
+}
+
+static void UtcDaliTextViewSplitWord()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewSplitWord : ");
+
+ struct SplitWordTest splitWordTests[] =
+ {
+ {
+ std::string( "Split word, position 0." ),
+ std::string( "Helloooo" ),
+ 0,
+ std::string( "" ),
+ std::string( "Helloooo" ),
+ },
+ {
+ std::string( "Split word, position 8." ),
+ std::string( "Helloooo" ),
+ 8,
+ std::string( "Helloooo" ),
+ std::string( "" ),
+ },
+ {
+ std::string( "Split word, position 2." ),
+ std::string( "Helloooo" ),
+ 2,
+ std::string( "He" ),
+ std::string( "lloooo" ),
+ },
+ {
+ std::string( "Split word, position 3." ),
+ std::string( "Helloooo" ),
+ 3,
+ std::string( "Hel" ),
+ std::string( "loooo" ),
+ },
+ {
+ std::string( "Split word, position 4." ),
+ std::string( "Helloooo" ),
+ 4,
+ std::string( "Hell" ),
+ std::string( "oooo" ),
+ },
+ };
+ const std::size_t numberOfTests( 5 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const SplitWordTest& test = splitWordTests[index];
+
+ if( !TestSplitWord( test.description, test.input, test.position, test.firstResult, test.lastResult, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
+
+static void UtcDaliTextViewUpdateTextInfo()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewUpdateTextInfo : ");
+
+ struct UpdateTextInfoTest updateTextInfoTest[] =
+ {
+ // Remove operations
+
+ {
+ std::string( "Remove from new line character to first character next line." ),
+ Remove,
+ std::string("Hello world\nhello world."),
+ 11,
+ 2,
+ std::string(""),
+ 0.f,
+ std::string("Hello worldello world."),
+ },
+ {
+ std::string( "Replace style from new line character to first character next line." ),
+ Replace,
+ std::string("Hello world\nhello world."),
+ 11,
+ 2,
+ std::string("\nh"),
+ 0.f,
+ std::string("Hello world\nhello world."),
+ },
+ {
+ std::string( "Remove from the beginning to the middle of last word." ),
+ Remove,
+ std::string("Hello world, hello world."),
+ 0,
+ 22,
+ std::string(), // Not used.
+ 0.f,
+ std::string("ld."),
+ },
+ {
+ std::string( "Remove from the beginning to the middle of the text." ),
+ Remove,
+ std::string("Hello world hello world."),
+ 0,
+ 12,
+ std::string(), // Not used.
+ 0.f,
+ std::string("hello world."),
+ },
+ // Remove within the same word:
+ // * within the same group of characters.
+ {
+ std::string( "Remove within the same word, within the same group of characters" ),
+ Remove,
+ std::string("Hello world\nhello world"),
+ 7,
+ 3,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Hello wd\nhello world" )
+ },
+ // * whole group of characters (merge adjacent group of characters)
+ {
+ std::string( "Remove within the same word, whole group of characters (merge adjacent group of characters)" ),
+ Remove,
+ std::string("Hello world\nhello world"),
+ 7,
+ 3,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Hello wd\nhello world" )
+ },
+ // * whole group of characters (don't merge adjacent gtoup of characters)
+ {
+ std::string( "Remove within the same word, whole group of characters (don't merge adjacent gtoup of characters)" ),
+ Remove,
+ std::string("Hello world\nhello world"),
+ 7,
+ 3,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Hello wd\nhello world" )
+ },
+ // * Remove whole word (merge words)
+ {
+ std::string( "Remove within the same word, whole word (merge words)" ),
+ Remove,
+ std::string("Hello world\nhello world"),
+ 5,
+ 1,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Helloworld\nhello world" )
+ },
+ // * Remove whole word (don't merge words)
+ {
+ std::string( "Remove within the same word, whole word (don't merge words)" ),
+ Remove,
+ std::string("Hello world\nhello world"),
+ 6,
+ 5,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Hello \nhello world" )
+ },
+ // * Remove whole word (merge lines)
+ {
+ std::string( "Remove within the same word, whole word (merge lines)" ),
+ Remove,
+ std::string("Hello world\nhello world"),
+ 11,
+ 1,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Hello worldhello world" )
+ },
+ // * Remove whole group of words
+ /* TODO check this when RTL text is working
+ {
+ std::string( "Remove within the same line, whole group of words (merge groups)" ),
+ Remove,
+ std::string("Hello world, ש××× ×¢×××, hello world"),
+ 10,
+ 15,
+ std::string(), // Not used.
+ 0.f,
+ std::string( "Hello worlello world" )
+ },
+ */
+ // * Remove whole line
+ {
+ std::string( "Remove whole line" ),
+ Remove,
+ std::string("Hello world, hello world\n"
+ "Hello world, hello world\n"
+ "Hello world, hello world\n"
+ "Hello world, hello world\n"),
+ 25,
+ 25,
+ std::string(), // Not used.
+ 0.f,
+ std::string("Hello world, hello world\n"
+ "Hello world, hello world\n"
+ "Hello world, hello world\n"),
+ },
+ {
+ std::string( "Remove whole line" ),
+ Remove,
+ std::string("Hello world, hello world\n"
+ "H"),
+ 25,
+ 1,
+ std::string(), // Not used.
+ 0.f,
+ std::string("Hello world, hello world\n"),
+ },
+
+
+ // Insert operations
+ {
+ std::string( "insert some text" ),
+ Insert,
+ std::string("inpuext"),
+ 4,
+ 0, // Not used
+ std::string( "t t" ),
+ 0.f,
+ std::string( "input text" )
+ },
+ {
+ std::string( "Insert text at the end" ),
+ Insert,
+ std::string("touch "),
+ 6,
+ 0,
+ std::string("me\nhello"),
+ 0.f,
+ std::string("touch me\nhello")
+ },
+
+ // Replace operations.
+ {
+ std::string( "Replace style from the beginning to some point in the middle of the text." ),
+ Replace,
+ std::string( "Hello world" ),
+ 0,
+ 7,
+ std::string( "Hello w" ),
+ 0.f,
+ std::string( "Hello world" )
+ },
+ {
+ std::string( "Replace style from the middle of the text to the end." ),
+ Replace,
+ std::string( "Touch me\nhello" ),
+ 6,
+ 8,
+ std::string( "me\nhello" ),
+ 0.f,
+ std::string( "Touch me\nhello" )
+ },
+ {
+ std::string( "Remove characters from text. Previous next test:Replace style from the middle of the text 1." ),
+ Remove,
+ std::string( "Touch me\nhello\nworld" ),
+ 6,
+ 8,
+ std::string( "" ),
+ 0.f,
+ std::string( "Touch \nworld" )
+ },
+ {
+ std::string( "Insert styled text in the middle of a text. Previous: Replace style from the middle of the text 1." ),
+ Insert,
+ std::string( "Touch \nworld" ),
+ 6,
+ 0,
+ std::string( "me\nhello" ),
+ 0.f,
+ std::string( "Touch me\nhello\nworld" )
+ },
+ {
+ std::string( "Replace style from the middle of the text 1." ),
+ Replace,
+ std::string( "Touch me\nhello\nworld" ),
+ 6,
+ 8,
+ std::string( "me\nhello" ),
+ 0.f,
+ std::string( "Touch me\nhello\nworld" )
+ },
+ {
+ std::string( "Remove characters from text. Previous next test:Replace style from the middle of the text 2." ),
+ Remove,
+ std::string( "Touch me\nhello\nworld" ),
+ 6,
+ 9,
+ std::string( "" ),
+ 0.f,
+ std::string( "Touch world" )
+ },
+ {
+ std::string( "Replace style from the middle of the text 2." ),
+ Replace,
+ std::string( "Touch me\nhello\nworld" ),
+ 6,
+ 9,
+ std::string( "me\nhello\n" ),
+ 0.f,
+ std::string( "Touch me\nhello\nworld" )
+ },
+ };
+ const std::size_t numberOfTests( 21 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const UpdateTextInfoTest& test = updateTextInfoTest[index];
+
+ if( !TestUpdateTextInfo( test.description, test.operation, test.input, test.position, test.numberOfCharacters, test.inputText, test.lineHeightOffset, test.result, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
+
+static void UtcDaliTextViewSplitWordGroup()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewSplitWordGroup : ");
+
+ struct SplitWordGroupTest splitWordGroupTests[] =
+ {
+ {
+ std::string( "Split word group, wordPosition 0, position 0." ),
+ std::string( "Helloooo wooorld" ),
+ 0,
+ 0,
+ std::string( "" ),
+ std::string( "Helloooo wooorld" ),
+ },
+ {
+ std::string( "Split word group, wordPosition 2, position 8." ),
+ std::string( "Helloooo wooorld" ),
+ 2,
+ 7,
+ std::string( "Helloooo wooorld" ),
+ std::string( "" ),
+ },
+ {
+ std::string( "Split word group, wordPosition 0, position 2." ),
+ std::string( "Helloooo wooorld" ),
+ 0,
+ 2,
+ std::string( "He" ),
+ std::string( "lloooo wooorld" ),
+ },
+ {
+ std::string( "Split word group, wordPosition 0, position 3." ),
+ std::string( "Helloooo wooorld" ),
+ 0,
+ 3,
+ std::string( "Hel" ),
+ std::string( "loooo wooorld" ),
+ },
+ {
+ std::string( "Split word group, wordPosition 0, position 4." ),
+ std::string( "Helloooo wooorld" ),
+ 0,
+ 4,
+ std::string( "Hell" ),
+ std::string( "oooo wooorld" ),
+ },
+ {
+ std::string( "Split word group, wordPosition 1, position 0." ),
+ std::string( "Helloooo wooorld" ),
+ 1,
+ 0,
+ std::string( "Helloooo" ),
+ std::string( " wooorld" ),
+ },
+ };
+ const std::size_t numberOfTests( 6 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const SplitWordGroupTest& test = splitWordGroupTests[index];
+
+ if( !TestSplitWordGroup( test.description, test.input, test.wordPosition, test.position, test.firstResult, test.lastResult, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
+
+static void UtcDaliTextViewSplitLine()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewSplitLine : ");
+
+ struct SplitLineTest splitLineTests[] =
+ {
+ {
+ std::string( "Split line, groupPosition 0, wordPosition 0, position 0." ),
+ std::string( "Helloooo wooorld ש××× ×¢××× text text" ),
+ 0,
+ 0,
+ 0,
+ 3.f,
+ std::string( "" ),
+ std::string( "Helloooo wooorld ש××× ×¢××× text text" ),
+ },
+ {
+ std::string( "Split line, groupPosition 2, wordPosition 2, position 4." ),
+ std::string( "Helloooo wooorld ש××× ×¢××× text text" ),
+ 2,
+ 2,
+ 4,
+ 0.f,
+ std::string( "Helloooo wooorld ש××× ×¢××× text text" ),
+ std::string( "" ),
+ },
+ /* TODO check when RTL is working.
+ {
+ std::string( "Split line, groupPosition 1, wordPosition 2, position 0." ),
+ std::string( "Helloooo wooorld ש××× ×¢××× text text" ),
+ 1,
+ 2,
+ 0,
+ 0.f,
+ std::string( "Helloooo wooorld ש×××" ),
+ std::string( " ×¢××× text text" ),
+ },
+ {
+ std::string( "Split line, groupPosition 1, wordPosition 0, position 0." ),
+ std::string( "Helloooo wooorld ש××× ×¢××× text text" ),
+ 1,
+ 0,
+ 0,
+ 0.f,
+ std::string( "Helloooo wooorld " ),
+ std::string( "ש××× ×¢××× text text" ),
+ },
+ */
+ {
+ std::string( "Split line, groupPosition 2, wordPosition 0, position 0." ),
+ std::string( "Helloooo wooorld ש××× ×¢××× text text" ),
+ 2,
+ 0,
+ 0,
+ 6.f,
+ std::string( "Helloooo wooorld ש××× ×¢××× " ),
+ std::string( "text text" ),
+ },
+ };
+ const std::size_t numberOfTests( 3 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const SplitLineTest& test = splitLineTests[index];
+
+ if( !TestSplitLine( test.description, test.input, test.groupPosition, test.wordPosition, test.position, test.lineHeightOffset, test.firstResult, test.lastResult, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
+
+static void UtcDaliTextViewMergeWord01()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewMergeWord01 : ");
+
+ struct MergeWordsTest mergeWordsTests[] =
+ {
+ {
+ std::string( "Merge words with same style." ),
+ std::string( "Hel" ),
+ std::string( "lo" ),
+ std::string( "Hello" ),
+ },
+ {
+ std::string( "Merge words with different styles." ),
+ std::string( "lo" ),
+ std::string( "Hello" )
+ },
+ };
+ const std::size_t numberOfTests( 2 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const MergeWordsTest& test = mergeWordsTests[index];
+
+ if( !TestMergeWords( test.description, test.inputFirst, test.inputLast, test.result, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
+
+static void UtcDaliTextViewMergeWord02()
+{
+ // Negative test.
+ // It test white spaces and new line characters can't be merged to other words.
+
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewMergeWord02 : ");
+
+ // Generate three words
+
+ Toolkit::Internal::TextView::RelayoutData relayoutData01;
+ Toolkit::Internal::TextView::RelayoutData relayoutData02;
+ Toolkit::Internal::TextView::RelayoutData relayoutData03;
+ TextViewProcessor::TextLayoutInfo& textLayoutInfo01( relayoutData01.mTextLayoutInfo );
+ TextViewProcessor::TextLayoutInfo& textLayoutInfo02( relayoutData02.mTextLayoutInfo );
+ TextViewProcessor::TextLayoutInfo& textLayoutInfo03( relayoutData03.mTextLayoutInfo );
+
+ std::string text01( " " );
+ std::string text02( "\n" );
+ std::string text03( "a" );
+ MarkupProcessor::StyledTextArray styledText01;
+ MarkupProcessor::StyledTextArray styledText02;
+ MarkupProcessor::StyledTextArray styledText03;
+ MarkupProcessor::GetStyledTextArray( text01, styledText01 );
+ MarkupProcessor::GetStyledTextArray( text02, styledText02 );
+ MarkupProcessor::GetStyledTextArray( text03, styledText03 );
+
+ TextViewProcessor::CreateTextInfo( styledText01,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData01 );
+
+ TextViewProcessor::WordLayoutInfo wordLayoutInfo01;
+
+ wordLayoutInfo01 = *( *( *textLayoutInfo01.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+
+ TextViewProcessor::CreateTextInfo( styledText02,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData02 );
+
+ TextViewProcessor::WordLayoutInfo wordLayoutInfo02;
+
+ wordLayoutInfo02 = *( *( *textLayoutInfo02.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+
+ TextViewProcessor::CreateTextInfo( styledText03,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData03 );
+
+ TextViewProcessor::WordLayoutInfo wordLayoutInfo03;
+
+ wordLayoutInfo03 = *( *( *textLayoutInfo03.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+
+ // Test MergeWord() asserts if white spaces or new line chars are merged.
+ bool assert1 = false;
+ bool assert2 = false;
+ bool assert3 = false;
+ bool assert4 = false;
+ bool assert5 = false;
+ bool assert6 = false;
+
+ try
+ {
+ MergeWord( wordLayoutInfo01,
+ wordLayoutInfo02 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
+ assert1 = true;
+ }
+ try
+ {
+ MergeWord( wordLayoutInfo01,
+ wordLayoutInfo03 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
+ assert2 = true;
+ }
+ try
+ {
+ MergeWord( wordLayoutInfo02,
+ wordLayoutInfo01 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
+ assert3 = true;
+ }
+ try
+ {
+ MergeWord( wordLayoutInfo02,
+ wordLayoutInfo03 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
+ assert4 = true;
+ }
+ try
+ {
+ MergeWord( wordLayoutInfo03,
+ wordLayoutInfo01 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
+ assert5 = true;
+ }
+ try
+ {
+ MergeWord( wordLayoutInfo03,
+ wordLayoutInfo02 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWord(). ERROR: White spaces or new line characters can't be merged with other words.\"", TEST_LOCATION );
+ assert6 = true;
+ }
+
+ if( assert1 && assert2 && assert3 && assert4 && assert5 && assert6 )
+ {
+ tet_result( TET_PASS );
+ }
+ else
+ {
+ tet_result( TET_FAIL );
+ }
+}
+
+static void UtcDaliTextViewMergeGroup01()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewMergeGroup01 : ");
+
+ struct MergeWordGroupsTest mergeWordGroupssTests[] =
+ {
+ {
+ std::string( "Merge a void first group." ),
+ std::string( "" ),
+ std::string( "Hello world" ),
+ std::string( "Hello world" ),
+ },
+ {
+ std::string( "Merge a void last group." ),
+ std::string( "Hello world" ),
+ std::string( "" ),
+ std::string( "Hello world" ),
+ },
+ {
+ std::string( "Merge groups and merge last and first words." ),
+ std::string( "Hello wor" ),
+ std::string( "ld, hello world" ),
+ std::string( "Hello world, hello world" ),
+ },
+ {
+ std::string( "Merge groups and don't merge last and first words." ),
+ std::string( "Hello world, " ),
+ std::string( "hello world" ),
+ std::string( "Hello world, hello world" )
+ },
+ };
+ const std::size_t numberOfTests( 4 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const MergeWordGroupsTest& test = mergeWordGroupssTests[index];
+
+ if( !TestMergeGroupsOfWords( test.description, test.inputFirst, test.inputLast, test.result, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result(TET_PASS);
+}
+
+static void UtcDaliTextViewMergeGroup02()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewMergeGroup02 : ");
+
+ Toolkit::Internal::TextView::RelayoutData relayoutData01;
+ Toolkit::Internal::TextView::RelayoutData relayoutData02;
+ Toolkit::Internal::TextView::RelayoutData relayoutData03;
+ TextViewProcessor::TextLayoutInfo& textLayoutInfo01( relayoutData01.mTextLayoutInfo );
+ TextViewProcessor::TextLayoutInfo& textLayoutInfo02( relayoutData02.mTextLayoutInfo );
+ TextViewProcessor::TextLayoutInfo& textLayoutInfo03( relayoutData03.mTextLayoutInfo );
+
+ std::string text01( "Hello \n" );
+ std::string text02( "world" );
+ std::string text03( "اÙسÙاÙ
عÙÙÙÙ
" );
+ MarkupProcessor::StyledTextArray styledText01;
+ MarkupProcessor::StyledTextArray styledText02;
+ MarkupProcessor::StyledTextArray styledText03;
+ MarkupProcessor::GetStyledTextArray( text01, styledText01 );
+ MarkupProcessor::GetStyledTextArray( text02, styledText02 );
+ MarkupProcessor::GetStyledTextArray( text03, styledText03 );
+
+ TextViewProcessor::CreateTextInfo( styledText01,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData01 );
+
+ TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo01;
+
+ wordGroupLayoutInfo01 = *( *textLayoutInfo01.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+
+ TextViewProcessor::CreateTextInfo( styledText02,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData02 );
+
+ TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo02;
+
+ wordGroupLayoutInfo02 = *( *textLayoutInfo02.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+
+ TextViewProcessor::CreateTextInfo( styledText03,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData03 );
+
+ TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo03;
+
+ wordGroupLayoutInfo03 = *( *textLayoutInfo03.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+
+ bool assert1 = false;
+ bool assert2 = false;
+
+ try
+ {
+ MergeWordGroup( wordGroupLayoutInfo01,
+ wordGroupLayoutInfo02 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWordGroup(). ERROR: A group of words can't be merged to another group which finishes with a new line character.\"", TEST_LOCATION );
+ assert1 = true;
+ }
+
+ try
+ {
+ MergeWordGroup( wordGroupLayoutInfo03,
+ wordGroupLayoutInfo02 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWordGroup(). ERROR: groups with different direction can't be merged.\"", TEST_LOCATION );
+ assert2 = true;
+ }
+
+ if( assert1 && assert2 )
+ {
+ tet_result( TET_PASS );
+ }
+ else
+ {
+ tet_result( TET_FAIL );
+ }
+}
+
+static void UtcDaliTextViewMergeLine01()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewMergeLine01 : ");
+
+ struct MergeLinesTest mergeLinesTests[] =
+ {
+ {
+ std::string( "Merge a void first line." ),
+ std::string( "" ),
+ std::string( "Hello world, this is a whole line" ),
+ 2.f,
+ std::string( "Hello world, this is a whole line" )
+ },
+ {
+ std::string( "Merge a void last line." ),
+ std::string( "Hello world, this is a whole line" ),
+ std::string( "" ),
+ 0.f,
+ std::string( "Hello world, this is a whole line" )
+ },
+ /* TODO: check when RTL text is working.
+ {
+ std::string( "Merge lines and merge last and first groups" ),
+ std::string( "Hello world, ש×××" ),
+ std::string( " ×¢×××, hello world." ),
+ 6.f,
+ std::string( "Hello world, ש××× ×¢×××, hello world." )
+ },
+ {
+ std::string( "Merge lines and don't merge last and first words." ),
+ std::string( "Hello world, " ),
+ std::string( "ש××× ×¢×××, hello world." ),
+ 3.f,
+ std::string( "Hello world, ש××× ×¢×××, hello world." )
+ },
+ */
+ {
+ std::string( "Merge lines. Don't merge words" ),
+ std::string( "Hello world," ),
+ std::string( " this is a whole line" ),
+ 0.f,
+ std::string( "Hello world, this is a whole line" )
+ },
+ {
+ std::string( "Merge lines. Merge words" ),
+ std::string( "Hello world, th" ),
+ std::string( "is is a whole line" ),
+ 0.f,
+ std::string( "Hello world, this is a whole line" )
+ },
+ };
+ const std::size_t numberOfTests( 4 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const MergeLinesTest& test = mergeLinesTests[index];
+
+ if( !TestMergeLines( test.description, test.inputFirst, test.inputLast, test.lineHeightOffset, test.result, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
+
+static void UtcDaliTextViewMergeLine02()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewMergeLine02 : ");
+
+ Toolkit::Internal::TextView::RelayoutData relayoutData01;
+ Toolkit::Internal::TextView::RelayoutData relayoutData02;
+ TextViewProcessor::TextLayoutInfo& textLayoutInfo01( relayoutData01.mTextLayoutInfo );
+ TextViewProcessor::TextLayoutInfo& textLayoutInfo02( relayoutData02.mTextLayoutInfo );
+
+ std::string text01( "Hello world\n" );
+ std::string text02( "hello world" );
+ MarkupProcessor::StyledTextArray styledText01;
+ MarkupProcessor::StyledTextArray styledText02;
+ MarkupProcessor::GetStyledTextArray( text01, styledText01 );
+ MarkupProcessor::GetStyledTextArray( text02, styledText02 );
+
+ TextViewProcessor::CreateTextInfo( styledText01,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData01 );
+
+ TextViewProcessor::LineLayoutInfo lineLayoutInfo01;
+
+ lineLayoutInfo01 = *textLayoutInfo01.mLinesLayoutInfo.begin();
+
+ TextViewProcessor::CreateTextInfo( styledText02,
+ DEFAULT_LAYOUT_PARAMETERS,
+ relayoutData02 );
+
+ TextViewProcessor::LineLayoutInfo lineLayoutInfo02;
+
+ lineLayoutInfo02 = *textLayoutInfo02.mLinesLayoutInfo.begin();
+
+ bool assert1 = false;
+
+ try
+ {
+ MergeLine( lineLayoutInfo01,
+ lineLayoutInfo02 );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
+ DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeLine(). ERROR: A line can't be merged to another line which finishes with a new line character.\"", TEST_LOCATION );
+ assert1 = true;
+ }
+
+ if( assert1 )
+ {
+ tet_result( TET_PASS );
+ }
+ else
+ {
+ tet_result( TET_FAIL );
+ }
+}
+
+void UtcDaliTextViewRemoveCharactersFromWord()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewMergeWord02 : ");
+
+ struct RemoveCharactersFromWordTest removeCharactersFromWordTests[] =
+ {
+ {
+ std::string( "Delete 0 characters." ),
+ std::string( "Hello" ),
+ 3,
+ 0,
+ std::string( "Hello" ),
+ },
+ {
+ std::string( "Delete within the same group of characters. Starting from the beginning" ),
+ std::string( "Hello" ),
+ 0,
+ 3,
+ std::string( "lo" ),
+ },
+ {
+ std::string( "Delete within the same group of characters. Somewhere in the middle" ),
+ std::string( "Hello" ),
+ 2,
+ 2,
+ std::string( "Heo" ),
+ },
+ {
+ std::string( "Delete within the same group of characters. Starting somewhere in the middle to the end" ),
+ std::string( "Hello" ),
+ 3,
+ 2,
+ std::string( "Hel" ),
+ },
+ {
+ std::string( "Delete within the same group of characters. Finish just before a new one." ),
+ std::string( "HelloWorld" ),
+ 1,
+ 2,
+ std::string( "HloWorld" ),
+ },
+ {
+ std::string( "Delete starting in one group of characters and finishing in a different one. No merge of groups." ),
+ std::string( "HelloWorld" ),
+ 2,
+ 3,
+ std::string( "HeWorld" ),
+ },
+ {
+ std::string( "Delete within the same group of characters. Starting just after a different one." ),
+ std::string( "HelloWorld" ),
+ 7,
+ 2,
+ std::string( "HelloWod" ),
+ },
+ {
+ std::string( "Delete whole group of characters. No merge" ),
+ std::string( "HelloWorld" ),
+ 3,
+ 4,
+ std::string( "Helrld" ),
+ },
+ {
+ std::string( "Delete whole group of characters and part of the adjacent ones. No merge" ),
+ std::string( "HelloWorld" ),
+ 2,
+ 6,
+ std::string( "Held" ),
+ },
+ {
+ std::string( "Delete whole group of characters. Merge" ),
+ std::string( "HelloWorld" ),
+ 3,
+ 4,
+ std::string( "Helrld" ),
+ },
+ {
+ std::string( "Delete whole group of characters and part of the adjacent ones. Merge" ),
+ std::string( "HelloWorld" ),
+ 2,
+ 6,
+ std::string( "Held" ),
+ },
+ };
+ const std::size_t numberOfTests( 11 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const RemoveCharactersFromWordTest& test = removeCharactersFromWordTests[index];
+
+ if( !TestRemoveCharactersFromWord( test.description, test.input, test.position, test.numberOfCharacters, test.result, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
+
+static void UtcDaliTextViewRemoveWordsFromGroup()
+{
+ // Note: Currently RemoveWordsFromWordGroup() function is only used to remove a number of words from the beginning, or
+ // from a given index to the end. RemoveWordsFromWordGroup() doesn't merge words (if a white space is removed) so
+ // tehere isn't any TET case to cover these cases. To be done if needed.
+
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewRemoveWordsFromGroup : ");
+ struct RemoveWordsFromGroupTest removeWordsFromGroupTests[] =
+ {
+ {
+ std::string( "Delete 0 words." ),
+ std::string( "Hello world, hello world" ),
+ 3,
+ 0,
+ std::string( "Hello world, hello world" ),
+ },
+ {
+ std::string( "Delete some words in the middle. Don't merge words" ),
+ std::string( "Hello world, hello world" ),
+ 1,
+ 4,
+ std::string( "Hello world" ),
+ },
+ {
+ std::string( "Delete words up to the end" ),
+ std::string( "Hello world, hello world" ),
+ 5,
+ 2,
+ std::string( "Hello world, hello" ),
+ },
+ {
+ std::string( "Delete words from the beginning." ),
+ std::string( "Hello world, hello world" ),
+ 0,
+ 3,
+ std::string( " hello world" ),
+ },
+ };
+ const std::size_t numberOfTests( 4 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const RemoveWordsFromGroupTest& test = removeWordsFromGroupTests[index];
+
+ if( !TestRemoveWordsFromGroup( test.description, test.input, test.wordIndex, test.numberOfWords, test.result, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
+
+static void UtcDaliTextViewRemoveGroupsFromLine()
+{
+ // Note: Currently RemoveWordGroupsFromLine() function is only used to remove a number of group of words from the beginning, or
+ // from a given index to the end. RemoveWordGroupsFromLine() doesn't merge groups of words (if a whole group of words is removed) so
+ // tehere isn't any TET case to cover these cases. To be done if needed.
+
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliTextViewRemoveGroupsFromLine : ");
+ struct RemoveGroupsFromLineTest removeGroupsFromLineTests[] =
+ {
+ {
+ std::string( "Delete 0 groups of words." ),
+ std::string( "Hello hello, ש××× ×¢××× hello hello" ),
+ 1,
+ 0,
+ 2.f,
+ std::string( "Hello hello, ש××× ×¢××× hello hello" ),
+ },
+ {
+ std::string( "Delete from the middle to the end." ),
+ std::string( "Hello hello, ש××× ×¢××× hello hello" ),
+ 1,
+ 2,
+ 0.f,
+ std::string( "Hello hello, " ),
+ },
+ {
+ std::string( "Delete from the beginning to the middle." ),
+ std::string( "Hello hello, ש××× ×¢××× hello hello" ),
+ 0,
+ 2,
+ 6.f,
+ std::string( "hello hello" ),
+ },
+ };
+ const std::size_t numberOfTests( 3 );
+
+ for( std::size_t index = 0; index < numberOfTests; ++index )
+ {
+ const RemoveGroupsFromLineTest& test = removeGroupsFromLineTests[index];
+
+ if( !TestRemoveGroupsFromLine( test.description, test.input, test.groupIndex, test.numberOfGroups, test.lineHeightOffset, test.result, TEST_LOCATION ) )
+ {
+ tet_result( TET_FAIL );
+ }
+ }
+
+ tet_result( TET_PASS );
+}
diff --git a/automated-tests/dali-internal-test-suite/utc-MODULE-CLASS.cpp.in b/automated-tests/dali-internal-test-suite/utc-MODULE-CLASS.cpp.in
new file mode 100644
index 0000000..2467239
--- /dev/null
+++ b/automated-tests/dali-internal-test-suite/utc-MODULE-CLASS.cpp.in
@@ -0,0 +1,96 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+
+#include
+
+// Internal headers are allowed here
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+using namespace Dali::Toolkit::Internal;
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( Utc@MODULE@@CLASS@Method01, POSITIVE_TC_IDX );
+TEST_FUNCTION( Utc@MODULE@@CLASS@Method02, NEGATIVE_TC_IDX );
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+
+// Positive test case for a method
+static void Utc@MODULE@@CLASS@Method01()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("Journaled printf Output");
+ tet_result(TET_FAIL);
+#if 0
+ tet_result(TET_PASS);
+#endif
+}
+
+
+// Negative test case for a method
+static void Utc@MODULE@@CLASS@Method02()
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ try
+ {
+ /* My test code and results */
+ DALI_TEST_EQUALS(myVar, expectedValue, TEST_LOCATION);
+ }
+ catch (Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_EQUALS(e.mCondition, "assert conditional", TEST_LOCATION);
+ }
+}
+
diff --git a/automated-tests/dali-test-suite/.gitignore b/automated-tests/dali-test-suite/.gitignore
new file mode 100644
index 0000000..45486c6
--- /dev/null
+++ b/automated-tests/dali-test-suite/.gitignore
@@ -0,0 +1 @@
+utc-Dali-ScrollViewEffect
diff --git a/automated-tests/dali-test-suite/alignment/.gitignore b/automated-tests/dali-test-suite/alignment/.gitignore
new file mode 100644
index 0000000..31af42e
--- /dev/null
+++ b/automated-tests/dali-test-suite/alignment/.gitignore
@@ -0,0 +1 @@
+utc-Dali-Alignment
diff --git a/automated-tests/dali-test-suite/alignment/Makefile b/automated-tests/dali-test-suite/alignment/Makefile
new file mode 120000
index 0000000..c88d5a7
--- /dev/null
+++ b/automated-tests/dali-test-suite/alignment/Makefile
@@ -0,0 +1 @@
+../master-makefile.mk
\ No newline at end of file
diff --git a/automated-tests/dali-test-suite/alignment/file.list b/automated-tests/dali-test-suite/alignment/file.list
new file mode 100644
index 0000000..7a4d9f1
--- /dev/null
+++ b/automated-tests/dali-test-suite/alignment/file.list
@@ -0,0 +1,2 @@
+TARGETS += \
+ utc-Dali-Alignment \
diff --git a/automated-tests/dali-test-suite/alignment/tslist b/automated-tests/dali-test-suite/alignment/tslist
new file mode 100644
index 0000000..76ce95e
--- /dev/null
+++ b/automated-tests/dali-test-suite/alignment/tslist
@@ -0,0 +1 @@
+/dali-test-suite/alignment/utc-Dali-Alignment
diff --git a/automated-tests/dali-test-suite/alignment/utc-Dali-Alignment.cpp b/automated-tests/dali-test-suite/alignment/utc-Dali-Alignment.cpp
new file mode 100644
index 0000000..2dd1e85
--- /dev/null
+++ b/automated-tests/dali-test-suite/alignment/utc-Dali-Alignment.cpp
@@ -0,0 +1,1127 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+#include
+#include
+
+#include
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+static void Startup();
+static void Cleanup();
+
+namespace
+{
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+} // namespace
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( UtcDaliAlignmentConstructorNegative, NEGATIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliAlignmentConstructorPositive, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliAlignmentConstructorRegister, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliAlignmentSetAlignmentTypePositiveOffStage, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliAlignmentSetAlignmentTypePositiveOnStage, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliAlignmentSetAlignmentTypeNegative, NEGATIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliAlignmentGetAlignmentType, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliAlignmentSetScaling, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliAlignmentGetScaling, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliAlignmentSetPaddingPositive, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliAlignmentSetPaddingNegative, NEGATIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliAlignmentGetPadding, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliAlignmentChildAddAndRemove, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliAlignmentOnSizeSet, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliAlignmentOnTouchEvent, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliAlignmentOnKeyEvent, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliAlignmentOnSizeAnimation, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliAlignmentCopyAndAssignment, POSITIVE_TC_IDX );
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliAlignmentConstructorNegative()
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment;
+
+ try
+ {
+ Alignment::Padding padding;
+ alignment.SetPadding(padding);
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& exception)
+ {
+ if (exception.mCondition == "alignment")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+}
+
+static void UtcDaliAlignmentConstructorPositive()
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+
+ try
+ {
+ Alignment::Padding padding;
+ alignment.SetPadding(padding);
+ tet_result(TET_PASS);
+ }
+ catch (DaliException& exception)
+ {
+ tet_result(TET_FAIL);
+ }
+
+ Actor actor = alignment;
+ alignment = Alignment::DownCast( actor );
+
+ DALI_TEST_CHECK( alignment );
+}
+
+static void UtcDaliAlignmentConstructorRegister()
+{
+ ToolkitTestApplication application;
+
+ //Te ensure the object is registered after creation
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect(&TestCallback);
+ {
+ Alignment alignment = Alignment::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+}
+
+static void UtcDaliAlignmentSetAlignmentTypePositiveOffStage()
+{
+ ToolkitTestApplication application;
+
+ // Default, HorizontalCenter, VerticalCenter - Ensure they do not change!
+ {
+ Alignment alignment = Alignment::New();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalCenter | Alignment::VerticalCenter));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+ }
+
+ // HorizontalLeft, VerticalCenter
+ {
+ Alignment alignment = Alignment::New();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::HorizontalLeft);
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+ }
+
+ // HorizontalRight, VerticalCenter
+ {
+ Alignment alignment = Alignment::New();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::HorizontalRight);
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+ }
+
+ // HorizontalLeft, VerticalTop
+ {
+ Alignment alignment = Alignment::New();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalLeft | Alignment::VerticalTop));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+ }
+
+ // HorizontalCenter, VerticalTop
+ {
+ Alignment alignment = Alignment::New();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::VerticalTop);
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+ }
+
+ // HorizontalRight, VerticalTop
+ {
+ Alignment alignment = Alignment::New();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalRight | Alignment::VerticalTop));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+ }
+
+ // HorizontalLeft, VerticalBottom
+ {
+ Alignment alignment = Alignment::New();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalLeft | Alignment::VerticalBottom));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+ }
+
+ // HorizontalCenter, VerticalBottom
+ {
+ Alignment alignment = Alignment::New();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::VerticalBottom);
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+ }
+
+ // HorizontalRight, VerticalBottom
+ {
+ Alignment alignment = Alignment::New();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalRight | Alignment::VerticalBottom));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+ }
+}
+
+static void UtcDaliAlignmentSetAlignmentTypePositiveOnStage()
+{
+ ToolkitTestApplication application;
+
+ // Default, HorizontalCenter, VerticalCenter - Ensure they do not change!
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalCenter | Alignment::VerticalCenter));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalLeft, VerticalCenter
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::HorizontalLeft);
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalRight, VerticalCenter
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::HorizontalRight);
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalLeft, VerticalTop
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalLeft | Alignment::VerticalTop));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalCenter, VerticalTop
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::VerticalTop);
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalRight, VerticalTop
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalRight | Alignment::VerticalTop));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalLeft, VerticalBottom
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalLeft | Alignment::VerticalBottom));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalCenter, VerticalBottom
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::VerticalBottom);
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalRight, VerticalBottom
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ // Check default values
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalRight | Alignment::VerticalBottom));
+ alignment.SetAlignmentType(type);
+ DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+}
+
+static void UtcDaliAlignmentSetAlignmentTypeNegative()
+{
+ ToolkitTestApplication application;
+
+ // Setting HorizontalLeft, HorizontalCenter
+ {
+ Alignment alignment = Alignment::New();
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalLeft | Alignment::HorizontalCenter));
+
+ try
+ {
+ alignment.SetAlignmentType(type);
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& exception)
+ {
+ if (exception.mCondition == "!horizontalSet")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+ }
+
+ // Setting HorizontalCenter, HorizontalRight
+ {
+ Alignment alignment = Alignment::New();
+ Alignment::Type type(Alignment::Type(Alignment::HorizontalCenter | Alignment::HorizontalRight));
+
+ try
+ {
+ alignment.SetAlignmentType(type);
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& exception)
+ {
+ if (exception.mCondition == "!horizontalSet")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+ }
+
+ // Setting VerticalTop, VerticalCenter
+ {
+ Alignment alignment = Alignment::New();
+ Alignment::Type type(Alignment::Type(Alignment::VerticalTop | Alignment::VerticalCenter));
+
+ try
+ {
+ alignment.SetAlignmentType(type);
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& exception)
+ {
+ if (exception.mCondition == "!verticalSet")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+ }
+
+ // Setting VerticalCenter, VerticalBottom
+ {
+ Alignment alignment = Alignment::New();
+ Alignment::Type type(Alignment::Type(Alignment::VerticalTop | Alignment::VerticalBottom));
+
+ try
+ {
+ alignment.SetAlignmentType(type);
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& exception)
+ {
+ if (exception.mCondition == "!veritcalSet")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+ }
+}
+
+static void UtcDaliAlignmentGetAlignmentType()
+{
+ ToolkitTestApplication application;
+
+ // Default, HorizonalCenter, VerticalCenter
+ {
+ Alignment alignment = Alignment::New();
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalLeft, VerticalCenter
+ {
+ Alignment alignment = Alignment::New(Alignment::HorizontalLeft);
+ DALI_TEST_EQUALS(Alignment::HorizontalLeft | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalRight, VerticalCenter
+ {
+ Alignment alignment = Alignment::New(Alignment::HorizontalRight);
+ DALI_TEST_EQUALS(Alignment::HorizontalRight | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalLeft, VerticalTop
+ {
+ Alignment alignment = Alignment::New(Alignment::HorizontalLeft, Alignment::VerticalTop);
+ DALI_TEST_EQUALS(Alignment::HorizontalLeft | Alignment::VerticalTop, alignment.GetAlignmentType(), TEST_LOCATION);
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalCenter, VerticalTop
+ {
+ Alignment alignment = Alignment::New(Alignment::HorizontalCenter, Alignment::VerticalTop);
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalTop, alignment.GetAlignmentType(), TEST_LOCATION);
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalRight, VerticalTop
+ {
+ Alignment alignment = Alignment::New(Alignment::HorizontalRight, Alignment::VerticalTop);
+ DALI_TEST_EQUALS(Alignment::HorizontalRight | Alignment::VerticalTop, alignment.GetAlignmentType(), TEST_LOCATION);
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalLeft, VerticalBottom
+ {
+ Alignment alignment = Alignment::New(Alignment::HorizontalLeft, Alignment::VerticalBottom);
+ DALI_TEST_EQUALS(Alignment::HorizontalLeft | Alignment::VerticalBottom, alignment.GetAlignmentType(), TEST_LOCATION);
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalCenter, VerticalBottom
+ {
+ Alignment alignment = Alignment::New(Alignment::HorizontalCenter, Alignment::VerticalBottom);
+ DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalBottom, alignment.GetAlignmentType(), TEST_LOCATION);
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // HorizontalRight, VerticalBottom
+ {
+ Alignment alignment = Alignment::New(Alignment::HorizontalRight, Alignment::VerticalBottom);
+ DALI_TEST_EQUALS(Alignment::HorizontalRight | Alignment::VerticalBottom, alignment.GetAlignmentType(), TEST_LOCATION);
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+}
+
+static void UtcDaliAlignmentSetScaling()
+{
+ ToolkitTestApplication application;
+
+ // ScaleToFill
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(Alignment::ScaleNone, alignment.GetScaling(), TEST_LOCATION);
+ alignment.SetScaling(Alignment::ScaleToFill);
+ DALI_TEST_EQUALS(Alignment::ScaleToFill, alignment.GetScaling(), TEST_LOCATION);
+ application.Render();
+ application.SendNotification();
+
+ // For complete line coverage
+ alignment.SetAlignmentType(Alignment::HorizontalLeft);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::HorizontalRight);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalTop);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalBottom);
+ application.Render();
+ application.SendNotification();
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // ScaleToFitKeepAspect
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(Alignment::ScaleNone, alignment.GetScaling(), TEST_LOCATION);
+ alignment.SetScaling(Alignment::ScaleToFitKeepAspect);
+ DALI_TEST_EQUALS(Alignment::ScaleToFitKeepAspect, alignment.GetScaling(), TEST_LOCATION);
+ application.Render();
+ application.SendNotification();
+
+ // For complete line coverage
+ alignment.SetAlignmentType(Alignment::HorizontalLeft);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::HorizontalRight);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalTop);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalBottom);
+ application.Render();
+ application.SendNotification();
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // ScaleToFillKeepAspect
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(Alignment::ScaleNone, alignment.GetScaling(), TEST_LOCATION);
+ alignment.SetScaling(Alignment::ScaleToFillKeepAspect);
+ DALI_TEST_EQUALS(Alignment::ScaleToFillKeepAspect, alignment.GetScaling(), TEST_LOCATION);
+ application.Render();
+ application.SendNotification();
+
+ // For complete line coverage
+ alignment.SetAlignmentType(Alignment::HorizontalLeft);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::HorizontalRight);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalTop);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalBottom);
+ application.Render();
+ application.SendNotification();
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // ShrinkToFit
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(Alignment::ScaleNone, alignment.GetScaling(), TEST_LOCATION);
+ alignment.SetScaling(Alignment::ShrinkToFit);
+ DALI_TEST_EQUALS(Alignment::ShrinkToFit, alignment.GetScaling(), TEST_LOCATION);
+ application.Render();
+ application.SendNotification();
+
+ // For complete line coverage
+ alignment.SetAlignmentType(Alignment::HorizontalLeft);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::HorizontalRight);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalTop);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalBottom);
+ application.Render();
+ application.SendNotification();
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+
+ // ShrinkToFitKeepAspect
+ {
+ Alignment alignment = Alignment::New();
+ alignment.Add(RenderableActor::New());
+ Stage::GetCurrent().Add(alignment);
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(Alignment::ScaleNone, alignment.GetScaling(), TEST_LOCATION);
+ alignment.SetScaling(Alignment::ShrinkToFitKeepAspect);
+ DALI_TEST_EQUALS(Alignment::ShrinkToFitKeepAspect, alignment.GetScaling(), TEST_LOCATION);
+ application.Render();
+ application.SendNotification();
+
+ // For complete line coverage
+ alignment.SetAlignmentType(Alignment::HorizontalLeft);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::HorizontalRight);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalTop);
+ application.Render();
+ application.SendNotification();
+ alignment.SetAlignmentType(Alignment::VerticalBottom);
+ application.Render();
+ application.SendNotification();
+
+ Stage::GetCurrent().Remove(alignment);
+ application.Render();
+ application.SendNotification();
+ }
+}
+
+static void UtcDaliAlignmentGetScaling()
+{
+ ToolkitTestApplication application;
+
+ // ScaleToFill
+ {
+ Alignment alignment = Alignment::New();
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleNone);
+
+ alignment.SetScaling(Alignment::ScaleToFill);
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleToFill);
+ }
+
+ // ScaleToFitKeepAspect
+ {
+ Alignment alignment = Alignment::New();
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleNone);
+
+ alignment.SetScaling(Alignment::ScaleToFitKeepAspect);
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleToFitKeepAspect);
+ }
+
+ // ScaleToFillKeepAspect
+ {
+ Alignment alignment = Alignment::New();
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleNone);
+
+ alignment.SetScaling(Alignment::ScaleToFillKeepAspect);
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleToFillKeepAspect);
+ }
+
+ // ShrinkToFit
+ {
+ Alignment alignment = Alignment::New();
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleNone);
+
+ alignment.SetScaling(Alignment::ShrinkToFit);
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ShrinkToFit);
+ }
+
+ // ShrinkToFitKeepAspect
+ {
+ Alignment alignment = Alignment::New();
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ScaleNone);
+
+ alignment.SetScaling(Alignment::ShrinkToFitKeepAspect);
+ DALI_TEST_CHECK(alignment.GetScaling() == Alignment::ShrinkToFitKeepAspect);
+ }
+
+}
+
+static void UtcDaliAlignmentSetPaddingPositive()
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+
+ Alignment::Padding padding(1.0f, 1.5f, 2.f, 0.5f);
+ DALI_TEST_CHECK( fabs( padding.left - alignment.GetPadding().left ) > GetRangedEpsilon( padding.left, alignment.GetPadding().left ) );
+ DALI_TEST_CHECK( fabs( padding.right - alignment.GetPadding().right ) > GetRangedEpsilon( padding.right, alignment.GetPadding().right ) );
+ DALI_TEST_CHECK( fabs( padding.top - alignment.GetPadding().top ) > GetRangedEpsilon( padding.top, alignment.GetPadding().top ) );
+ DALI_TEST_CHECK( fabs( padding.bottom - alignment.GetPadding().bottom ) > GetRangedEpsilon( padding.bottom, alignment.GetPadding().bottom ) );
+
+ alignment.SetPadding(padding);
+ DALI_TEST_CHECK( fabs( padding.left - alignment.GetPadding().left ) < GetRangedEpsilon( padding.left, alignment.GetPadding().left ) );
+ DALI_TEST_CHECK( fabs( padding.right - alignment.GetPadding().right ) < GetRangedEpsilon( padding.right, alignment.GetPadding().right ) );
+ DALI_TEST_CHECK( fabs( padding.top - alignment.GetPadding().top ) < GetRangedEpsilon( padding.top, alignment.GetPadding().top ) );
+ DALI_TEST_CHECK( fabs( padding.bottom - alignment.GetPadding().bottom ) < GetRangedEpsilon( padding.bottom, alignment.GetPadding().bottom ) );
+}
+
+static void UtcDaliAlignmentSetPaddingNegative()
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+
+ try
+ {
+ Alignment::Padding padding(-1.0f, 1.5f, 2.f, 0.f);
+ alignment.SetPadding(padding);
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& exception)
+ {
+ if (exception.mCondition == "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+
+ try
+ {
+ Alignment::Padding padding(1.0f, 1.5f, -2.f, 0.f);
+ alignment.SetPadding(padding);
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& exception)
+ {
+ if (exception.mCondition == "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+
+ try
+ {
+ Alignment::Padding padding(1.0f, 1.5f, 2.f, -1.f);
+ alignment.SetPadding(padding);
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& exception)
+ {
+ if (exception.mCondition == "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+
+ try
+ {
+ Alignment::Padding padding(1.0f, -1.5f, 2.f, 0.f);
+ alignment.SetPadding(padding);
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException& exception)
+ {
+ if (exception.mCondition == "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )")
+ {
+ tet_result(TET_PASS);
+ }
+ }
+}
+
+static void UtcDaliAlignmentGetPadding()
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+ DALI_TEST_CHECK( fabs( alignment.GetPadding().left ) < GetRangedEpsilon( 0.f, alignment.GetPadding().left ) );
+ DALI_TEST_CHECK( fabs( alignment.GetPadding().right ) < GetRangedEpsilon( 0.f, alignment.GetPadding().right ) );
+ DALI_TEST_CHECK( fabs( alignment.GetPadding().top ) < GetRangedEpsilon( 0.f, alignment.GetPadding().top ) );
+ DALI_TEST_CHECK( fabs( alignment.GetPadding().bottom ) < GetRangedEpsilon( 0.f, alignment.GetPadding().bottom ) );
+
+ Alignment::Padding padding(1.0f, 1.5f, 2.f, 0.f);
+ alignment.SetPadding(padding);
+ DALI_TEST_CHECK( fabs( padding.left - alignment.GetPadding().left ) < GetRangedEpsilon( padding.left, alignment.GetPadding().left ) );
+ DALI_TEST_CHECK( fabs( padding.right - alignment.GetPadding().right ) < GetRangedEpsilon( padding.right, alignment.GetPadding().right ) );
+ DALI_TEST_CHECK( fabs( padding.top - alignment.GetPadding().top ) < GetRangedEpsilon( padding.top, alignment.GetPadding().top ) );
+ DALI_TEST_CHECK( fabs( padding.bottom - alignment.GetPadding().bottom ) < GetRangedEpsilon( padding.bottom, alignment.GetPadding().bottom ) );
+}
+
+static void UtcDaliAlignmentChildAddAndRemove()
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+ Stage::GetCurrent().Add(alignment);
+
+ application.Render();
+ application.SendNotification();
+
+ Actor actor = RenderableActor::New();
+ alignment.Add(actor);
+
+ DALI_TEST_EQUALS(alignment.GetChildCount(), 1u, TEST_LOCATION);
+
+ application.Render();
+ application.SendNotification();
+
+ alignment.Remove(actor);
+
+ DALI_TEST_EQUALS(alignment.GetChildCount(), 0u, TEST_LOCATION);
+
+ application.Render();
+ application.SendNotification();
+
+ Stage::GetCurrent().Remove(alignment);
+}
+
+static void UtcDaliAlignmentOnSizeSet()
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+ Stage::GetCurrent().Add(alignment);
+
+ application.Render();
+ application.SendNotification();
+
+ Vector3 size(100.0f, 200.0f, 0.0f);
+ alignment.SetSize(size);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(size, alignment.GetImplementation().GetControlSize(), TEST_LOCATION);
+
+ Stage::GetCurrent().Remove(alignment);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+static bool TouchEventCallback(Actor actor, const TouchEvent& event)
+{
+ return false;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+static void UtcDaliAlignmentOnTouchEvent()
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+ alignment.SetSize(100.0f, 100.0f);
+ alignment.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(alignment);
+
+ alignment.TouchedSignal().Connect(&TouchEventCallback);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ Integration::TouchEvent touchEvent(1);
+ TouchPoint point(1, TouchPoint::Down, 20.0f, 20.0f);
+ touchEvent.AddPoint(point);
+ application.GetCore().SendEvent(touchEvent);
+
+ tet_result(TET_PASS); // For line coverage, as long as there are no exceptions, we assume passed.
+}
+
+static void UtcDaliAlignmentOnKeyEvent()
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+ Stage::GetCurrent().Add(alignment);
+
+ alignment.SetKeyInputFocus();
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ Integration::KeyEvent keyEvent;
+ application.GetCore().SendEvent(keyEvent);
+
+ tet_result(TET_PASS); // For line coverage, as long as there are no exceptions, we assume passed.
+}
+
+static void UtcDaliAlignmentOnSizeAnimation()
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+ Stage::GetCurrent().Add(alignment);
+
+ Animation animation = Animation::New(100.0f);
+ animation.Resize(alignment, Vector3(100.0f, 150.0f, 200.0f));
+ animation.Play();
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ tet_result(TET_PASS); // For line coverage, as long as there are no exceptions, we assume passed.
+}
+
+static void UtcDaliAlignmentCopyAndAssignment()
+{
+ ToolkitTestApplication application;
+
+ Alignment alignment = Alignment::New();
+ Alignment emptyAlignment;
+
+ Alignment::Padding padding(100.0f, 150.0f, 200.f, 0.f);
+ alignment.SetPadding(padding);
+
+ Alignment alignmentCopy(alignment);
+ DALI_TEST_CHECK( fabs( padding.left - alignmentCopy.GetPadding().left ) < GetRangedEpsilon( padding.left, alignmentCopy.GetPadding().left ) );
+ DALI_TEST_CHECK( fabs( padding.right - alignmentCopy.GetPadding().right ) < GetRangedEpsilon( padding.right, alignmentCopy.GetPadding().right ) );
+ DALI_TEST_CHECK( fabs( padding.top - alignmentCopy.GetPadding().top ) < GetRangedEpsilon( padding.top, alignmentCopy.GetPadding().top ) );
+ DALI_TEST_CHECK( fabs( padding.bottom - alignmentCopy.GetPadding().bottom ) < GetRangedEpsilon( padding.bottom, alignmentCopy.GetPadding().bottom ) );
+
+ Alignment alignmentEmptyCopy(emptyAlignment);
+ DALI_TEST_CHECK(emptyAlignment == alignmentEmptyCopy);
+
+ Alignment alignmentEquals;
+ alignmentEquals = alignment;
+ DALI_TEST_CHECK( fabs( padding.left - alignmentEquals.GetPadding().left ) < GetRangedEpsilon( padding.left, alignmentEquals.GetPadding().left ) );
+ DALI_TEST_CHECK( fabs( padding.right - alignmentEquals.GetPadding().right ) < GetRangedEpsilon( padding.right, alignmentEquals.GetPadding().right ) );
+ DALI_TEST_CHECK( fabs( padding.top - alignmentEquals.GetPadding().top ) < GetRangedEpsilon( padding.top, alignmentEquals.GetPadding().top ) );
+ DALI_TEST_CHECK( fabs( padding.bottom - alignmentEquals.GetPadding().bottom ) < GetRangedEpsilon( padding.bottom, alignmentEquals.GetPadding().bottom ) );
+
+ Alignment alignmentEmptyEquals;
+ alignmentEmptyEquals = emptyAlignment;
+ DALI_TEST_CHECK(emptyAlignment == alignmentEmptyEquals);
+
+ // Self assignment
+ alignment = alignment;
+ DALI_TEST_CHECK(alignment == alignmentCopy);
+}
diff --git a/automated-tests/dali-test-suite/bubble-emitter/.gitignore b/automated-tests/dali-test-suite/bubble-emitter/.gitignore
new file mode 100644
index 0000000..f514af1
--- /dev/null
+++ b/automated-tests/dali-test-suite/bubble-emitter/.gitignore
@@ -0,0 +1 @@
+utc-Dali-BubbleEmitter
diff --git a/automated-tests/dali-test-suite/bubble-emitter/Makefile b/automated-tests/dali-test-suite/bubble-emitter/Makefile
new file mode 120000
index 0000000..c88d5a7
--- /dev/null
+++ b/automated-tests/dali-test-suite/bubble-emitter/Makefile
@@ -0,0 +1 @@
+../master-makefile.mk
\ No newline at end of file
diff --git a/automated-tests/dali-test-suite/bubble-emitter/file.list b/automated-tests/dali-test-suite/bubble-emitter/file.list
new file mode 100644
index 0000000..2d1ab31
--- /dev/null
+++ b/automated-tests/dali-test-suite/bubble-emitter/file.list
@@ -0,0 +1,2 @@
+TARGETS += \
+ utc-Dali-BubbleEmitter \
diff --git a/automated-tests/dali-test-suite/bubble-emitter/tslist b/automated-tests/dali-test-suite/bubble-emitter/tslist
new file mode 100644
index 0000000..c73cb09
--- /dev/null
+++ b/automated-tests/dali-test-suite/bubble-emitter/tslist
@@ -0,0 +1 @@
+/dali-test-suite/bubble-emitter/utc-Dali-BubbleEmitter
diff --git a/automated-tests/dali-test-suite/bubble-emitter/utc-Dali-BubbleEmitter.cpp b/automated-tests/dali-test-suite/bubble-emitter/utc-Dali-BubbleEmitter.cpp
new file mode 100644
index 0000000..620504f
--- /dev/null
+++ b/automated-tests/dali-test-suite/bubble-emitter/utc-Dali-BubbleEmitter.cpp
@@ -0,0 +1,423 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+
+#include
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+namespace
+{
+const int RENDER_FRAME_INTERVAL = 16;
+
+static bool gObjectCreatedCallBackCalled;
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+/*
+ * Simulate time passed by.
+ *
+ * @note this will always process at least 1 frame (1/60 sec)
+ *
+ * @param application Test application instance
+ * @param duration Time to pass in milliseconds.
+ * @return The actual time passed in milliseconds
+ */
+int Wait(ToolkitTestApplication& application, int duration = 0)
+{
+ int time = 0;
+
+ for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
+ {
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ time += RENDER_FRAME_INTERVAL;
+ }
+
+ return time;
+}
+
+Image CreateSolidColorImage( ToolkitTestApplication& application, const Vector4& color, unsigned int width, unsigned int height )
+{
+ BitmapImage imageData = BitmapImage::New( width, height, Pixel::RGBA8888 );
+
+ // Create the image
+ PixelBuffer* pixbuf = imageData.GetBuffer();
+ unsigned int size = width * height;
+
+ for( size_t i = 0; i < size; i++ )
+ {
+ pixbuf[i*4+0] = 0xFF * color.r;
+ pixbuf[i*4+1] = 0xFF * color.g;
+ pixbuf[i*4+2] = 0xFF * color.b;
+ pixbuf[i*4+3] = 0xFF * color.a;
+ }
+ imageData.Update();
+
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ application.Render(RENDER_FRAME_INTERVAL);
+ application.SendNotification();
+
+ return imageData;
+}
+}//namespace
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( UtcDaliBubbleEmitterNew, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliBubbleEmitterGetRootActor, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliBubbleEmitterSetBackground, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliBubbleEmitterSetShapeImage, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliBubbleEmitterSetBubbleScale, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliBubbleEmitterSetBubbleDensity01, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliBubbleEmitterSetBubbleDensity02, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliBubbleEmitterSetBlendMode, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliBubbleEmitterEmitBubble, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliBubbleEmitterStartExplosion, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliBubbleEmitterRestore, POSITIVE_TC_IDX );
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliBubbleEmitterNew()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliBubbleEmitterNew ");
+
+ // Test default constructor
+ BubbleEmitter emitter;
+ DALI_TEST_CHECK( !emitter );
+
+ // Test object creation
+ Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 200, Vector2( 5.f, 10.f ));
+ DALI_TEST_CHECK( emitter );
+
+ // Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestCallback );
+ {
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 200, Vector2( 5.f, 10.f ));
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+
+ // Test copy constructor
+ BubbleEmitter emitterCopy( emitter );
+ DALI_TEST_CHECK( emitterCopy );
+
+ // Test down cast
+ Handle handleEmitter;
+ handleEmitter = emitter;
+ BubbleEmitter downCastEmitter = BubbleEmitter::DownCast( handleEmitter );
+ DALI_TEST_CHECK( downCastEmitter );
+}
+
+static void UtcDaliBubbleEmitterGetRootActor()
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterGetRootActor " );
+
+ Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 200, Vector2( 5.f, 10.f ));
+
+ Actor root = emitter.GetRootActor();
+ DALI_TEST_CHECK( root );
+ DALI_TEST_CHECK( root.GetChildCount() == 3 );
+}
+
+static void UtcDaliBubbleEmitterSetBackground()
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterSetBackground " );
+
+ Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 200, Vector2( 5.f, 10.f ));
+
+ RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
+ unsigned int taskCount = taskList.GetTaskCount();
+
+ Image bgImage = CreateSolidColorImage( application, Color::RED, 50, 50 );
+ emitter.SetBackground( bgImage, Vector3(0.f, 0.f, 0.5f) );
+
+ DALI_TEST_CHECK( taskList.GetTaskCount() == taskCount+1 );
+
+ Wait(application, 500);
+ DALI_TEST_CHECK( taskList.GetTaskCount() == taskCount );
+}
+
+static void UtcDaliBubbleEmitterSetShapeImage()
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterSetShapeImage " );
+
+ Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+
+ Actor root = emitter.GetRootActor();
+ MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) );
+ Material material = bubbleMesh.GetMaterial();
+
+ DALI_TEST_CHECK( material.GetDiffuseTexture() == shapeImage1 );
+
+ Image shapeImage2 = CreateSolidColorImage( application, Color::RED, 8, 8 );
+ emitter.SetShapeImage( shapeImage2 );
+
+ DALI_TEST_CHECK( material.GetDiffuseTexture() == shapeImage2 );
+}
+
+static void UtcDaliBubbleEmitterSetBubbleScale()
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterSetBubbleScale " );
+
+ Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+
+ Actor root = emitter.GetRootActor();
+ MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) );
+ ShaderEffect effect = bubbleMesh.GetShaderEffect();
+ DALI_TEST_CHECK( effect );
+
+ Property::Index scalePropertyIndex = effect.GetPropertyIndex( "uDynamicScale" );
+ float scaleValue;
+ (effect.GetProperty(scalePropertyIndex)).Get( scaleValue );
+ DALI_TEST_EQUALS(scaleValue, 1.f, TEST_LOCATION );
+
+ emitter.SetBubbleScale( 2.f );
+ application.SendNotification();
+ application.Render();
+ (effect.GetProperty(scalePropertyIndex)).Get( scaleValue );
+ DALI_TEST_EQUALS(scaleValue, 2.f, TEST_LOCATION );
+
+ emitter.SetBubbleScale( 0.5f );
+ application.SendNotification();
+ application.Render();
+ (effect.GetProperty(scalePropertyIndex)).Get( scaleValue );
+ DALI_TEST_EQUALS(scaleValue, 0.5f, TEST_LOCATION );
+}
+
+static void UtcDaliBubbleEmitterSetBubbleDensity01()
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterSetBubbleDensity " );
+
+ Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+
+ try
+ {
+ emitter.SetBubbleDensity( 3.f );
+ DALI_TEST_CHECK(true);
+ }
+ catch(Dali::DaliException& e)
+ {
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_ASSERT(e, "density>0 && density<=9", TEST_LOCATION );
+ }
+}
+
+static void UtcDaliBubbleEmitterSetBubbleDensity02()
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterSetBubbleDensity " );
+
+ Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+
+ try
+ {
+ emitter.SetBubbleDensity( 10.f );
+ }
+ catch(Dali::DaliException& e)
+ {
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_ASSERT(e, "density>0 && density<=9", TEST_LOCATION );
+ }
+}
+
+static void UtcDaliBubbleEmitterSetBlendMode()
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterSetBlendMode " );
+
+ Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+
+ Actor root = emitter.GetRootActor();
+ MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) );
+
+ BlendingFactor::Type srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha;
+
+ emitter.SetBlendMode( true );
+ bubbleMesh.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
+ DALI_TEST_CHECK( srcFactorRgb == BlendingFactor::SRC_ALPHA );
+ DALI_TEST_CHECK( destFactorRgb == BlendingFactor::ONE );
+ DALI_TEST_CHECK( srcFactorAlpha == BlendingFactor::ZERO );
+ DALI_TEST_CHECK( destFactorAlpha == BlendingFactor::ONE );
+
+ emitter.SetBlendMode( false );
+ bubbleMesh.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
+ DALI_TEST_CHECK( srcFactorRgb == BlendingFactor::SRC_ALPHA );
+ DALI_TEST_CHECK( destFactorRgb == BlendingFactor::ONE_MINUS_SRC_ALPHA );
+ DALI_TEST_CHECK( srcFactorAlpha == BlendingFactor::ONE );
+ DALI_TEST_CHECK( destFactorAlpha == BlendingFactor::ONE_MINUS_SRC_ALPHA );
+}
+
+static void UtcDaliBubbleEmitterEmitBubble()
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterEmitBubble " );
+
+ Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+
+ Actor root = emitter.GetRootActor();
+ MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) );
+ ShaderEffect effect = bubbleMesh.GetShaderEffect();
+ DALI_TEST_CHECK( effect );
+
+ Property::Index propertyIndex0 = effect.GetPropertyIndex( "uPercentage[0]" );
+ Property::Index propertyIndex1 = effect.GetPropertyIndex( "uPercentage[1]" );
+ float value0, value1;
+
+ Animation animation = Animation::New( 0.5f );
+ emitter.EmitBubble( animation, Vector2(40.f,40.f), Vector2(-5.f,-5.f), Vector2(30.f,30.f) );
+ emitter.EmitBubble( animation, Vector2(10.f,10.f), Vector2(5.f,5.f), Vector2(30.f,30.f) );
+ (effect.GetProperty(propertyIndex0)).Get( value0 );
+ (effect.GetProperty(propertyIndex1)).Get( value1 );
+ DALI_TEST_EQUALS(value0, 0.f, TEST_LOCATION );
+ DALI_TEST_EQUALS(value1, 0.f, TEST_LOCATION );
+
+ animation.Play();
+
+ Wait(application, 300);
+ (effect.GetProperty(propertyIndex0)).Get( value0 );
+ (effect.GetProperty(propertyIndex1)).Get( value1 );
+ DALI_TEST_CHECK( value0 >= 0.6f );
+ DALI_TEST_CHECK( value1 >= 0.6f );
+
+ Wait(application, 600);
+ (effect.GetProperty(propertyIndex0)).Get( value0 );
+ (effect.GetProperty(propertyIndex1)).Get( value1 );
+ DALI_TEST_EQUALS(value0, 1.f, TEST_LOCATION );
+ DALI_TEST_EQUALS(value1, 1.f, TEST_LOCATION );
+}
+
+static void UtcDaliBubbleEmitterStartExplosion()
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterStartExplosion " );
+
+ Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+ Actor root = emitter.GetRootActor();
+ MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) );
+ ShaderEffect effect = bubbleMesh.GetShaderEffect();
+ DALI_TEST_CHECK( effect );
+
+ Property::Index propertyIndex = effect.GetPropertyIndex( "uMagnification" );
+ float value;
+ (effect.GetProperty(propertyIndex)).Get( value );
+ DALI_TEST_EQUALS(value, 1.f, TEST_LOCATION );
+
+ emitter.StartExplosion( 0.4, 4.f );
+
+ Wait(application, 200); // 0.2s
+ (effect.GetProperty(propertyIndex)).Get( value );
+ DALI_TEST_CHECK( value >= 2.f );
+
+ Wait(application, 100); // 0.3s
+ (effect.GetProperty(propertyIndex)).Get( value );
+ DALI_TEST_CHECK( value >= 3.f );
+
+ Wait(application, 100); // 0.4s
+ (effect.GetProperty(propertyIndex)).Get( value );
+ DALI_TEST_EQUALS(value, 1.f, TEST_LOCATION );
+}
+
+static void UtcDaliBubbleEmitterRestore()
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliBubbleEmitterRestore " );
+
+ Image shapeImage1 = CreateSolidColorImage( application, Color::GREEN, 5, 5 );
+ BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage1, 200, Vector2( 5.f, 10.f ));
+ Actor root = emitter.GetRootActor();
+ MeshActor bubbleMesh = MeshActor::DownCast( root.GetChildAt( 0 ) );
+ ShaderEffect effect = bubbleMesh.GetShaderEffect();
+ DALI_TEST_CHECK( effect );
+
+ Property::Index percentagePropertyIndex = effect.GetPropertyIndex( "uPercentage[0]" );
+ float percentage;
+
+ Animation animation = Animation::New( 0.5f );
+ emitter.EmitBubble( animation, Vector2(40.f,40.f), Vector2(-5.f,-5.f), Vector2(30.f,30.f) );
+ (effect.GetProperty(percentagePropertyIndex)).Get( percentage );
+ DALI_TEST_EQUALS(percentage, 0.f, TEST_LOCATION );
+
+ animation.Play();
+ Wait(application, 200);
+ animation.Clear();
+
+ (effect.GetProperty(percentagePropertyIndex)).Get( percentage );
+ DALI_TEST_CHECK( percentage < 0.5f && percentage >= 0.4);
+
+ emitter.Restore();
+ application.SendNotification();
+ application.Render();
+
+ (effect.GetProperty(percentagePropertyIndex)).Get( percentage );
+ DALI_TEST_EQUALS(percentage, 1.f, TEST_LOCATION );
+}
diff --git a/automated-tests/dali-test-suite/builder/.gitignore b/automated-tests/dali-test-suite/builder/.gitignore
new file mode 100644
index 0000000..12fbec7
--- /dev/null
+++ b/automated-tests/dali-test-suite/builder/.gitignore
@@ -0,0 +1,2 @@
+utc-Dali-Builder
+utc-Dali-JsonParser
diff --git a/automated-tests/dali-test-suite/builder/Makefile b/automated-tests/dali-test-suite/builder/Makefile
new file mode 120000
index 0000000..c88d5a7
--- /dev/null
+++ b/automated-tests/dali-test-suite/builder/Makefile
@@ -0,0 +1 @@
+../master-makefile.mk
\ No newline at end of file
diff --git a/automated-tests/dali-test-suite/builder/file.list b/automated-tests/dali-test-suite/builder/file.list
new file mode 100644
index 0000000..b178c6f
--- /dev/null
+++ b/automated-tests/dali-test-suite/builder/file.list
@@ -0,0 +1,3 @@
+TARGETS += \
+ Dali/utc-Dali-Builder \
+ Dali/utc-Dali-JsonParser \
diff --git a/automated-tests/dali-test-suite/builder/tslist b/automated-tests/dali-test-suite/builder/tslist
new file mode 100644
index 0000000..d5d6ef9
--- /dev/null
+++ b/automated-tests/dali-test-suite/builder/tslist
@@ -0,0 +1,2 @@
+/dali-test-suite/builder/utc-Dali-Builder
+/dali-test-suite/builder/utc-Dali-JsonParser
diff --git a/automated-tests/dali-test-suite/builder/utc-Dali-Builder.cpp b/automated-tests/dali-test-suite/builder/utc-Dali-Builder.cpp
new file mode 100644
index 0000000..78a4669
--- /dev/null
+++ b/automated-tests/dali-test-suite/builder/utc-Dali-Builder.cpp
@@ -0,0 +1,393 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+#include
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+//
+// Note: To avoid escaping double quotes single quotes are used and then replaced
+// before parsing. JSON uses double quotes
+//
+ std::string JSON_TEXTSTYLE_ONLY("\
+{ \
+ 'text-styles': \
+ { \
+ 'title-text-style':{'font-name': 'Vera', \
+ 'font-style': 'Bold', \
+ 'point-size': 12.0, \
+ 'weight': 'light', \
+ 'text-color': [0.0,0.5,0.5,1], \
+ 'italic': false, \
+ 'underline': false, \
+ 'shadow': true, \
+ 'glow': true, \
+ 'outline': true, \
+ 'shadow-color': [0.0,1.0,0.0,1.0], \
+ 'shadow-offset': [3.0,2.0], \
+ 'shadow-size': 2.0, \
+ 'glow-color': [0.9,0.6,0.3,1.0], \
+ 'glow-intensity':0.1, \
+ 'smooth-edge': 0.45, \
+ 'outline-color': [1.0,0.5,0.0,1.0], \
+ 'outline-thickness': [0.7,0.6] \
+ } \
+ } \
+} \
+");
+
+ std::string JSON_TEXT_ACTOR("\
+{ \
+ 'styles': \
+ { \
+ 'basic-text': \
+ { \
+ 'type':'TextActor', \
+ 'text':'Hello', \
+ 'font':'', \
+ 'parent-origin':[0.0,0.0,0], \
+ 'anchor-point' :[0.5,0.5,0], \
+ 'size': [150,170,1], \
+ 'position':[-10,10,0] \
+ } \
+ }, \
+ 'animations': \
+ { \
+ 'rotate': \
+ { \
+ 'duration': 10, \
+ 'properties': \
+ [ \
+ { \
+ 'actor':'text', \
+ 'property':'rotation', \
+ 'value':[0, 3, 0, 0], \
+ 'alpha-function': 'EASE_IN_OUT', \
+ 'time-period': {'delay': 0, 'duration': 3 } \
+ } \
+ ] \
+ } \
+ }, \
+ 'stage': \
+ [ \
+ { \
+ 'name':'text', \
+ 'type':'basic-text', \
+ 'text':'Hello' \
+ } \
+ ], \
+ 'other': \
+ [ \
+ { \
+ 'name':'other-text', \
+ 'type':'basic-text', \
+ 'text':'Hello' \
+ } \
+ ] \
+} \
+");
+
+
+ std::string JSON_CORE_ACTOR_TREE("\
+{ \
+ 'styles': \
+ { \
+ 'my-camera': { \
+ 'type':'CameraActor', \
+ 'camera-type':'FreeLook', \
+ 'field-of-view': 0.125, \
+ 'aspect-ratio':5.0, \
+ 'near-plane-distance': 100, \
+ 'far-plane-distance': 200 \
+ }, \
+ 'basic-text': { \
+ 'type':'TextActor', \
+ 'text':'Hello', \
+ 'font':'Freesans', \
+ 'smooth-edge':0.2, \
+ 'position': [-10.0, 10.0, -1000.0], \
+ 'size': [300.0, 250.0, 0.0] \
+ }, \
+ 'theme2-text': { \
+ 'type':'TextActor', \
+ 'text':'Hello', \
+ 'font':'Freesans', \
+ 'smooth-edge':0.8 \
+ } \
+ }, \
+ 'stage': \
+ [ \
+ {'name':'txt1', \
+ 'type':'TextActor', \
+ 'text':'Hello World', \
+ 'font':'freesans', \
+ 'parent-origin':'CENTER', \
+ 'actors': \
+ [ \
+ { 'type':'basic-text', 'text':'Hello', 'position-y':50 }, \
+ { 'type':'basic-text', 'text':'Hello', 'position-y':100 }, \
+ { 'type':'basic-text', 'text':'Hello', 'position-y':150 }, \
+ { 'type':'basic-text', 'text':'Hello', 'position-y':200 }, \
+ { 'type':'basic-text', 'text':'Hello', 'position-y':250 } \
+ ] \
+ } \
+ ] \
+} \
+");
+
+
+ std::string ReplaceQuotes(const std::string &in_s)
+ {
+ std::string s(in_s);
+ // wrong as no embedded quote but had regex link problems
+ std::replace(s.begin(), s.end(), '\'', '"');
+ return s;
+ }
+
+} // namespace
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+static void UtcDaliBuilderTextActorCreateFromStyle();
+static void UtcDaliBuilderTextActorCreateAnimation();
+static void UtcDaliBuilderTextActorApplyFromStyle();
+static void UtcDaliBuilderStyles();
+static void UtcDaliBuilderAddActorsOther();
+static void UtcDaliBuilderAddActors();
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+extern "C" {
+ struct tet_testlist tet_testlist[] = {
+ { UtcDaliBuilderTextActorCreateFromStyle, POSITIVE_TC_IDX },
+ { UtcDaliBuilderTextActorCreateAnimation, POSITIVE_TC_IDX },
+ { UtcDaliBuilderTextActorApplyFromStyle, POSITIVE_TC_IDX },
+ { UtcDaliBuilderStyles, POSITIVE_TC_IDX },
+ { UtcDaliBuilderAddActorsOther, POSITIVE_TC_IDX },
+ { UtcDaliBuilderAddActors, POSITIVE_TC_IDX },
+ { NULL, 0 }
+ };
+}
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliBuilderTextActorCreateFromStyle()
+{
+ ToolkitTestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ tet_infoline(" UtcDaliBuilderTextActorCreateFromStyle");
+
+ Builder builder = Builder::New();
+
+ builder.LoadFromString(ReplaceQuotes(JSON_TEXT_ACTOR));
+
+ TextActor actor( TextActor::DownCast( builder.CreateFromStyle("basic-text") ) );
+
+ DALI_TEST_CHECK( actor );
+
+ stage.GetRootLayer().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector3 v;
+
+ v = actor.GetCurrentPosition();
+ DALI_TEST_CHECK(v.x == -10.0);
+ DALI_TEST_CHECK(v.y == 10.0);
+ DALI_TEST_CHECK(v.z == 0.0);
+
+ v = actor.GetCurrentSize();
+ DALI_TEST_CHECK(v.x == 150.0);
+ DALI_TEST_CHECK(v.y == 170.0);
+ DALI_TEST_CHECK(v.z == 1.0);
+
+ DALI_TEST_CHECK(actor.GetText() == "Hello");
+
+ actor = TextActor::DownCast( builder.CreateFromStyle("*(&^") );
+ DALI_TEST_CHECK(!actor);
+
+}
+
+static void UtcDaliBuilderTextActorCreateAnimation()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliBuilderTextActorCreateAnimation");
+
+ Builder builder = Builder::New();
+
+ builder.LoadFromString(ReplaceQuotes(JSON_TEXT_ACTOR));
+
+ builder.AddActors( Stage::GetCurrent().GetRootLayer() );
+
+ Animation anim = builder.CreateAnimation("rotate");
+ DALI_TEST_CHECK( anim );
+
+ DALI_TEST_CHECK( 10.0f == anim.GetDuration() );
+
+}
+
+static void UtcDaliBuilderTextActorApplyFromStyle()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliBuilderTextActorApplyFromStyle");
+
+ Builder builder = Builder::New();
+
+ builder.LoadFromString(ReplaceQuotes(JSON_TEXT_ACTOR));
+
+ TextActor actor = TextActor::New("a");
+
+ builder.ApplyStyle("basic-text", actor);
+
+ DALI_TEST_CHECK( actor );
+
+ Stage::GetCurrent().GetRootLayer().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector3 v;
+
+ v = actor.GetCurrentPosition();
+ DALI_TEST_CHECK(v.x == -10.0);
+ DALI_TEST_CHECK(v.y == 10.0);
+ DALI_TEST_CHECK(v.z == 0.0);
+
+ v = actor.GetCurrentSize();
+ DALI_TEST_CHECK(v.x == 150.0);
+ DALI_TEST_CHECK(v.y == 170.0);
+ DALI_TEST_CHECK(v.z == 1.0);
+
+ DALI_TEST_CHECK(actor.GetText() == "Hello");
+
+}
+
+static void UtcDaliBuilderAddActors()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliBuilderAddActors");
+
+ Builder builder = Builder::New();
+
+ builder.LoadFromString(ReplaceQuotes(JSON_TEXT_ACTOR));
+
+ builder.AddActors( Stage::GetCurrent().GetRootLayer() );
+
+ application.SendNotification();
+ application.Render();
+
+ TextActor actor = TextActor::DownCast( Stage::GetCurrent().GetRootLayer().FindChildByName("text") );
+
+ DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor.GetText() == "Hello");
+
+}
+
+static void UtcDaliBuilderAddActorsOther()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliBuilderAddActorsOther");
+
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+
+ Builder builder = Builder::New();
+
+ builder.LoadFromString(ReplaceQuotes(JSON_TEXT_ACTOR));
+
+ builder.AddActors( "other", rootActor );
+
+ application.SendNotification();
+ application.Render();
+
+ TextActor actor = TextActor::DownCast( Stage::GetCurrent().GetRootLayer().FindChildByName("other-text") );
+
+ DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor.GetText() == "Hello");
+
+}
+
+
+static void UtcDaliBuilderStyles()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliBuilderStyles");
+
+ Builder builder = Builder::New();
+
+ builder.LoadFromString(ReplaceQuotes(JSON_CORE_ACTOR_TREE));
+
+ BaseHandle handle = builder.CreateFromStyle("my-camera");
+ CameraActor camera = CameraActor::DownCast(handle);
+
+ DALI_TEST_CHECK(camera);
+
+ Property::Value v;
+
+ v = camera.GetProperty( camera.GetPropertyIndex("field-of-view") );
+ DALI_TEST_CHECK( 0.125f == v.Get() );
+
+ v = camera.GetProperty( camera.GetPropertyIndex("aspect-ratio") );
+ DALI_TEST_CHECK( 5.0f == v.Get() );
+
+ handle = builder.CreateFromStyle("basic-text");
+ TextActor textActor = TextActor::DownCast(handle);
+
+ v = textActor.GetProperty( textActor.GetPropertyIndex("smooth-edge") );
+
+ DALI_TEST_CHECK( 0.2f == v.Get() );
+
+ // test ApplyStyle another
+ builder.ApplyStyle("theme2-text", textActor);
+
+ v = textActor.GetProperty( textActor.GetPropertyIndex("smooth-edge") );
+ DALI_TEST_CHECK( 0.8f == v.Get() );
+
+}
diff --git a/automated-tests/dali-test-suite/builder/utc-Dali-JsonParser.cpp b/automated-tests/dali-test-suite/builder/utc-Dali-JsonParser.cpp
new file mode 100644
index 0000000..0fd1aca
--- /dev/null
+++ b/automated-tests/dali-test-suite/builder/utc-Dali-JsonParser.cpp
@@ -0,0 +1,640 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+
+#include
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+TEST_FUNCTION( UtcDaliJsonParserMethod01, NEGATIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliJsonParserMethod02, NEGATIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliJsonParserMethod03, NEGATIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliJsonParserMethod04, NEGATIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliJsonParserMethod05, NEGATIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliJsonParserMethod06, NEGATIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliJsonParserMethod07, NEGATIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliJsonParserMethod08, NEGATIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliJsonParserMethod09, NEGATIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliJsonParserMethod10, NEGATIVE_TC_IDX );
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+std::string ReplaceQuotes(const std::string &in_s)
+{
+ std::string s(in_s);
+ // wrong as no embedded quote but had regex link problems
+ std::replace(s.begin(), s.end(), '\'', '"');
+ return s;
+}
+
+
+static void UtcDaliJsonParserMethod01()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON basic test");
+
+ std::string s1( ReplaceQuotes("\
+{ \
+ 'string':'value2', \
+ 'integer':2, \
+ 'float':2.0, \
+ 'boolean':true, \
+ 'nil':null, \
+ 'array':[1,2,3], \
+ 'object':{'key':'value'} \
+} \
+"));
+
+ JsonParser parser = JsonParser::New();
+
+ parser.Parse( s1 );
+
+ if(parser.ParseError())
+ {
+ std::cout << "Error: " << parser.GetErrorDescription() << std::endl;
+ std::cout << " at: " << parser.GetErrorLineNumber() << "(" << parser.GetErrorPosition() << ")" << std::endl;
+ }
+
+ DALI_TEST_CHECK(!parser.ParseError());
+
+ const TreeNode* root = parser.GetRoot();
+
+ DALI_TEST_CHECK(root);
+
+ DALI_TEST_CHECK(root->Size());
+
+ TreeNode::ConstIterator iter = root->CBegin();
+ DALI_TEST_CHECK(iter != root->CEnd());
+
+ const TreeNode* node = NULL;
+
+ node = &((*iter).second);
+ DALI_TEST_CHECK(node);
+ DALI_TEST_CHECK(node->GetType() == TreeNode::STRING);
+ DALI_TEST_CHECK(std::string((*iter).first) == std::string("string"));
+ DALI_TEST_CHECK(std::string(node->GetString()) == std::string("value2"));
+
+ ++iter;
+ DALI_TEST_CHECK(iter != root->CEnd());
+ node = &((*iter).second);
+ DALI_TEST_CHECK(node);
+ DALI_TEST_CHECK(node->GetType() == TreeNode::INTEGER);
+ DALI_TEST_CHECK(std::string((*iter).first) == std::string("integer"));
+ DALI_TEST_CHECK(node->GetInteger() == 2);
+
+ ++iter;
+ DALI_TEST_CHECK(iter != root->CEnd());
+ node = &((*iter).second);
+ DALI_TEST_CHECK(node);
+ DALI_TEST_CHECK(node->GetType() == TreeNode::FLOAT);
+ DALI_TEST_CHECK(std::string((*iter).first) == std::string("float"));
+ DALI_TEST_CHECK(node->GetFloat() == 2.0);
+
+ ++iter;
+ DALI_TEST_CHECK(iter != root->CEnd());
+ node = &((*iter).second);
+ DALI_TEST_CHECK(node);
+ DALI_TEST_CHECK(node->GetType() == TreeNode::BOOLEAN);
+ DALI_TEST_CHECK(std::string((*iter).first) == std::string("boolean"));
+ DALI_TEST_CHECK(node->GetBoolean());
+
+ ++iter;
+ DALI_TEST_CHECK(iter != root->CEnd());
+ node = &((*iter).second);
+ DALI_TEST_CHECK(node);
+ DALI_TEST_CHECK(node->GetType() == TreeNode::IS_NULL);
+ DALI_TEST_CHECK(std::string((*iter).first) == std::string("nil"));
+
+ ++iter;
+ DALI_TEST_CHECK(iter != root->CEnd());
+ node = &((*iter).second);
+ DALI_TEST_CHECK(node);
+ DALI_TEST_CHECK(node->GetType() == TreeNode::ARRAY);
+ DALI_TEST_CHECK(node->Size() == 3);
+ TreeNode::ConstIterator iterArray = node->CBegin();
+
+ DALI_TEST_CHECK(iterArray != node->CEnd());
+ DALI_TEST_CHECK( ((*iterArray).second).GetType() == TreeNode::INTEGER);
+ DALI_TEST_CHECK( (*iterArray).first == NULL );
+ DALI_TEST_CHECK( ((*iterArray).second).GetInteger() == 1);
+
+ ++iterArray;
+ DALI_TEST_CHECK(iterArray != node->CEnd());
+ DALI_TEST_CHECK( ((*iterArray).second).GetType() == TreeNode::INTEGER);
+ DALI_TEST_CHECK( (*iterArray).first == NULL );
+ DALI_TEST_CHECK( ((*iterArray).second).GetInteger() == 2);
+
+ ++iterArray;
+ DALI_TEST_CHECK(iterArray != node->CEnd());
+ DALI_TEST_CHECK( ((*iterArray).second).GetType() == TreeNode::INTEGER);
+ DALI_TEST_CHECK( (*iterArray).first == NULL );
+ DALI_TEST_CHECK( ((*iterArray).second).GetInteger() == 3);
+
+ ++iter;
+ DALI_TEST_CHECK(iter != root->CEnd());
+ node = &((*iter).second);
+ DALI_TEST_CHECK(node);
+ DALI_TEST_CHECK(node->GetType() == TreeNode::OBJECT);
+ DALI_TEST_CHECK(node->Size() == 1);
+
+ TreeNode::ConstIterator iterObject = node->CBegin();
+ DALI_TEST_CHECK(iterObject != node->CEnd());
+ DALI_TEST_CHECK( ((*iterObject).second).GetType() == TreeNode::STRING);
+ DALI_TEST_CHECK( std::string((*iterObject).first) == std::string("key" ));
+ DALI_TEST_CHECK( std::string(((*iterObject).second).GetString()) == std::string("value"));
+
+ tet_result(TET_PASS);
+}
+
+static void UtcDaliJsonParserMethod02()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON Comments");
+
+ std::string s1( ReplaceQuotes(" \
+// some comments with empty line above \n\
+{ \
+ // inline comments \n\
+ 'key':'value', // endline comments \n\
+ // more inline comments \n\
+ 'key2':'value2' \
+} \
+"));
+
+ JsonParser parser = JsonParser::New();
+
+ parser.Parse( s1 );
+
+ if(parser.ParseError())
+ {
+ std::cout << "Error: " << parser.GetErrorDescription() << std::endl;
+ std::cout << " at: " << parser.GetErrorLineNumber() << "(" << parser.GetErrorPosition() << ")" << std::endl;
+ }
+
+ DALI_TEST_CHECK(!parser.ParseError());
+
+ const TreeNode* root = parser.GetRoot();
+
+ DALI_TEST_CHECK(root);
+
+ DALI_TEST_CHECK(root->Size());
+
+ const TreeNode& node = (*root->CBegin()).second;
+
+ DALI_TEST_CHECK(node.GetType() == TreeNode::STRING);
+
+ DALI_TEST_CHECK(node.GetString() == std::string("value"));
+
+ DALI_TEST_CHECK((*root->CBegin()).first == std::string("key"));
+
+ tet_result(TET_PASS);
+}
+
+
+static void UtcDaliJsonParserMethod03()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON Empty line comment");
+
+ std::string s1( ReplaceQuotes(
+"/*\n" \
+"c comment\n" \
+"*/"\
+"// next empty line comment\n"\
+"//\n"\
+"{\n"\
+" 'key':'value'\n"\
+"}\n"\
+));
+
+ JsonParser parser = JsonParser::New();
+
+ parser.Parse( s1 );
+
+ if(parser.ParseError())
+ {
+ std::cout << "Error: " << parser.GetErrorDescription() << std::endl;
+ std::cout << " at: " << parser.GetErrorLineNumber() << "(" << parser.GetErrorPosition() << ")" << std::endl;
+ }
+
+ DALI_TEST_CHECK(!parser.ParseError());
+
+ const TreeNode* root = parser.GetRoot();
+
+ DALI_TEST_CHECK(root);
+
+ DALI_TEST_CHECK(root->Size());
+
+ const TreeNode& node = (*root->CBegin()).second;
+
+ DALI_TEST_CHECK(node.GetType() == TreeNode::STRING);
+
+ DALI_TEST_CHECK(node.GetString() == std::string("value"));
+
+ DALI_TEST_CHECK((*root->CBegin()).first == std::string("key"));
+
+ tet_result(TET_PASS);
+}
+
+static void UtcDaliJsonParserMethod04()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON Merge");
+
+ std::string s1( ReplaceQuotes(" \
+{ \
+ 'animations': \
+ { \
+ 'bump': \
+ { \
+ 'properties': \
+ [ \
+ { \
+ 'actor':'bump-image', \
+ 'property':'uLightPosition', \
+ 'value':[0.8, 0.0, -1.5], \
+ 'alpha-function': 'BOUNCE', \
+ 'time-period': { 'duration': 2.5 } \
+ } \
+ ] \
+ } \
+ } \
+} \
+"));
+
+ std::string s2( ReplaceQuotes(" \
+{ \
+ 'animations': \
+ { \
+ 'bump': \
+ { \
+ 'duration': 5.0, \
+ 'loop': true, \
+ 'end-action':'DISCARD' \
+ } \
+ } \
+} \
+"));
+
+ JsonParser parser = JsonParser::New();
+
+ parser.Parse( s1 );
+
+ if(parser.ParseError())
+ {
+ std::cout << "Error: " << parser.GetErrorDescription() << std::endl;
+ std::cout << " at: " << parser.GetErrorLineNumber() << "(" << parser.GetErrorPosition() << ")" << std::endl;
+ }
+ DALI_TEST_CHECK(!parser.ParseError());
+
+ parser.Parse( s2 );
+
+ if(parser.ParseError())
+ {
+ std::cout << "Error: " << parser.GetErrorDescription() << std::endl;
+ std::cout << " at: " << parser.GetErrorLineNumber() << "(" << parser.GetErrorPosition() << ")" << std::endl;
+ }
+
+ DALI_TEST_CHECK(!parser.ParseError());
+
+ const TreeNode* root = parser.GetRoot();
+ DALI_TEST_CHECK(root);
+
+ const TreeNode *node = root->Find("bump");
+ DALI_TEST_CHECK(node);
+
+ DALI_TEST_CHECK(static_cast(node->Size()) == 4);
+
+ DALI_TEST_CHECK( node->GetChild("duration") );
+ DALI_TEST_CHECK( node->GetChild("loop") );
+ DALI_TEST_CHECK( node->GetChild("properties") );
+
+
+ tet_result(TET_PASS);
+}
+
+static void UtcDaliJsonParserMethod05()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON Pack & Write");
+
+ std::string s1( ReplaceQuotes(" \
+{ \
+ 'animations': \
+ { \
+ 'bump': \
+ { \
+ 'properties': \
+ [ \
+ { \
+ 'actor':'bump-image', \
+ 'property':'uLightPosition', \
+ 'value':[0.8, 0.0, -1.5], \
+ 'alpha-function': 'BOUNCE', \
+ 'time-period': { 'duration': 2.5 } \
+ } \
+ ] \
+ } \
+ } \
+} \
+"));
+
+ JsonParser parser = JsonParser::New();
+
+ parser.Parse( s1 );
+
+ if(parser.ParseError())
+ {
+ std::cout << "Error: " << parser.GetErrorDescription() << std::endl;
+ std::cout << " at: " << parser.GetErrorLineNumber() << "(" << parser.GetErrorPosition() << ")" << std::endl;
+ }
+ DALI_TEST_CHECK(!parser.ParseError());
+
+ std::stringstream a;
+ parser.Write(a, 2);
+
+ parser.Pack();
+
+ std::stringstream b;
+ parser.Write(b, 2);
+
+ DALI_TEST_CHECK( a.str() == b.str() );
+
+ tet_result(TET_PASS);
+}
+
+
+static const int NUMBER_OK_TESTS = 36;
+char *TEST_OK[NUMBER_OK_TESTS] = {
+ "{ 'hex': '\u0123\u4567\u89AB\uCDEF\uabcd\uef4A' }",
+ "{ 'special': '`1~!@#$%^&*()_+-={:[,]}|;.>?' }",
+ "{ 'slash': '/ & \' }",
+ "{'object with 1 member':['array with 1 element']}",
+ "[{}, [], -42, true, false, null]",
+ "{ 'integer': 1234567890 }",
+ "{ 'integer': 1234567890 }",
+ "{ 'real': -9876.543210 }",
+ "{ 'e': 0.123456789e-12 }",
+ "{ 'E': 1.234567890E+34 }",
+ "{ '': 23456789012E66 }",
+ "{ 'zero': 0 }",
+ "{ 'one': 1 }",
+ "{ 'space': ' ' }",
+ "{ 'backslash': '\' }",
+ "{ 'controls': '\\b\\f\\n\\r\\t' }",
+ "{ 'alpha': 'abcdefghijklmnopqrstuvwyz' }",
+ "{ 'ALPHA': 'ABCDEFGHIJKLMNOPQRSTUVWYZ' }",
+ "{ 'digit': '0123456789' }",
+ "{ '0123456789': 'digit' }",
+ "{ 'true': true }",
+ "{ 'false': false }",
+ "{ 'null': null }",
+ "{ 'array':[ ] }",
+ "{ 'object':{ } }",
+ "{ 'address': '1 Communication Centre. South Street' }",
+ "{ 'url': 'http://www.JSON.org/' }",
+ "{ 'comment': '// /* */': ' ' }",
+ "{ ' s p a c e d ' :[1,2 , 3,4 , 5 , 6 ,7 ]}",
+ "{ 'compact':[1,2,3,4,5,6,7]}",
+ "{ 'quotes': '" \\u0022 %22 0x22 034 "' }",
+ "{ '\\uCAFE\\uBABE\\uAB98\\uFCDE\\ubcda\\uef4A\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:': 'A key can be any string'}",
+ "[ 0.5 ,98.6, 99.44,1066,1e1,0.1e1,1e-1,1e00,2e+00,2e-00, 'rosebud']",
+ "{'JSON Test Pattern pass3': { 'The outermost value': 'must be an object or array.', 'In this test': 'It is an object.' } }",
+ "[[[[[[[[[[[[[[[[[[['Not too deep']]]]]]]]]]]]]]]]]]]",
+};
+
+
+static void UtcDaliJsonParserMethod06()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON Parse Success");
+
+ JsonParser parser = JsonParser::New();
+
+ for(int i = 0; i < NUMBER_OK_TESTS; ++i)
+ {
+ parser = JsonParser::New();
+
+ parser.Parse( ReplaceQuotes(TEST_OK[i]) );
+
+ if(parser.ParseError())
+ {
+ tet_printf("Valid JSON parse test %d Failed", i);
+ tet_printf("%s", ReplaceQuotes(TEST_OK[i]).c_str());
+
+ tet_printf("JSON Error %d:%d: %s (%d)", parser.GetErrorLineNumber(), parser.GetErrorColumn(), parser.GetErrorDescription().c_str(), parser.GetErrorPosition());
+ }
+
+ DALI_TEST_CHECK(!parser.ParseError());
+ }
+
+ tet_result(TET_PASS);
+}
+
+
+static const int NUMBER_FAIL_TESTS = 32;
+char *TEST_FAIL[] = {
+ "[' tab\t character \t in\t string ']",
+ "['Extra close']]",
+ "['Colon instead of comma': false]",
+ "{'Numbers cannot have leading zeroes': 013}",
+ "['Bad value', truth]",
+ "['Illegal backslash escape: \017']",
+ "['Bad value', truth]['Illegal backslash escape: \017']",
+ "{'Comma instead if closing brace': true,",
+ "{'Double colon':: null}",
+ "{'Extra comma': true,}",
+ "['Unclosed array'",
+ "{'Illegal invocation': alert()}",
+ "{'Missing colon' null}",
+ "[0e]",
+ "{unquoted_key: 'keys must be quoted'}",
+ "'A JSON payload should be an object or array, not a string.'",
+ "[\naked]",
+ "{'Illegal expression': 1 + 2}",
+ "{'Extra value after close': true} 'misplaced quoted value'",
+ "[0e+]",
+ "[+23456789012E66]",
+ "['extra comma',]",
+ "['Comma after the close'],",
+ "['double extra comma',,]",
+ "['Illegal backslash escape: \x15']",
+ "['line\nbreak']",
+ "{'Comma instead of colon', null}",
+ "['mismatch'}",
+ "['line\nbreak']",
+ "[0e+-1]",
+ "{'Numbers cannot be hex': 0x14}",
+ "[ , '<-- missing value']",
+};
+
+static void UtcDaliJsonParserMethod07()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON Fail");
+
+ JsonParser parser = JsonParser::New();
+
+ for(int i = 0; i < NUMBER_FAIL_TESTS; ++i)
+ {
+ parser = JsonParser::New();
+
+ parser.Parse( ReplaceQuotes(TEST_FAIL[i]) );
+
+ if(!parser.ParseError())
+ {
+ tet_printf("Invalid JSON parse test %d Failed", i);
+ tet_printf("%s", ReplaceQuotes(TEST_FAIL[i]).c_str());
+ tet_printf("JSON Error %d:%d %s (%s)", parser.GetErrorLineNumber(), parser.GetErrorColumn(),
+ parser.GetErrorDescription().c_str(), parser.GetErrorPosition());
+ }
+
+ DALI_TEST_CHECK(parser.ParseError());
+ }
+
+
+ parser = JsonParser::New();
+
+ parser.Parse( "['single quote']" );
+
+ if(!parser.ParseError())
+ {
+ tet_printf("['single quote']");
+ }
+
+ DALI_TEST_CHECK(parser.ParseError());
+
+ tet_result(TET_PASS);
+}
+
+static void UtcDaliJsonParserMethod08()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON error reporting");
+
+ std::string s1( ReplaceQuotes("\
+{ \n\
+ 'float':,], \n\
+} \n\
+"));
+
+ JsonParser parser = JsonParser::New();
+
+ parser.Parse( s1 );
+
+ DALI_TEST_CHECK(parser.ParseError());
+
+ DALI_TEST_CHECK(1 == parser.GetErrorLineNumber());
+ DALI_TEST_CHECK(53 == parser.GetErrorPosition());
+ DALI_TEST_CHECK(11 == parser.GetErrorColumn());
+
+ tet_result(TET_PASS);
+}
+
+static void UtcDaliJsonParserMethod09()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON Pack()");
+
+ std::string s1( ReplaceQuotes("\
+{ \
+ 'string':'value2', \
+ 'integer':2, \
+ 'float':2.3, \
+ 'boolean':true, \
+ 'nil':null, \
+ 'array':[1,2,3], \
+ 'object':{'key':'value'} \
+} \
+"));
+
+ JsonParser parser = JsonParser::New();
+
+ parser.Parse( s1 );
+
+ std::stringstream ss1;
+ parser.Write(ss1, 2);
+
+ parser.Pack(); // Pack() moves strings
+
+ std::stringstream ss2;
+ parser.Write(ss2, 2);
+
+ DALI_TEST_CHECK(ss1.str() == ss2.str());
+
+ tet_result(TET_PASS);
+}
+
+static void UtcDaliJsonParserMethod10()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("JSON basic test");
+
+ std::string s1( "" );
+
+ JsonParser parser = JsonParser::New();
+
+ parser.Parse( s1 );
+
+ DALI_TEST_CHECK(parser.ParseError());
+
+ tet_result(TET_PASS);
+}
diff --git a/automated-tests/dali-test-suite/buttons/.gitignore b/automated-tests/dali-test-suite/buttons/.gitignore
new file mode 100644
index 0000000..f4f0d52
--- /dev/null
+++ b/automated-tests/dali-test-suite/buttons/.gitignore
@@ -0,0 +1,3 @@
+utc-Dali-CheckBoxButton
+utc-Dali-PushButton
+utc-Dali-Button
diff --git a/automated-tests/dali-test-suite/buttons/Makefile b/automated-tests/dali-test-suite/buttons/Makefile
new file mode 120000
index 0000000..c88d5a7
--- /dev/null
+++ b/automated-tests/dali-test-suite/buttons/Makefile
@@ -0,0 +1 @@
+../master-makefile.mk
\ No newline at end of file
diff --git a/automated-tests/dali-test-suite/buttons/file.list b/automated-tests/dali-test-suite/buttons/file.list
new file mode 100644
index 0000000..3a8cef4
--- /dev/null
+++ b/automated-tests/dali-test-suite/buttons/file.list
@@ -0,0 +1,4 @@
+TARGETS += \
+ utc-Dali-CheckBoxButton \
+ utc-Dali-PushButton \
+ utc-Dali-Button \
diff --git a/automated-tests/dali-test-suite/buttons/tslist b/automated-tests/dali-test-suite/buttons/tslist
new file mode 100644
index 0000000..b8108d0
--- /dev/null
+++ b/automated-tests/dali-test-suite/buttons/tslist
@@ -0,0 +1,3 @@
+/dali-test-suite/buttons/utc-Dali-CheckBoxButton
+/dali-test-suite/buttons/utc-Dali-PushButton
+/dali-test-suite/buttons/utc-Dali-Button
diff --git a/automated-tests/dali-test-suite/buttons/utc-Dali-Button.cpp b/automated-tests/dali-test-suite/buttons/utc-Dali-Button.cpp
new file mode 100644
index 0000000..41fe94a
--- /dev/null
+++ b/automated-tests/dali-test-suite/buttons/utc-Dali-Button.cpp
@@ -0,0 +1,397 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+#include
+#include
+#include
+
+#include
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+static bool gButtonClicked = false;
+
+static bool ButtonClicked( Button button )
+{
+ gButtonClicked = true;
+ return false;
+}
+
+const Dali::TouchPoint pointDownInside( 0, TouchPoint::Down, 240, 400 );
+const Dali::TouchPoint pointUpInside( 0, TouchPoint::Up, 240, 400 );
+const Dali::TouchPoint pointLeave( 0, TouchPoint::Leave, 240, 400 );
+const Dali::TouchPoint pointEnter( 0, TouchPoint::Motion, 240, 400 );
+const Dali::TouchPoint pointDownOutside( 0, TouchPoint::Down, 10, 10 );
+const Dali::TouchPoint pointUpOutside( 0, TouchPoint::Up, 10, 10 );
+
+static bool gObjectCreatedCallBackCalled;
+
+static void TestObjectCreatedCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+static float ANIMATION_TIME( 0.5f );
+} // namespace
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+static void UtcDaliButtonNew();
+static void UtcDaliButtonSetProperty();
+static void UtcDaliButtonSetGetDimmed();
+static void UtcDaliButtonSize();
+static void UtcDaliButtonClicked();
+static void UtcDaliButtonConnectSignal();
+static void UtcDaliButtonSetGetAnimationTime();
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+extern "C" {
+ struct tet_testlist tet_testlist[] = {
+ { UtcDaliButtonNew, POSITIVE_TC_IDX },
+ { UtcDaliButtonSetProperty, POSITIVE_TC_IDX },
+ { UtcDaliButtonSetGetDimmed, POSITIVE_TC_IDX },
+ { UtcDaliButtonSize, POSITIVE_TC_IDX },
+ { UtcDaliButtonClicked, POSITIVE_TC_IDX },
+ { UtcDaliButtonConnectSignal, POSITIVE_TC_IDX },
+ { UtcDaliButtonSetGetAnimationTime, POSITIVE_TC_IDX },
+ { NULL, 0 }
+ };
+}
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+
+// Positive test case for a method
+static void UtcDaliButtonNew()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliButtonNew");
+
+ CheckBoxButton checkBoxButton = CheckBoxButton::New();
+
+ DALI_TEST_CHECK( checkBoxButton );
+
+ PushButton pushButton = PushButton::New();
+
+ DALI_TEST_CHECK( pushButton );
+
+ CheckBoxButton checkBoxButton2( checkBoxButton );
+
+ DALI_TEST_CHECK( checkBoxButton2 );
+
+ PushButton pushButton2( pushButton );
+
+ DALI_TEST_CHECK( pushButton2 );
+
+ checkBoxButton2 = NULL;
+ pushButton2 = NULL;
+
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestObjectCreatedCallback );
+ {
+ CheckBoxButton checkBoxButton = CheckBoxButton::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestObjectCreatedCallback );
+ {
+ PushButton pushButton = PushButton::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+
+ // Test down cast
+ Handle handleButton;
+ handleButton = pushButton;
+ Button downCastPushButton = Button::DownCast( handleButton );
+ DALI_TEST_CHECK( downCastPushButton );
+ PushButton downCastPushButton2 = PushButton::DownCast( handleButton );
+ DALI_TEST_CHECK( downCastPushButton2 );
+
+ handleButton = checkBoxButton;
+ Button downCastCheckBoxButton = Button::DownCast( handleButton );
+ DALI_TEST_CHECK( downCastCheckBoxButton );
+ CheckBoxButton downCastCheckBoxButton2 = CheckBoxButton::DownCast( handleButton );
+ DALI_TEST_CHECK( downCastCheckBoxButton2 );
+}
+
+static void UtcDaliButtonSetProperty()
+{
+ tet_infoline("UtcDaliButtonSetProperty: ");
+ ToolkitTestApplication application;
+
+ CheckBoxButton checkBoxButton = CheckBoxButton::New();
+ PushButton pushButton = PushButton::New();
+
+ //Test various properties
+ checkBoxButton.SetProperty(checkBoxButton.GetPropertyIndex(Button::PROPERTY_DIMMED), false);
+ DALI_TEST_CHECK( false == checkBoxButton.IsDimmed() );
+ checkBoxButton.SetProperty(checkBoxButton.GetPropertyIndex(Button::PROPERTY_DIMMED), true);
+ DALI_TEST_CHECK( true == checkBoxButton.IsDimmed() );
+
+ pushButton.SetProperty(pushButton.GetPropertyIndex(Button::PROPERTY_DIMMED), false);
+ DALI_TEST_CHECK( false == pushButton.IsDimmed() );
+ pushButton.SetProperty(pushButton.GetPropertyIndex(Button::PROPERTY_DIMMED), true);
+ DALI_TEST_CHECK( true == pushButton.IsDimmed() );
+}
+
+static void UtcDaliButtonSetGetDimmed()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliButtonSetGetDimmed");
+
+ CheckBoxButton checkBoxButton = CheckBoxButton::New();
+ PushButton pushButton = PushButton::New();
+
+ checkBoxButton.SetDimmed( true );
+ pushButton.SetDimmed( true );
+
+ DALI_TEST_CHECK( checkBoxButton.IsDimmed() );
+ DALI_TEST_CHECK( pushButton.IsDimmed() );
+
+ checkBoxButton.SetDimmed( false );
+ pushButton.SetDimmed( false );
+
+ DALI_TEST_CHECK( !checkBoxButton.IsDimmed() );
+ DALI_TEST_CHECK( !pushButton.IsDimmed() );
+
+ checkBoxButton.SetDimmed( true );
+ pushButton.SetDimmed( true );
+
+ DALI_TEST_CHECK( checkBoxButton.IsDimmed() );
+ DALI_TEST_CHECK( pushButton.IsDimmed() );
+
+ checkBoxButton.SetDimmed( false );
+ pushButton.SetDimmed( false );
+
+ DALI_TEST_CHECK( !checkBoxButton.IsDimmed() );
+ DALI_TEST_CHECK( !pushButton.IsDimmed() );
+}
+
+static void UtcDaliButtonSize()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliButtonSize");
+
+ // Creates 100x50 images.
+ ImageActor image01 = CreateSolidColorActor( Color::RED );
+ image01.SetSize( 100, 50 );
+
+ CheckBoxButton checkBoxButton;
+ PushButton pushButton;
+
+ Vector3 size;
+
+ // Test1 Size is set through Actor API
+
+ // First an image is set, then SetSize is called.
+ pushButton = PushButton::New();
+
+ pushButton.SetBackgroundImage( image01 );
+ pushButton.SetSize( 10.f, 10.f );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 10.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION );
+}
+
+static void UtcDaliButtonClicked()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliButtonClicked");
+
+ PushButton pushButton = PushButton::New();
+ pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ pushButton.SetPosition( 240, 400 );
+ pushButton.SetSize( 100, 100 );
+
+ Stage::GetCurrent().Add( pushButton );
+
+ application.SendNotification();
+ application.Render();
+
+ // connect to its touch signal
+ pushButton.ClickedSignal().Connect( &ButtonClicked );
+
+ Dali::Integration::TouchEvent event;
+
+ // Test1. Touch point down and up inside the button.
+
+ gButtonClicked = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( gButtonClicked );
+
+ // Test2. Touch point down and up outside the button.
+
+ gButtonClicked = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownOutside );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpOutside );
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( !gButtonClicked );
+
+ // Test3. Touch point down inside and up outside the button.
+
+ gButtonClicked = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointLeave );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpOutside );
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( !gButtonClicked );
+
+ // Test4. Touch point down outside and up inside the button.
+
+ gButtonClicked = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownOutside );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointEnter );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( !gButtonClicked );
+}
+
+static bool gClickedCallBackCalled;
+
+static bool TestClickedCallback(Button button)
+{
+ gClickedCallBackCalled = true;
+ return true;
+}
+
+static void UtcDaliButtonConnectSignal()
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliButtonConnectSignal()");
+
+ gClickedCallBackCalled = false;
+
+ PushButton pushButton = PushButton::New();
+ pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ pushButton.SetPosition( 240, 400 );
+ pushButton.SetSize( 100, 100 );
+
+ Stage::GetCurrent().Add( pushButton );
+
+ application.SendNotification();
+ application.Render();
+
+ // connect to its clicked signal
+ pushButton.ClickedSignal().Connect(TestClickedCallback);
+
+ Dali::Integration::TouchEvent event;
+
+ // Touch point down and up inside the button.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( gClickedCallBackCalled == true );
+
+ gClickedCallBackCalled = false;
+ pushButton.ClickedSignal().Disconnect(TestClickedCallback);
+
+ // simulate another touch event
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( gClickedCallBackCalled == false );
+}
+
+static void UtcDaliButtonSetGetAnimationTime()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliButtonSetGetAnimationTime");
+
+ CheckBoxButton checkBoxButton = CheckBoxButton::New();
+ PushButton pushButton = PushButton::New();
+
+ checkBoxButton.SetAnimationTime( ANIMATION_TIME );
+ pushButton.SetAnimationTime( ANIMATION_TIME );
+
+ DALI_TEST_EQUALS( checkBoxButton.GetAnimationTime(), ANIMATION_TIME, TEST_LOCATION );
+ DALI_TEST_EQUALS( pushButton.GetAnimationTime(), ANIMATION_TIME, TEST_LOCATION );
+
+}
diff --git a/automated-tests/dali-test-suite/buttons/utc-Dali-CheckBoxButton.cpp b/automated-tests/dali-test-suite/buttons/utc-Dali-CheckBoxButton.cpp
new file mode 100644
index 0000000..ec5fcda
--- /dev/null
+++ b/automated-tests/dali-test-suite/buttons/utc-Dali-CheckBoxButton.cpp
@@ -0,0 +1,230 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+#include
+
+#include
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+Image CreateSolidColorImage( const Vector4& color, unsigned int width, unsigned int height )
+{
+ BitmapImage imageData = BitmapImage::New( width, height, Pixel::RGBA8888 );
+
+ // Create the image
+ PixelBuffer* pixbuf = imageData.GetBuffer();
+ unsigned int size = width * height;
+
+ for( size_t i = 0; i < size; i++ )
+ {
+ pixbuf[i*4+0] = 0xFF * color.r;
+ pixbuf[i*4+1] = 0xFF * color.g;
+ pixbuf[i*4+2] = 0xFF * color.b;
+ pixbuf[i*4+3] = 0xFF * color.a;
+ }
+
+ imageData.Update();
+
+ return imageData;
+}
+
+static bool gCheckBoxButtonState = false;
+bool CheckBoxButtonClicked( Button button )
+{
+ gCheckBoxButtonState = static_cast( button ).IsChecked();
+ return true;
+}
+} // namespace
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( UtcDaliCheckBoxButtonSetGetChecked, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliCheckBoxButtonSetImages, POSITIVE_TC_IDX );
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliCheckBoxButtonSetGetChecked()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCheckBoxButtonSetGetChecked");
+
+ CheckBoxButton checkBoxButton = CheckBoxButton::New();
+ checkBoxButton.ClickedSignal().Connect( &CheckBoxButtonClicked );
+
+ // global var used to check if CheckBoxButtonClicked is called;
+ gCheckBoxButtonState = false;
+
+ checkBoxButton.SetChecked( true );
+
+ DALI_TEST_CHECK( checkBoxButton.IsChecked() );
+ DALI_TEST_CHECK( gCheckBoxButtonState );
+
+ checkBoxButton.SetChecked( false );
+
+ DALI_TEST_CHECK( !checkBoxButton.IsChecked() );
+ DALI_TEST_CHECK( !gCheckBoxButtonState );
+
+ checkBoxButton.SetChecked( true );
+
+ DALI_TEST_CHECK( checkBoxButton.IsChecked() );
+ DALI_TEST_CHECK( gCheckBoxButtonState );
+}
+
+static void UtcDaliCheckBoxButtonSetImages()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliCheckBoxButtonSetImages");
+
+ Actor imageActor;
+
+ Image image01 = CreateSolidColorImage( Color::RED, 10, 10 );
+ ImageActor imageActor01 = CreateSolidColorActor( Color::RED );
+ imageActor01.SetSize( 20, 20 );
+
+ Image image02 = CreateSolidColorImage( Color::RED, 30, 30 );
+ ImageActor imageActor02 = CreateSolidColorActor( Color::RED );
+ imageActor02.SetSize( 40, 40 );
+
+ Image image03 = CreateSolidColorImage( Color::RED, 50, 50 );
+ ImageActor imageActor03 = CreateSolidColorActor( Color::RED );
+ imageActor03.SetSize( 60, 60 );
+
+ Image image04 = CreateSolidColorImage( Color::RED, 70, 70 );
+ ImageActor imageActor04 = CreateSolidColorActor( Color::RED );
+ imageActor04.SetSize( 80, 80 );
+
+ Vector3 size;
+ CheckBoxButton checkBoxButton = CheckBoxButton::New();
+
+ application.SendNotification();
+ application.Render();
+
+ // Just check if check box button size changes when a bigger image is set.
+
+ checkBoxButton.SetBackgroundImage( image01 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = checkBoxButton.GetBackgroundImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 10.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION );
+
+ checkBoxButton.SetBackgroundImage( imageActor01 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = checkBoxButton.GetBackgroundImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 20.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 20.f, TEST_LOCATION );
+
+ checkBoxButton.SetCheckedImage( image02 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = checkBoxButton.GetCheckedImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 30.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 30.f, TEST_LOCATION );
+
+ checkBoxButton.SetCheckedImage( imageActor02 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = checkBoxButton.GetCheckedImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 40.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 40.f, TEST_LOCATION );
+
+ checkBoxButton.SetDimmedBackgroundImage( image03 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = checkBoxButton.GetDimmedBackgroundImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 50.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 50.f, TEST_LOCATION );
+
+ checkBoxButton.SetDimmedBackgroundImage( imageActor03 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = checkBoxButton.GetDimmedBackgroundImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 60.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 60.f, TEST_LOCATION );
+
+ checkBoxButton.SetDimmedCheckedImage( image04 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = checkBoxButton.GetDimmedCheckedImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 70.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 70.f, TEST_LOCATION );
+
+ checkBoxButton.SetDimmedCheckedImage( imageActor04 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = checkBoxButton.GetDimmedCheckedImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 80.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 80.f, TEST_LOCATION );
+}
diff --git a/automated-tests/dali-test-suite/buttons/utc-Dali-PushButton.cpp b/automated-tests/dali-test-suite/buttons/utc-Dali-PushButton.cpp
new file mode 100644
index 0000000..5e13b83
--- /dev/null
+++ b/automated-tests/dali-test-suite/buttons/utc-Dali-PushButton.cpp
@@ -0,0 +1,1263 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+#include
+#include
+#include
+
+#include
+
+#include
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+Image CreateSolidColorImage( const Vector4& color, unsigned int width, unsigned int height )
+{
+ BitmapImage imageData = BitmapImage::New( width, height, Pixel::RGBA8888 );
+
+ // Create the image
+ PixelBuffer* pixbuf = imageData.GetBuffer();
+ unsigned int size = width * height;
+
+ for( size_t i = 0; i < size; i++ )
+ {
+ pixbuf[i*4+0] = 0xFF * color.r;
+ pixbuf[i*4+1] = 0xFF * color.g;
+ pixbuf[i*4+2] = 0xFF * color.b;
+ pixbuf[i*4+3] = 0xFF * color.a;
+ }
+
+ imageData.Update();
+
+ return imageData;
+}
+
+static bool gPushButtonToggleState = false;
+bool PushButtonToggled( Button button, bool toggled )
+{
+ gPushButtonToggleState = toggled && ( toggled == static_cast( button ).IsToggled() );
+ return true;
+}
+
+static bool gPushButtonPressed = false;
+
+static bool PushButtonPressed( Button button )
+{
+ gPushButtonPressed = true;
+ return true;
+}
+
+static bool gPushButtonReleased = false;
+
+static bool PushButtonReleased( Button button )
+{
+ gPushButtonReleased = true;
+ return true;
+}
+
+const Dali::TouchPoint pointDownInside( 0, TouchPoint::Down, 240, 400 );
+const Dali::TouchPoint pointUpInside( 0, TouchPoint::Up, 240, 400 );
+const Dali::TouchPoint pointLeave( 0, TouchPoint::Leave, 240, 400 );
+const Dali::TouchPoint pointEnter( 0, TouchPoint::Motion, 240, 400 );
+const Dali::TouchPoint pointMotionOut( 0, TouchPoint::Motion, 10, 10 );
+const Dali::TouchPoint pointDownOutside( 0, TouchPoint::Down, 10, 10 );
+const Dali::TouchPoint pointUpOutside( 0, TouchPoint::Up, 10, 10 );
+} // namespace
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+//////////////////////////////////////////////////////////
+
+namespace
+{
+static bool gOnTouchPointInterrupted = false;
+} //namespace
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+class TETButton;
+}
+
+/**
+ * Creates a Button to test if interrupt events are handled correctly.
+ */
+class TETButton : public Button
+{
+public:
+ // PushButton Pressed
+ typedef SignalV2< bool ( Button ) > PressedSignalV2;
+
+ PressedSignalV2& PressedSignal();
+
+ /**
+ * Default constructor.
+ */
+ TETButton();
+
+ /**
+ * Copy constructor.
+ */
+ TETButton( const Button& button );
+
+ /**
+ * Assignment operator.
+ */
+ TETButton& operator=( const TETButton& button );
+
+ /**
+ * Creates and initializes a new button.
+ */
+ static TETButton New();
+
+ /**
+ * Down cast to TETButton.
+ */
+ static TETButton DownCast( BaseHandle handle );
+
+ /**
+ * Creates a handle using the Toolkit::Internal implementation.
+ * @param[in] implementation The Control implementation.
+ */
+ TETButton( Internal::TETButton& implementation );
+
+ /**
+ * Allows the creation of this Control from an Internal::CustomActor pointer.
+ * @param[in] internal A pointer to the internal CustomActor.
+ */
+ TETButton( Dali::Internal::CustomActor* internal );
+};
+
+namespace Internal
+{
+
+/**
+ * Internal implementation
+ */
+class TETButton : public Button
+{
+public:
+ /**
+ * Construct a new Button.
+ */
+ TETButton();
+
+ /**
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~TETButton();
+
+ /**
+ * Creates an internal button.
+ */
+ static Toolkit::TETButton New();
+
+ /**
+ * @return the pressed signal.
+ */
+ Toolkit::TETButton::PressedSignalV2& PressedSignal();
+
+ /**
+ * Callback called when an interrupt events is received.
+ */
+ void OnTouchPointInterrupted();
+
+ /**
+ * Callback received when a down event is received.
+ */
+ void OnButtonDown();
+
+ Toolkit::TETButton::PressedSignalV2 mPressedSignal; ///< Signal emitted when the button is pressed.
+};
+
+} // namespace Internal
+
+TETButton::TETButton()
+{
+}
+
+TETButton::TETButton( const Button& button )
+: Button( button )
+{
+}
+
+TETButton& TETButton::operator=( const TETButton& button )
+{
+ if( &button != this )
+ {
+ Button::operator=( button );
+ }
+ return *this;
+}
+
+TETButton TETButton::New()
+{
+ return Internal::TETButton::New();
+}
+
+TETButton TETButton::DownCast( BaseHandle handle )
+{
+ return Control::DownCast(handle);
+}
+
+TETButton::PressedSignalV2& TETButton::PressedSignal()
+{
+ TETButton button( *this );
+ DALI_ASSERT_ALWAYS( button );
+
+ Dali::RefObject& handle = button.GetImplementation();
+
+ return static_cast( handle ).PressedSignal();
+}
+
+TETButton::TETButton( Internal::TETButton& implementation )
+: Button( implementation )
+{}
+
+TETButton::TETButton( Dali::Internal::CustomActor* internal )
+: Button( internal )
+{
+ VerifyCustomActorPointer(internal);
+}
+
+namespace Internal
+{
+
+TETButton::TETButton()
+: Button(),
+ mPressedSignal()
+{
+}
+
+TETButton::~TETButton()
+{
+}
+
+Toolkit::TETButton TETButton::New()
+{
+ // Create the implementation, temporarily owned on stack
+ IntrusivePtr< TETButton > internalTETButton = new TETButton();
+
+ // Pass ownership to CustomActor
+ Dali::Toolkit::TETButton tetButton( *internalTETButton );
+
+ // Second-phase init of the implementation
+ // This can only be done after the CustomActor connection has been made...
+ internalTETButton->Initialize();
+
+ return tetButton;
+}
+
+Toolkit::TETButton::PressedSignalV2& TETButton::PressedSignal()
+{
+ return mPressedSignal;
+}
+
+void TETButton::OnButtonDown()
+{
+ Toolkit::TETButton handle( GetOwner() );
+
+ //Emit signal.
+ mPressedSignal.Emit( handle );
+}
+
+void TETButton::OnTouchPointInterrupted()
+{
+ gOnTouchPointInterrupted = true;
+}
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+namespace
+{
+
+class TETButtonPressed : public Dali::ConnectionTracker
+{
+public:
+ enum Test
+ {
+ SENSITIVENESS,
+ VISIBILITY
+ };
+
+ TETButtonPressed( Actor actor, Test test )
+ : mActor( actor ),
+ mTest( test )
+ {
+ }
+
+ bool Callback( Button button )
+ {
+ switch( mTest )
+ {
+ case SENSITIVENESS:
+ {
+ mActor.SetSensitive( false );
+ break;
+ }
+ case VISIBILITY:
+ {
+ std::cout <<"VISIBILITY false" << std::endl;
+ mActor.SetVisible( false );
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ return true;
+ }
+
+ Actor mActor;
+ Test mTest;
+};
+
+static bool TestCallback(Actor actor, const TouchEvent& event)
+{
+ return true;
+}
+
+} // namespace
+
+//////////////////////////////////////////////////////////
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( UtcDaliPushButtonSetGetAutoRepeating, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPushButtonSetGetToggleButton, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPushButtonSetGetAutoRepeatingAndToggleButton, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPushButtonSetGetToggled01, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPushButtonSetGetToggled02, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPushButtonSetGetAutorepeatingDelayValues01, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPushButtonSetGetAutorepeatingDelayValues02, NEGATIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPushButtonSetImages, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPushButtonSetLabelText, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPushButtonPressed, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPushButtonReleased, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPushButtonToggled, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPushButtonInterruptEventWhenInsensitive, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPushButtonInterruptEventWhenNonVisible, POSITIVE_TC_IDX );
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+
+static void UtcDaliPushButtonSetGetAutoRepeating()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetAutoRepeating");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetAutoRepeating( true );
+
+ DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
+
+ pushButton.SetAutoRepeating( false );
+
+ DALI_TEST_CHECK( !pushButton.IsAutoRepeating() );
+
+ pushButton.SetAutoRepeating( true );
+
+ DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
+}
+
+static void UtcDaliPushButtonSetGetToggleButton()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetToggleButton");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetToggleButton( true );
+
+ DALI_TEST_CHECK( pushButton.IsToggleButton() );
+
+ pushButton.SetToggleButton( false );
+
+ DALI_TEST_CHECK( !pushButton.IsToggleButton() );
+
+ pushButton.SetToggleButton( true );
+
+ DALI_TEST_CHECK( pushButton.IsToggleButton() );
+}
+
+static void UtcDaliPushButtonSetGetAutoRepeatingAndToggleButton()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetAutoRepeatingAndToggleButton");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetAutoRepeating( true );
+ pushButton.SetToggleButton( true );
+
+ DALI_TEST_CHECK( pushButton.IsToggleButton() );
+ DALI_TEST_CHECK( !pushButton.IsAutoRepeating() );
+
+ pushButton.SetToggleButton( true );
+ pushButton.SetAutoRepeating( true );
+
+ DALI_TEST_CHECK( pushButton.IsAutoRepeating() );
+ DALI_TEST_CHECK( !pushButton.IsToggleButton() );
+}
+
+static void UtcDaliPushButtonSetGetToggled01()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetToggled01");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetToggleButton( true );
+ pushButton.ToggledSignal().Connect( &PushButtonToggled );
+
+ gPushButtonToggleState = false;
+ pushButton.SetToggled( true );
+
+ DALI_TEST_CHECK( pushButton.IsToggled() );
+ DALI_TEST_CHECK( gPushButtonToggleState );
+
+ pushButton.SetToggled( false );
+
+ DALI_TEST_CHECK( !pushButton.IsToggled() );
+ DALI_TEST_CHECK( !gPushButtonToggleState );
+
+ pushButton.SetToggled( true );
+
+ DALI_TEST_CHECK( pushButton.IsToggled() );
+ DALI_TEST_CHECK( gPushButtonToggleState );
+}
+
+static void UtcDaliPushButtonSetGetToggled02()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetToggled02");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetToggleButton( false );
+ pushButton.ToggledSignal().Connect( &PushButtonToggled );
+
+ gPushButtonToggleState = false;
+ pushButton.SetToggled( true );
+
+ DALI_TEST_CHECK( !pushButton.IsToggled() );
+ DALI_TEST_CHECK( !gPushButtonToggleState );
+
+ pushButton.SetToggled( false );
+
+ DALI_TEST_CHECK( !pushButton.IsToggled() );
+ DALI_TEST_CHECK( !gPushButtonToggleState );
+
+ pushButton.SetToggled( true );
+
+ DALI_TEST_CHECK( !pushButton.IsToggled() );
+ DALI_TEST_CHECK( !gPushButtonToggleState );
+}
+
+static void UtcDaliPushButtonSetGetAutorepeatingDelayValues01()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues01");
+
+ PushButton pushButton = PushButton::New();
+
+ pushButton.SetAutoRepeating( true );
+
+ pushButton.SetInitialAutoRepeatingDelay( 1.f );
+ DALI_TEST_EQUALS( pushButton.GetInitialAutoRepeatingDelay(), 1.f, TEST_LOCATION );
+
+ pushButton.SetNextAutoRepeatingDelay( 1.f );
+ DALI_TEST_EQUALS( pushButton.GetNextAutoRepeatingDelay(), 1.f, TEST_LOCATION );
+}
+
+static void UtcDaliPushButtonSetGetAutorepeatingDelayValues02()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetGetAutorepeatingDelayValues02");
+
+ PushButton pushButton = PushButton::New();
+
+ bool assert1( false );
+ bool assert2( false );
+
+ pushButton.SetAutoRepeating( true );
+
+ try
+ {
+ pushButton.SetInitialAutoRepeatingDelay( -1.f );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_EQUALS(e.mCondition, "initialAutoRepeatingDelay > 0.f", TEST_LOCATION);
+ assert1 = true;
+ }
+
+ try
+ {
+ pushButton.SetNextAutoRepeatingDelay( -1.f );
+ }
+ catch( Dali::DaliException& e )
+ {
+ tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
+ DALI_TEST_EQUALS(e.mCondition, "nextAutoRepeatingDelay > 0.f", TEST_LOCATION);
+ assert2 = true;
+ }
+
+ DALI_TEST_CHECK( assert1 && assert2 );
+}
+
+static void UtcDaliPushButtonSetImages()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetImages");
+
+ Actor imageActor;
+
+ Image image01 = CreateSolidColorImage( Color::RED, 10, 10 );
+ ImageActor imageActor01 = CreateSolidColorActor( Color::RED );
+ imageActor01.SetSize( 20.f, 20.f );
+
+ Image image02 = CreateSolidColorImage( Color::RED, 30, 30 );
+ ImageActor imageActor02 = CreateSolidColorActor( Color::RED );
+ imageActor02.SetSize( 40.f, 40.f );
+
+ Image image03 = CreateSolidColorImage( Color::RED, 50, 50 );
+ ImageActor imageActor03 = CreateSolidColorActor( Color::RED );
+ imageActor03.SetSize( 60.f, 60.f );
+
+ Image image04 = CreateSolidColorImage( Color::RED, 70, 70 );
+ ImageActor imageActor04 = CreateSolidColorActor( Color::RED );
+ imageActor04.SetSize( 80.f, 80.f );
+
+ Image image05 = CreateSolidColorImage( Color::RED, 90, 90 );
+ ImageActor imageActor05 = CreateSolidColorActor( Color::RED );
+ imageActor05.SetSize( 100.f, 100.f );
+
+ Vector3 size;
+ PushButton pushButton = PushButton::New();
+
+ application.SendNotification();
+ application.Render();
+
+ // Just check if check box button size changes when a bigger image is set.
+
+ pushButton.SetButtonImage( image01 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetButtonImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 10.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION );
+
+ pushButton.SetButtonImage( imageActor01 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetButtonImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 20.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 20.f, TEST_LOCATION );
+
+ pushButton.SetBackgroundImage( image02 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetBackgroundImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 30.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 30.f, TEST_LOCATION );
+
+ pushButton.SetBackgroundImage( imageActor02 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetBackgroundImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 40.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 40.f, TEST_LOCATION );
+
+ pushButton.SetPressedImage( image03 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetPressedImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 50.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 50.f, TEST_LOCATION );
+
+ pushButton.SetPressedImage( imageActor03 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetPressedImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 60.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 60.f, TEST_LOCATION );
+
+ pushButton.SetDimmedBackgroundImage( image04 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetDimmedBackgroundImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 70.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 70.f, TEST_LOCATION );
+
+ pushButton.SetDimmedBackgroundImage( imageActor04 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetDimmedBackgroundImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 80.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 80.f, TEST_LOCATION );
+
+ pushButton.SetDimmedImage( image05 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetDimmedImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 90.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 90.f, TEST_LOCATION );
+
+ pushButton.SetDimmedImage( imageActor05 );
+
+ application.SendNotification();
+ application.Render();
+
+ size = pushButton.GetDimmedImage().GetCurrentSize();
+
+ DALI_TEST_EQUALS( size.width, 100.f, TEST_LOCATION );
+ DALI_TEST_EQUALS( size.height, 100.f, TEST_LOCATION );
+}
+
+static void UtcDaliPushButtonSetLabelText()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonSetLabelText");
+
+ const std::string STR( "Hola!" );
+
+ PushButton pushButton = PushButton::New();
+
+ application.SendNotification();
+ application.Render();
+
+ TextView textView;
+
+ pushButton.SetLabelText( STR );
+
+ textView = TextView::DownCast( pushButton.GetLabelText() );
+ DALI_TEST_CHECK( STR == textView.GetText() );
+
+ TextView text = TextView::New( STR );
+ pushButton.SetLabelText( text );
+
+ textView = TextView::DownCast( pushButton.GetLabelText() );
+ DALI_TEST_CHECK( STR == textView.GetText() );
+}
+
+static void UtcDaliPushButtonPressed()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonPressed");
+
+ PushButton pushButton = PushButton::New();
+ pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ pushButton.SetPosition( 240, 400 );
+ pushButton.SetSize( 100, 100 );
+
+ Stage::GetCurrent().Add( pushButton );
+
+ application.SendNotification();
+ application.Render();
+
+ gPushButtonPressed = false;
+
+ // connect to its touch signal
+ pushButton.PressedSignal().Connect( &PushButtonPressed );
+
+ Dali::Integration::TouchEvent eventDown;
+ eventDown.AddPoint( pointDownInside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.GetCore().SendEvent( eventDown );
+
+ DALI_TEST_CHECK( gPushButtonPressed );
+}
+
+static void UtcDaliPushButtonReleased()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonReleased");
+
+ PushButton pushButton = PushButton::New();
+ pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ pushButton.SetPosition( 240, 400 );
+ pushButton.SetSize( 100, 100 );
+
+ Stage::GetCurrent().Add( pushButton );
+
+ application.SendNotification();
+ application.Render();
+
+ // connect to its touch signal
+ pushButton.ReleasedSignal().Connect( &PushButtonReleased );
+
+ Dali::Integration::TouchEvent event;
+
+ // Test1. Touch point down and up inside the button.
+
+ gPushButtonReleased = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( gPushButtonReleased );
+
+ // Test2. Touch point down and up outside the button.
+
+ gPushButtonReleased = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownOutside );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpOutside );
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( !gPushButtonReleased );
+
+ // Test3. Touch point down inside and up outside the button.
+
+ gPushButtonReleased = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointLeave );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpOutside );
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( gPushButtonReleased );
+
+ // Test4. Touch point down outside and up inside the button.
+
+ gPushButtonReleased = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownOutside );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointEnter );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( !gPushButtonReleased );
+}
+
+static void UtcDaliPushButtonToggled()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonToggled");
+
+ PushButton pushButton = PushButton::New();
+ pushButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ pushButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ pushButton.SetPosition( 240, 400 );
+ pushButton.SetSize( 100, 100 );
+
+ Stage::GetCurrent().Add( pushButton );
+
+ application.SendNotification();
+ application.Render();
+
+ // connect to its touch signal
+ pushButton.ToggledSignal().Connect( &PushButtonToggled );
+
+ Dali::Integration::TouchEvent event;
+
+ // Test1. No toggle button.
+
+ gPushButtonToggleState = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( !gPushButtonToggleState );
+
+ // Set toggle property.
+ pushButton.SetToggleButton( true );
+
+ // Test2. Touch point down and up inside the button twice.
+ gPushButtonToggleState = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( gPushButtonToggleState );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( !gPushButtonToggleState );
+
+ // Test3. Touch point down and up outside the button.
+
+ gPushButtonToggleState = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownOutside );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpOutside );
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( !gPushButtonToggleState );
+
+ // Test4. Touch point down inside and up outside the button.
+
+ gPushButtonToggleState = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointLeave );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpOutside );
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( !gPushButtonToggleState );
+
+ // Test5. Touch point down outside and up inside the button.
+
+ gPushButtonToggleState = false;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownOutside );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointEnter );
+ application.GetCore().SendEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( !gPushButtonToggleState );
+}
+
+static void UtcDaliPushButtonInterruptEventWhenInsensitive()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonInterruptEventWhenInsensitive");
+
+ // * Creates an actor which contains a button.
+ // * The size of the actor is bigger than the button.
+ // * The button's boundary is contained in the actor's one.
+ Actor actor = Actor::New();
+ TETButton tetButton= Toolkit::TETButton::New();
+
+ actor.SetName( "Actor" );
+ tetButton.SetName( "TETButton" );
+
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ actor.SetPosition( 0, 0 );
+ actor.SetSize( 400, 800 );
+
+ tetButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ tetButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ tetButton.SetPosition( 240, 400 );
+ tetButton.SetSize( 100, 100 );
+
+ actor.Add( tetButton );
+ Stage::GetCurrent().Add( actor );
+
+ // * Actor's touch event is connected to a callback function
+ // and this callback function consumes the event.
+ actor.TouchedSignal().Connect( &TestCallback );
+
+ // * Button's pressed signal is connected to a callback function
+ // which also consumes the event.
+ // * Changes the sensitiveness of the button to false.
+ TETButtonPressed tetButtonPressed( actor, TETButtonPressed::SENSITIVENESS );
+ tetButton.PressedSignal().Connect( &tetButtonPressed, &TETButtonPressed::Callback );
+
+ // Initializes TET state.
+ gOnTouchPointInterrupted = false;
+ tetButton.SetSensitive( true );
+
+ Dali::Integration::TouchEvent event;
+
+ // TET starts.
+
+ // Test a down point inside the button which is also consumed by the actor, and an up point
+ // consumed only by the actor. gOnTouchPointInterrupted should be true (Button receives an
+ // interrupt event.
+
+ application.SendNotification();
+ application.Render();
+
+ // A down event is sent inside the button's boundary.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.GetCore().SendEvent( event );
+
+ // An up event is sent outside the button's boundary but inside the actor's one.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpOutside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( gOnTouchPointInterrupted );
+
+ // Test a down point inside the button which is also consumed by the actor, and a motion point
+ // consumed only by the actor. gOnTouchPointInterrupted should be true (Button receives an
+ // interrupt event.
+
+ // Initializes TET state.
+ gOnTouchPointInterrupted = false;
+ actor.SetSensitive( true );
+ tetButton.SetSensitive( true );
+
+ application.SendNotification();
+ application.Render();
+
+ // A down event is sent inside the button's boundary.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.GetCore().SendEvent( event );
+
+ // A motion event is sent outside the button's boundary but inside the actor's one.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointMotionOut );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( gOnTouchPointInterrupted );
+
+ // Test a down point inside the button which is also consumed by the actor, and an up point
+ // also inside the button and consumed by the actor. gOnTouchPointInterrupted should be false.
+
+ // Initializes TET state.
+ gOnTouchPointInterrupted = false;
+ actor.SetSensitive( true );
+ tetButton.SetSensitive( true );
+
+ // A down event is sent inside the button's boundary.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.GetCore().SendEvent( event );
+
+ actor.SetSensitive( true );
+ // An up event is sent inside the button's boundary.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( !gOnTouchPointInterrupted );
+}
+
+static void UtcDaliPushButtonInterruptEventWhenNonVisible()
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliPushButtonInterruptEventWhenNonVisible");
+
+ // Does same test as above but changing the visibility instead the sensitiveness.
+
+ // * Creates an actor which contains a button.
+ // * The size of the actor is bigger than the button.
+ // * The button's boundary is contained in the actor's one.
+ Actor actor = Actor::New();
+ TETButton tetButton = Toolkit::TETButton::New();
+
+ actor.SetName( "Actor" );
+ tetButton.SetName( "TETButton" );
+
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ actor.SetPosition( 0, 0 );
+ actor.SetSize( 400, 800 );
+
+ tetButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ tetButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ tetButton.SetPosition( 240, 400 );
+ tetButton.SetSize( 100, 100 );
+
+ actor.Add( tetButton );
+ Stage::GetCurrent().Add( actor );
+
+ // * Actor's touch event is connected to a callback function
+ // and this callback function consumes the event.
+ actor.TouchedSignal().Connect( &TestCallback );
+
+ // * Button's pressed signal is connected to a callback function
+ // which also consumes the event.
+ // * Changes the visibility of the button to false.
+ TETButtonPressed tetButtonPressed( tetButton, TETButtonPressed::VISIBILITY );
+ tetButton.PressedSignal().Connect( &tetButtonPressed, &TETButtonPressed::Callback );
+
+ // Initializes TET state.
+ gOnTouchPointInterrupted = false;
+ tetButton.SetVisible( true );
+
+ Dali::Integration::TouchEvent event;
+
+ // TET starts.
+
+ // Test a down point inside the button which is also consumed by the actor, and an up point
+ // consumed only by the actor. gOnTouchPointInterrupted should be true (Button receives an
+ // interrupt event.
+
+ application.SendNotification();
+ application.Render();
+
+ // A down event is sent inside the button's boundary.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.GetCore().SendEvent( event );
+
+ // More renders are needed in order to allow the node of the actor to become invisible.
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+
+ // An up event is sent outside the button's boundary but inside the actor's one.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpOutside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( gOnTouchPointInterrupted );
+
+ // Test a down point inside the button which is also consumed by the actor, and a motion point
+ // consumed only by the actor. gOnTouchPointInterrupted should be true (Button receives an
+ // interrupt event.
+
+ // Initializes TET state.
+ gOnTouchPointInterrupted = false;
+ tetButton.SetVisible( true );
+
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+
+ // A down event is sent inside the button's boundary.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.GetCore().SendEvent( event );
+
+ // More renders are needed in order to allow the node of the actor to become invisible.
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+
+ // A motion event is sent outside the button's boundary but inside the actor's one.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointMotionOut );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( gOnTouchPointInterrupted );
+
+ // Test a down point inside the button which is also consumed by the actor, and an up point
+ // also inside the button and consumed by the actor. gOnTouchPointInterrupted should be false.
+
+ // Initializes TET state.
+ gOnTouchPointInterrupted = false;
+ tetButton.SetVisible( true );
+
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+
+ // A down event is sent inside the button's boundary.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointDownInside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.GetCore().SendEvent( event );
+
+ tetButton.SetVisible( true );
+
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+
+ // An up event is sent inside the button's boundary.
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( pointUpInside );
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+ application.GetCore().SendEvent( event );
+
+ DALI_TEST_CHECK( !gOnTouchPointInterrupted );
+}
diff --git a/automated-tests/dali-test-suite/cluster/.gitignore b/automated-tests/dali-test-suite/cluster/.gitignore
new file mode 100644
index 0000000..0f1bba7
--- /dev/null
+++ b/automated-tests/dali-test-suite/cluster/.gitignore
@@ -0,0 +1 @@
+utc-Dali-Cluster
diff --git a/automated-tests/dali-test-suite/cluster/Makefile b/automated-tests/dali-test-suite/cluster/Makefile
new file mode 120000
index 0000000..c88d5a7
--- /dev/null
+++ b/automated-tests/dali-test-suite/cluster/Makefile
@@ -0,0 +1 @@
+../master-makefile.mk
\ No newline at end of file
diff --git a/automated-tests/dali-test-suite/cluster/file.list b/automated-tests/dali-test-suite/cluster/file.list
new file mode 100644
index 0000000..3025d80
--- /dev/null
+++ b/automated-tests/dali-test-suite/cluster/file.list
@@ -0,0 +1,2 @@
+TARGETS += \
+ utc-Dali-Cluster \
diff --git a/automated-tests/dali-test-suite/cluster/tslist b/automated-tests/dali-test-suite/cluster/tslist
new file mode 100644
index 0000000..d3e3708
--- /dev/null
+++ b/automated-tests/dali-test-suite/cluster/tslist
@@ -0,0 +1 @@
+/dali-test-suite/cluster/utc-Dali-Cluster
diff --git a/automated-tests/dali-test-suite/cluster/utc-Dali-Cluster.cpp b/automated-tests/dali-test-suite/cluster/utc-Dali-Cluster.cpp
new file mode 100644
index 0000000..09721e6
--- /dev/null
+++ b/automated-tests/dali-test-suite/cluster/utc-Dali-Cluster.cpp
@@ -0,0 +1,224 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+
+#include
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+namespace
+{
+
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+} // namespace
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( UtcDaliClusterNew, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliClusterDownCast, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliClusterAddAndRemoveChild, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliClusterExpandAndCollapseChild, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliClusterSetAndGetStyle, POSITIVE_TC_IDX );
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliClusterNew()
+{
+ ToolkitTestApplication application;
+
+ // Create the Cluster actor
+ ClusterStyle style = ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle1);
+ Cluster cluster = Cluster::New(style);
+
+ DALI_TEST_CHECK(cluster);
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect(&TestCallback);
+ {
+ ClusterStyle style = ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle1);
+ Cluster cluster = Cluster::New(style);
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+}
+
+static void UtcDaliClusterDownCast()
+{
+ ToolkitTestApplication application;
+
+ // Create the Cluster actor
+ ClusterStyle style = ClusterStyleRandom::New();
+ const Cluster clusterConst = Cluster::New(style);
+ Cluster cluster(clusterConst);
+
+ BaseHandle handle(cluster);
+
+ Cluster newCluster = Cluster::DownCast( handle );
+ DALI_TEST_CHECK( cluster );
+ DALI_TEST_CHECK( newCluster == cluster );
+}
+
+static void UtcDaliClusterAddAndRemoveChild()
+{
+ ToolkitTestApplication application;
+
+ // Create the Cluster actor
+ ClusterStyle style = ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle1);
+ Cluster cluster = Cluster::New(style);
+
+ Actor childActor1 = Actor::New();
+ Actor childActor2 = Actor::New();
+ Actor childActor3 = Actor::New();
+ Actor childActor4 = Actor::New();
+
+ // Add the first child and check it is added to the end
+ cluster.AddChild(childActor1);
+ DALI_TEST_CHECK( cluster.GetChildAt(0) == childActor1);
+ DALI_TEST_CHECK( !cluster.GetChildAt(1) );
+ DALI_TEST_CHECK( cluster.GetTotalCount() == 1 );
+
+ // Add the second child to the given position and check it is added
+ cluster.AddChild(childActor2, 1);
+ DALI_TEST_CHECK( cluster.GetChildAt(1) == childActor2);
+ DALI_TEST_CHECK( cluster.GetTotalCount() == 2 );
+
+ // Add the third child with depth index 1 and check it is added to the end
+ cluster.AddChildAt(childActor3, 1);
+ DALI_TEST_CHECK( cluster.GetChildAt(2) == childActor3);
+ DALI_TEST_CHECK( cluster.GetTotalCount() == 3 );
+
+ // Add the fourth child with depth index 2 to the given position and check it is added
+ cluster.AddChildAt(childActor4, 2, 3);
+ DALI_TEST_CHECK( cluster.GetChildAt(3) == childActor4);
+ DALI_TEST_CHECK( cluster.GetTotalCount() == 4 );
+
+ // Remove the child in the given position and check it's removed
+ cluster.RemoveChildAt(3);
+ DALI_TEST_CHECK( !cluster.GetChildAt(3) );
+ DALI_TEST_CHECK( cluster.GetTotalCount() == 3 );
+}
+
+static void UtcDaliClusterExpandAndCollapseChild()
+{
+ ToolkitTestApplication application;
+
+ // Create the Cluster actor
+ ClusterStyle style = ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle1);
+ Cluster cluster = Cluster::New(style);
+
+ Actor childActor1 = Actor::New();
+ Actor childActor2 = Actor::New();
+ Actor childActor3 = Actor::New();
+ Actor childActor4 = Actor::New();
+
+ // Add the child actors
+ cluster.AddChild(childActor1);
+ cluster.AddChild(childActor2);
+ cluster.AddChildAt(childActor3, 1);
+ cluster.AddChildAt(childActor4, 2, 3);
+
+ // Expand child actor 3
+ cluster.ExpandChild(2);
+ DALI_TEST_CHECK( cluster.GetExpandedCount() == 1 );
+
+ // Expand child actor 4
+ cluster.ExpandChild(3);
+ DALI_TEST_CHECK( cluster.GetExpandedCount() == 2 );
+
+ // Collapse child actor 3
+ cluster.CollapseChild(2);
+ DALI_TEST_CHECK( cluster.GetExpandedCount() == 1 );
+
+ // Expand all children
+ cluster.ExpandAllChildren();
+ DALI_TEST_CHECK( cluster.GetExpandedCount() == 4 );
+
+ // Collpase all children
+ cluster.CollapseAllChildren();
+ DALI_TEST_CHECK( cluster.GetExpandedCount() == 0 );
+
+ // Transform and restore the child
+ cluster.TransformChild(1, Vector3(10.0f, 10.0f, 1.0f), Vector3(1.0f, 1.0f, 1.0f), Quaternion(0.0f, Vector3::YAXIS), AlphaFunctions::EaseOut, 0.5f);
+ cluster.RestoreChild(1, AlphaFunctions::EaseOut, 0.25f, true);
+}
+
+static void UtcDaliClusterSetAndGetStyle()
+{
+ ToolkitTestApplication application;
+
+ // Create the default cluster style
+ ClusterStyle defaultStyle = ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle1);
+ DALI_TEST_CHECK( defaultStyle.GetMaximumNumberOfChildren() > 0 );
+
+ // Add style to background and title
+ Actor background = Actor::New();
+ Actor title = Actor::New();
+ defaultStyle.ApplyStyleToBackground(background, AlphaFunctions::EaseOut, 1.0f);
+ defaultStyle.ApplyStyleToTitle(title, AlphaFunctions::EaseOut, 1.0f);
+
+ // Create the Cluster actor with the default style
+ Cluster cluster = Cluster::New(defaultStyle);
+ DALI_TEST_CHECK( cluster.GetStyle() == defaultStyle );
+ cluster.SetBackgroundImage(background);
+ cluster.SetTitle(title);
+
+ // Create a new style and apply it to the cluster
+ ClusterStyle newStyle = ClusterStyleRandom::New();
+ cluster.SetStyle(newStyle);
+ DALI_TEST_CHECK( cluster.GetStyle() == newStyle );
+}
diff --git a/automated-tests/dali-test-suite/control/.gitignore b/automated-tests/dali-test-suite/control/.gitignore
new file mode 100644
index 0000000..17a0b4b
--- /dev/null
+++ b/automated-tests/dali-test-suite/control/.gitignore
@@ -0,0 +1,2 @@
+utc-Dali-ControlImpl
+utc-Dali-Control
diff --git a/automated-tests/dali-test-suite/control/Makefile b/automated-tests/dali-test-suite/control/Makefile
new file mode 120000
index 0000000..c88d5a7
--- /dev/null
+++ b/automated-tests/dali-test-suite/control/Makefile
@@ -0,0 +1 @@
+../master-makefile.mk
\ No newline at end of file
diff --git a/automated-tests/dali-test-suite/control/dummy-control.h b/automated-tests/dali-test-suite/control/dummy-control.h
new file mode 100644
index 0000000..18c10f9
--- /dev/null
+++ b/automated-tests/dali-test-suite/control/dummy-control.h
@@ -0,0 +1,237 @@
+#ifndef __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__
+#define __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+class DummyControlImpl;
+
+/**
+ * Control does not have a New method so use this dummy class for the handle.
+ */
+class DummyControl : public Control
+{
+public:
+
+ DummyControl()
+ : mCustomSlot1Called(false)
+ {
+ }
+
+ DummyControl(const DummyControl& control)
+ : Control( control ),
+ mCustomSlot1Called(false)
+ {
+ }
+
+ virtual ~DummyControl()
+ {
+ }
+
+ static DummyControl New( bool override = false );
+
+ static DummyControl DownCast( BaseHandle handle )
+ {
+ return Control::DownCast(handle);
+ }
+
+ DummyControl& operator=(const DummyControl& control)
+ {
+ Control::operator=( control );
+ return *this;
+ }
+
+ // Used to test signal connections
+ void CustomSlot1( Actor actor, const Vector3& value )
+ {
+ mCustomSlot1Called = true;
+ mCustomSlot1Value = value;
+ }
+
+public:
+
+ bool mCustomSlot1Called;
+ Vector3 mCustomSlot1Value;
+
+public: // Not intended for application developers
+
+ DummyControl( DummyControlImpl& implementation );
+ DummyControl( Dali::Internal::CustomActor* internal );
+};
+
+/**
+ * Cannot create an instance of ControlImpl, so use this dummy class for the implementation.
+ * This class does not override any of ControlImpl's behaviour.
+ */
+class DummyControlImpl : public ControlImpl
+{
+public:
+
+ static DummyControl New()
+ {
+ IntrusivePtr< DummyControlImpl > impl = new DummyControlImpl;
+ DummyControl control( *impl );
+ impl->Initialize();
+ return control;
+ }
+
+public:
+ void EnableGestureDetection(Gesture::Type type) { ControlImpl::EnableGestureDetection(type); }
+ void DisableGestureDetection(Gesture::Type type) { ControlImpl::DisableGestureDetection(type); }
+ PinchGestureDetector GetPinchGestureDetector() const { return ControlImpl::GetPinchGestureDetector(); }
+ PanGestureDetector GetPanGestureDetector() const { return ControlImpl::GetPanGestureDetector(); }
+ TapGestureDetector GetTapGestureDetector() const { return ControlImpl::GetTapGestureDetector(); }
+ LongPressGestureDetector GetLongPressGestureDetector() const { return ControlImpl::GetLongPressGestureDetector(); }
+
+protected:
+
+ DummyControlImpl()
+ : ControlImpl(true)
+ {
+ }
+
+ virtual ~DummyControlImpl()
+ {
+ }
+};
+
+/**
+ * Cannot create an instance of ControlImpl, so use this dummy class for the implementation.
+ * This class DOES override ControlImpl's behaviour.
+ */
+class DummyControlImplOverride : public DummyControlImpl
+{
+public:
+
+ static DummyControl New()
+ {
+ IntrusivePtr< DummyControlImplOverride > impl = new DummyControlImplOverride;
+ DummyControl control( *impl );
+ impl->Initialize();
+ return control;
+ }
+
+private:
+
+ DummyControlImplOverride()
+ : DummyControlImpl(),
+ initializeCalled(false),
+ styleChangeCalled(false),
+ pinchCalled(false),
+ panCalled(false),
+ tapCalled(false),
+ longPressCalled(false),
+ stageConnectionCalled(false),
+ stageDisconnectionCalled(false),
+ childAddCalled(false),
+ childRemoveCalled(false),
+ sizeSetCalled(false),
+ sizeAnimationCalled(false),
+ touchEventCalled(false),
+ mouseWheelEventCalled(false),
+ keyEventCalled(false),
+ keyInputFocusGained(false),
+ keyInputFocusLost(false)
+ {
+ }
+
+ virtual ~DummyControlImplOverride() { }
+
+private: // From ControlImpl
+
+ virtual void OnInitialize() { initializeCalled = true; }
+ virtual void OnStyleChange(StyleChange change) { styleChangeCalled = true;}
+ virtual void OnPinch(PinchGesture pinch) { pinchCalled = true; }
+ virtual void OnPan(PanGesture pan) { panCalled = true; }
+ virtual void OnTap(TapGesture tap) { tapCalled = true; }
+ virtual void OnLongPress(LongPressGesture longPress) { longPressCalled = true; }
+
+private: // From CustomActorImpl
+
+ virtual void OnStageConnection() { stageConnectionCalled = true; }
+ virtual void OnStageDisconnection() { stageDisconnectionCalled = true; }
+ virtual void OnChildAdd(Actor& child) { childAddCalled = true; }
+ virtual void OnChildRemove(Actor& child) { childRemoveCalled = true; }
+ virtual void OnSizeSet(const Vector3& targetSize) { sizeSetCalled = true; }
+ virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize) { sizeAnimationCalled = true; }
+ virtual bool OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; }
+ virtual bool OnMouseWheelEvent(const MouseWheelEvent& event) { mouseWheelEventCalled = true; return false; }
+ virtual bool OnKeyEvent(const KeyEvent& event) { keyEventCalled = true; return false;}
+ virtual void OnKeyInputFocusGained() { keyInputFocusGained = true; }
+ virtual void OnKeyInputFocusLost() { keyInputFocusLost = true; }
+
+public:
+
+ bool initializeCalled;
+ bool styleChangeCalled;
+ bool pinchCalled;
+ bool panCalled;
+ bool tapCalled;
+ bool longPressCalled;
+ bool stageConnectionCalled;
+ bool stageDisconnectionCalled;
+ bool childAddCalled;
+ bool childRemoveCalled;
+ bool sizeSetCalled;
+ bool sizeAnimationCalled;
+ bool touchEventCalled;
+ bool mouseWheelEventCalled;
+ bool keyEventCalled;
+ bool keyInputFocusGained;
+ bool keyInputFocusLost;
+};
+
+DummyControl DummyControl::New( bool override )
+{
+ DummyControl control;
+
+ if (override)
+ {
+ control = DummyControlImplOverride::New();
+ }
+ else
+ {
+ control = DummyControlImpl::New();
+ }
+
+ return control;
+}
+
+DummyControl::DummyControl( DummyControlImpl& implementation )
+: Control( implementation )
+{
+}
+
+DummyControl::DummyControl( Dali::Internal::CustomActor* internal )
+: Control( internal )
+{
+ VerifyCustomActorPointer(internal);
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__
diff --git a/automated-tests/dali-test-suite/control/file.list b/automated-tests/dali-test-suite/control/file.list
new file mode 100644
index 0000000..7efd89d
--- /dev/null
+++ b/automated-tests/dali-test-suite/control/file.list
@@ -0,0 +1,3 @@
+TARGETS += \
+ utc-Dali-ControlImpl \
+ utc-Dali-Control \
diff --git a/automated-tests/dali-test-suite/control/tslist b/automated-tests/dali-test-suite/control/tslist
new file mode 100644
index 0000000..e2ff777
--- /dev/null
+++ b/automated-tests/dali-test-suite/control/tslist
@@ -0,0 +1,2 @@
+/dali-test-suite/control/utc-Dali-ControlImpl
+/dali-test-suite/control/utc-Dali-Control
diff --git a/automated-tests/dali-test-suite/control/utc-Dali-Control.cpp b/automated-tests/dali-test-suite/control/utc-Dali-Control.cpp
new file mode 100644
index 0000000..f437d84
--- /dev/null
+++ b/automated-tests/dali-test-suite/control/utc-Dali-Control.cpp
@@ -0,0 +1,368 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+
+#include
+
+#include "dummy-control.h"
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( UtcDaliControlConstructor, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlNew, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlRegister, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlCopyAndAssignment, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlDownCast, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlDownCastTemplate, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlKeyInputFocus, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlGetImplementation, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlSignalConnectDisconnect, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlSignalAutomaticDisconnect, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlTestParameters, POSITIVE_TC_IDX );
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliControlConstructor()
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ DummyControl dummy;
+
+ DALI_TEST_CHECK( !Control::DownCast(dummy) );
+
+ dummy = DummyControl::New();
+
+ DALI_TEST_CHECK( Control::DownCast(dummy) );
+}
+
+static void UtcDaliControlNew()
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control;
+
+ DALI_TEST_CHECK( !Control::DownCast(control) );
+
+ control = Control::New();
+
+ DALI_TEST_CHECK( Control::DownCast(control) );
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+static void UtcDaliControlRegister()
+{
+ ToolkitTestApplication application;
+
+ // Ensure the object is registered after creation
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestCallback );
+ {
+ Alignment alignment = Alignment::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+static void UtcDaliControlCopyAndAssignment()
+{
+ ToolkitTestApplication application;
+
+ DummyControl control = DummyControl::New();
+ Control emptyControl;
+
+ Control controlCopy( control );
+ DALI_TEST_CHECK( control == controlCopy );
+
+ Control emptyControlCopy( emptyControl );
+ DALI_TEST_CHECK( emptyControl == emptyControlCopy );
+
+ Control controlEquals;
+ controlEquals = control;
+ DALI_TEST_CHECK( control == controlEquals );
+
+ Control emptyControlEquals;
+ emptyControlEquals = emptyControl;
+ DALI_TEST_CHECK( emptyControl == emptyControlEquals );
+
+ // Self assignment
+ control = control;
+ DALI_TEST_CHECK( control == controlCopy );
+}
+
+static void UtcDaliControlDownCast()
+{
+ ToolkitTestApplication application;
+
+ DummyControl control;
+
+ DALI_TEST_CHECK( !Control::DownCast( control ) );
+
+ control = DummyControl::New();
+
+ DALI_TEST_CHECK( Control::DownCast( control ) );
+
+ Actor actor;
+
+ DALI_TEST_CHECK( !Control::DownCast( actor ) );
+
+ actor = Actor::New();
+
+ DALI_TEST_CHECK( !Control::DownCast( actor ) );
+}
+
+static void UtcDaliControlDownCastTemplate()
+{
+ ToolkitTestApplication application;
+
+ DummyControl control;
+
+ DALI_TEST_CHECK( !DummyControl::DownCast( control ));
+
+ control = DummyControl::New();
+
+ DALI_TEST_CHECK( DummyControl::DownCast( control ) );
+
+ Actor actor;
+
+ DALI_TEST_CHECK( !DummyControl::DownCast( actor ) );
+
+ actor = Actor::New();
+
+ DALI_TEST_CHECK( !DummyControl::DownCast( actor ) );
+}
+
+static void UtcDaliControlKeyInputFocus()
+{
+ ToolkitTestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ DummyControl control;
+
+ PushButton pushButton1 = PushButton::New();
+ stage.Add( pushButton1 );
+
+ pushButton1.SetKeyInputFocus();
+ DALI_TEST_CHECK( pushButton1.HasKeyInputFocus() );
+
+ pushButton1.ClearKeyInputFocus();
+ DALI_TEST_CHECK( !pushButton1.HasKeyInputFocus() );
+}
+
+static void UtcDaliControlGetImplementation()
+{
+ ToolkitTestApplication application;
+
+ DummyControl control;
+
+ // Get Empty
+ {
+ try
+ {
+ ControlImpl& controlImpl = control.GetImplementation();
+ (void)controlImpl; // Avoid unused warning
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException &exception)
+ {
+ tet_result(TET_PASS);
+ }
+ }
+
+ // Get Const Empty
+ {
+ try
+ {
+ const DummyControl constControl(control);
+ const ControlImpl& controlImpl = constControl.GetImplementation();
+ (void)controlImpl; // Avoid unused warning
+ tet_result(TET_FAIL);
+ }
+ catch (DaliException &exception)
+ {
+ tet_result(TET_PASS);
+ }
+ }
+
+ control = DummyControl::New();
+
+ // Get
+ {
+ try
+ {
+ ControlImpl& controlImpl = control.GetImplementation();
+ (void)controlImpl; // Avoid unused warning
+ tet_result(TET_PASS);
+ }
+ catch (DaliException &exception)
+ {
+ tet_result(TET_FAIL);
+ }
+ }
+
+ // Get Const
+ {
+ try
+ {
+ const DummyControl constControl(control);
+ const ControlImpl& controlImpl = constControl.GetImplementation();
+ (void)controlImpl; // Avoid unused warning
+ tet_result(TET_PASS);
+ }
+ catch (DaliException &exception)
+ {
+ tet_result(TET_FAIL);
+ }
+ }
+}
+
+static void UtcDaliControlSignalConnectDisconnect()
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControlImpl::New();
+
+ Actor actor = Actor::New();
+ DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 0u, TEST_LOCATION );
+ actor.SetSizeSignal().Connect( &dummy, &DummyControl::CustomSlot1 );
+ DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Called, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Value, Vector3::ZERO, TEST_LOCATION );
+
+ const Vector3 newSize( 10, 10, 0 );
+ actor.SetSize( newSize );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Called, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Value, newSize, TEST_LOCATION );
+
+ dummy.mCustomSlot1Called = false;
+ actor.SetSizeSignal().Disconnect( &dummy, &DummyControl::CustomSlot1 );
+ DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 0u, TEST_LOCATION );
+ const Vector3 ignoredSize( 20, 20, 0 );
+ actor.SetSize( ignoredSize );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Called, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Value, newSize/*not ignoredSize*/, TEST_LOCATION );
+ }
+}
+
+static void UtcDaliControlSignalAutomaticDisconnect()
+{
+ ToolkitTestApplication application;
+
+ Actor actor = Actor::New();
+
+ {
+ DummyControl dummy = DummyControlImpl::New();
+
+ actor.SetSizeSignal().Connect( &dummy, &DummyControl::CustomSlot1 );
+ DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Called, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Value, Vector3::ZERO, TEST_LOCATION );
+
+ const Vector3 newSize( 10, 10, 0 );
+ actor.SetSize( newSize );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Called, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.mCustomSlot1Value, newSize, TEST_LOCATION );
+ }
+ // dummyControl automatically disconnects
+
+ DALI_TEST_EQUALS( actor.SetSizeSignal().GetConnectionCount(), 0u, TEST_LOCATION );
+
+ const Vector3 ignoredSize( 20, 20, 0 );
+ actor.SetSize( ignoredSize );
+}
+
+static void UtcDaliControlTestParameters()
+{
+ ToolkitTestApplication application;
+ DummyControl test = DummyControl::New();
+
+ Vector3 maxSize = test.GetNaturalSize();
+ Vector3 minSize = maxSize / 2.0f;
+
+ Toolkit::Control::SizePolicy widthPolicy( Control::Fixed );
+ Toolkit::Control::SizePolicy heightPolicy( Control::Fixed );
+ test.SetSizePolicy( widthPolicy, heightPolicy );
+ test.GetSizePolicy( widthPolicy, heightPolicy );
+
+ DALI_TEST_CHECK( widthPolicy == Control::Fixed && heightPolicy == Control::Fixed );
+
+ test.SetSize( 0.7f, 0.7f, 0.7f );
+ float width = 640.0f;
+ float height = test.GetHeightForWidth( width );
+ DALI_TEST_CHECK( test.GetWidthForHeight( height ) == width );
+
+ test.SetMinimumSize( minSize );
+ DALI_TEST_CHECK( test.GetMinimumSize() == minSize );
+
+ test.SetMaximumSize( maxSize );
+ DALI_TEST_CHECK( test.GetMaximumSize() == maxSize );
+
+ test.KeyEventSignal();
+ DummyControl test2 = DummyControl::New();
+ dynamic_cast< ConnectionTrackerInterface& >( test2 ).GetConnectionCount();
+
+ // Provide coverage for pointer destructor
+ Control* testControlPtr = new Control;
+ DALI_TEST_CHECK( testControlPtr );
+ delete testControlPtr;
+}
diff --git a/automated-tests/dali-test-suite/control/utc-Dali-ControlImpl.cpp b/automated-tests/dali-test-suite/control/utc-Dali-ControlImpl.cpp
new file mode 100644
index 0000000..1264f60
--- /dev/null
+++ b/automated-tests/dali-test-suite/control/utc-Dali-ControlImpl.cpp
@@ -0,0 +1,829 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+#include "dummy-control.h"
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( UtcDaliControlImplNew, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlImplTypeRegistry, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlImplEnableGestureDetector, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlImplDisableGestureDetector, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlImplOnGestureMethods, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlImplChildAddAndRemove, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlImplStageConnection, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlImplSizeSet, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlImplSizeAnimation, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlImplTouchEvent, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlImplMouseWheelEvent, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlImplKeyEvent, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlImplStyleChange, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlImplKeyInputFocusGained, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliControlImplKeyInputFocusLost, POSITIVE_TC_IDX );
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliControlImplNew()
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+
+ Control control;
+
+ DALI_TEST_CHECK( !Control::DownCast(control) );
+
+ control = ControlImpl::New();
+
+ DALI_TEST_CHECK( Control::DownCast(control) );
+}
+
+static void UtcDaliControlImplTypeRegistry()
+{
+ ToolkitTestApplication application;
+
+ // Register Type
+ TypeInfo type;
+ type = TypeRegistry::Get().GetTypeInfo( "Control" );
+ DALI_TEST_CHECK( type );
+ BaseHandle handle = type.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ // Check if it's a control
+ DALI_TEST_CHECK( Control::DownCast(handle) );
+}
+
+static void UtcDaliControlImplEnableGestureDetector()
+{
+ ToolkitTestApplication application;
+
+ // Enable individually
+ {
+ DummyControl dummy = DummyControl::New();
+ DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation());
+
+ DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
+ dummyImpl.EnableGestureDetection(Gesture::Pinch);
+ DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
+
+ DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
+ dummyImpl.EnableGestureDetection(Gesture::Pan);
+ DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
+
+ DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
+ dummyImpl.EnableGestureDetection(Gesture::Tap);
+ DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
+
+ DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
+ dummyImpl.EnableGestureDetection(Gesture::LongPress);
+ DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
+ }
+
+ // Enable All
+ {
+ DummyControl dummy = DummyControl::New();
+ DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation());
+
+ DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
+ DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
+ DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
+ DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
+
+ dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+
+ DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
+ DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
+ DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
+ DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
+
+ // Enable when already enabled
+
+ dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+
+ DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
+ DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
+ DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
+ DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
+ }
+}
+
+static void UtcDaliControlImplDisableGestureDetector()
+{
+ ToolkitTestApplication application;
+
+ // Disable individually
+ {
+ DummyControl dummy = DummyControl::New();
+ DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation());
+
+ dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+
+ DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
+ dummyImpl.DisableGestureDetection(Gesture::Pinch);
+ DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
+
+ DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
+ dummyImpl.DisableGestureDetection(Gesture::Pan);
+ DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
+
+ DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
+ dummyImpl.DisableGestureDetection(Gesture::Tap);
+ DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
+
+ DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
+ dummyImpl.DisableGestureDetection(Gesture::LongPress);
+ DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
+ }
+
+ // Disable All
+ {
+ DummyControl dummy = DummyControl::New();
+ DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation());
+
+ dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+
+ DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() );
+ DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() );
+ DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() );
+ DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() );
+
+ dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+
+ DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
+ DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
+ DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
+ DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
+ }
+
+ // Disable When not enabled
+ {
+ DummyControl dummy = DummyControl::New();
+ DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation());
+
+ DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
+ DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
+ DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
+ DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
+
+ dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+
+ DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() );
+ DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() );
+ DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() );
+ DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() );
+ }
+
+ // Ensure control is detached if gesture detector is not deleted
+ {
+ DummyControl dummy = DummyControl::New();
+ DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation());
+
+ dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+
+ PinchGestureDetector pinch = dummyImpl.GetPinchGestureDetector();
+ PanGestureDetector pan = dummyImpl.GetPanGestureDetector();
+ TapGestureDetector tap = dummyImpl.GetTapGestureDetector();
+ LongPressGestureDetector longPress = dummyImpl.GetLongPressGestureDetector();
+
+ DALI_TEST_EQUALS( pinch.GetAttachedActors().empty(), false, TEST_LOCATION );
+ DALI_TEST_EQUALS( pan.GetAttachedActors().empty(), false, TEST_LOCATION );
+ DALI_TEST_EQUALS( tap.GetAttachedActors().empty(), false, TEST_LOCATION );
+ DALI_TEST_EQUALS( longPress.GetAttachedActors().empty(), false, TEST_LOCATION );
+
+ dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+
+ DALI_TEST_EQUALS( pinch.GetAttachedActors().empty(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( pan.GetAttachedActors().empty(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( tap.GetAttachedActors().empty(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( longPress.GetAttachedActors().empty(), true, TEST_LOCATION );
+ }
+}
+
+static void UtcDaliControlImplOnGestureMethods()
+{
+ ToolkitTestApplication application;
+
+ // Check gesture actually happens
+ {
+ DummyControl dummy = DummyControl::New(true);
+ dummy.SetSize( Vector3(100.0f, 100.0f, 100.0f) );
+
+ dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(dummy);
+
+ // Render and notify a couple of times
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+
+ DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation());
+ dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+
+ DALI_TEST_CHECK( dummyImpl.pinchCalled == false );
+ Integration::PinchGestureEvent pinch(Gesture::Started);
+ pinch.scale = 10.0f;
+ pinch.speed = 50.0f;
+ pinch.centerPoint = Vector2(20.0f, 20.0f);
+ application.GetCore().SendEvent(pinch);
+ DALI_TEST_CHECK( dummyImpl.pinchCalled == true );
+
+ DALI_TEST_CHECK( dummyImpl.panCalled == false );
+ Integration::PanGestureEvent pan(Gesture::Possible);
+ pan.previousPosition = Vector2(10.0f, 20.0f);
+ pan.currentPosition = Vector2(20.0f, 20.0f);
+ pan.timeDelta = 10;
+ pan.numberOfTouches = 1u;
+ application.GetCore().SendEvent(pan);
+ pan.state = Gesture::Started;
+ application.GetCore().SendEvent(pan);
+ DALI_TEST_CHECK( dummyImpl.panCalled == true );
+
+ DALI_TEST_CHECK( dummyImpl.tapCalled == false );
+ Integration::TapGestureEvent tap(Gesture::Possible);
+ tap.numberOfTaps = 1u;
+ tap.numberOfTouches = 1u;
+ tap.point = Vector2(50.0f, 50.0f);
+ application.GetCore().SendEvent(tap);
+ tap.state = Gesture::Started;
+ application.GetCore().SendEvent(tap);
+ DALI_TEST_CHECK( dummyImpl.tapCalled == true );
+
+ DALI_TEST_CHECK( dummyImpl.longPressCalled == false );
+ Integration::LongPressGestureEvent longPress(Gesture::Possible);
+ longPress.numberOfTouches = 1u;
+ longPress.point = Vector2(50.0f, 50.0f);
+ application.GetCore().SendEvent(longPress);
+ longPress.state = Gesture::Started;
+ application.GetCore().SendEvent(longPress);
+ DALI_TEST_CHECK( dummyImpl.longPressCalled == true );
+ longPress.state = Gesture::Finished;
+ application.GetCore().SendEvent(longPress);
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+
+ // Ensure full code coverage
+ {
+ DummyControl dummy = DummyControl::New();
+ dummy.SetSize( Vector3(100.0f, 100.0f, 100.0f) );
+
+ dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(dummy);
+
+ // Render and notify a couple of times
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+
+ DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation());
+ dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) );
+
+ DALI_TEST_CHECK( dummy.GetCurrentScale().x != 10.0f );
+ Integration::PinchGestureEvent pinch(Gesture::Started);
+ pinch.scale = 10.0f;
+ pinch.speed = 50.0f;
+ pinch.centerPoint = Vector2(20.0f, 20.0f);
+ application.GetCore().SendEvent(pinch);
+
+ // Render and notify a couple of times
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK( dummy.GetCurrentScale().x == 10.0f );
+
+ Integration::PanGestureEvent pan(Gesture::Possible);
+ pan.previousPosition = Vector2(10.0f, 20.0f);
+ pan.currentPosition = Vector2(20.0f, 20.0f);
+ pan.timeDelta = 10;
+ pan.numberOfTouches = 1u;
+ application.GetCore().SendEvent(pan);
+ pan.state = Gesture::Started;
+ application.GetCore().SendEvent(pan);
+
+ Integration::TapGestureEvent tap(Gesture::Possible);
+ tap.numberOfTaps = 1u;
+ tap.numberOfTouches = 1u;
+ tap.point = Vector2(50.0f, 50.0f);
+ application.GetCore().SendEvent(tap);
+ tap.state = Gesture::Started;
+ application.GetCore().SendEvent(tap);
+
+ Integration::LongPressGestureEvent longPress(Gesture::Possible);
+ longPress.numberOfTouches = 1u;
+ longPress.point = Vector2(50.0f, 50.0f);
+ application.GetCore().SendEvent(longPress);
+ longPress.state = Gesture::Started;
+ application.GetCore().SendEvent(longPress);
+ longPress.state = Gesture::Finished;
+ application.GetCore().SendEvent(longPress);
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+}
+
+static void UtcDaliControlImplChildAddAndRemove()
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControl::New( true );
+ Stage::GetCurrent().Add(dummy);
+ DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation());
+
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( dummyImpl.childAddCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
+ Actor actor = RenderableActor::New();
+ dummy.Add(actor);
+ DALI_TEST_EQUALS( dummyImpl.childAddCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.GetChildCount(), 1u, TEST_LOCATION );
+
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( dummyImpl.childRemoveCalled, false, TEST_LOCATION );
+ dummy.Remove( actor );
+ DALI_TEST_EQUALS( dummyImpl.childRemoveCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
+
+ application.Render();
+ application.SendNotification();
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+
+ // Ensure full code coverage
+ {
+ DummyControl dummy = DummyControl::New();
+ Stage::GetCurrent().Add(dummy);
+
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
+ Actor actor = RenderableActor::New();
+ dummy.Add(actor);
+ DALI_TEST_EQUALS( dummy.GetChildCount(), 1u, TEST_LOCATION );
+
+ application.Render();
+ application.SendNotification();
+
+ dummy.Remove( actor );
+ DALI_TEST_EQUALS( dummy.GetChildCount(), 0u, TEST_LOCATION );
+
+ application.Render();
+ application.SendNotification();
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+}
+
+static void UtcDaliControlImplStageConnection()
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControl::New( true );
+ DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation());
+
+ DALI_TEST_EQUALS( dummyImpl.stageConnectionCalled, false, TEST_LOCATION );
+ Stage::GetCurrent().Add(dummy);
+ application.Render();
+ application.SendNotification();
+ DALI_TEST_EQUALS( dummyImpl.stageConnectionCalled, true, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( dummyImpl.stageDisconnectionCalled, false, TEST_LOCATION );
+ Stage::GetCurrent().Remove(dummy);
+ application.Render();
+ application.SendNotification();
+ DALI_TEST_EQUALS( dummyImpl.stageDisconnectionCalled, true, TEST_LOCATION );
+ }
+
+ // Ensure full code coverage
+ {
+ unsigned int stageChildren = Stage::GetCurrent().GetLayer(0).GetChildCount();
+ DummyControl dummy = DummyControl::New();
+
+ DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren, TEST_LOCATION );
+ Stage::GetCurrent().Add(dummy);
+ application.Render();
+ application.SendNotification();
+ DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren + 1, TEST_LOCATION );
+
+ Stage::GetCurrent().Remove(dummy);
+ application.Render();
+ application.SendNotification();
+ DALI_TEST_EQUALS( Stage::GetCurrent().GetLayer(0).GetChildCount(), stageChildren, TEST_LOCATION );
+ }
+}
+
+static void UtcDaliControlImplSizeSet()
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControl::New( true );
+ DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation());
+
+ Stage::GetCurrent().Add(dummy);
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, false, TEST_LOCATION );
+ Vector3 size(100.0f, 200.0f, 0.0f);
+ dummy.SetSize(size);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(size, dummy.GetCurrentSize(), TEST_LOCATION);
+ DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, true, TEST_LOCATION );
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+
+ // Ensure full code coverage
+ {
+ DummyControl dummy = DummyControl::New();
+ Stage::GetCurrent().Add(dummy);
+
+ Vector3 size(100.0f, 200.0f, 0.0f);
+ DALI_TEST_CHECK( size != dummy.GetCurrentSize() );
+
+ application.Render();
+ application.SendNotification();
+
+ dummy.SetSize(size);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(size, dummy.GetCurrentSize(), TEST_LOCATION);
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+}
+
+static void UtcDaliControlImplSizeAnimation()
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControl::New( true );
+ DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation());
+
+ Stage::GetCurrent().Add(dummy);
+
+ DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, false, TEST_LOCATION );
+ Animation animation = Animation::New(1.0f);
+ animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f));
+ animation.Play();
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, true, TEST_LOCATION );
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+
+ // Ensure full code coverage
+ {
+ DummyControl dummy = DummyControl::New();
+
+ Stage::GetCurrent().Add(dummy);
+
+ Animation animation = Animation::New(1.0f);
+ animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f));
+ animation.Play();
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+static void UtcDaliControlImplTouchEvent()
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControl::New( true );
+ DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation());
+
+ dummy.SetSize(100.0f, 100.0f);
+ dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(dummy);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( dummyImpl.touchEventCalled, false, TEST_LOCATION );
+ Integration::TouchEvent touchEvent(1);
+ TouchPoint point(1, TouchPoint::Down, 20.0f, 20.0f);
+ touchEvent.AddPoint(point);
+ application.GetCore().SendEvent(touchEvent);
+ DALI_TEST_EQUALS( dummyImpl.touchEventCalled, true, TEST_LOCATION );
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+
+ // Ensure full code coverage
+ {
+ DummyControl dummy = DummyControl::New();
+
+ dummy.SetSize(100.0f, 100.0f);
+ dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(dummy);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ Integration::TouchEvent touchEvent(1);
+ TouchPoint point(1, TouchPoint::Down, 20.0f, 20.0f);
+ touchEvent.AddPoint(point);
+ application.GetCore().SendEvent(touchEvent);
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+static bool MouseWheelEventCallback(Actor actor, const MouseWheelEvent& event)
+{
+ return false;
+}
+
+static void UtcDaliControlImplMouseWheelEvent()
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControl::New( true );
+ DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation());
+
+ dummy.SetSize(100.0f, 100.0f);
+ dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(dummy);
+
+ dummy.MouseWheelEventSignal().Connect(&MouseWheelEventCallback);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( dummyImpl.mouseWheelEventCalled, false, TEST_LOCATION );
+
+ // simulate a mouse wheel event
+ Vector2 screenCoordinates( 10.0f, 10.0f );
+ Integration::MouseWheelEvent event(0, 0u, screenCoordinates, 1, 1000u);
+ application.GetCore().SendEvent(event);
+ DALI_TEST_EQUALS( dummyImpl.mouseWheelEventCalled, true, TEST_LOCATION );
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+
+ // Ensure full code coverage
+ {
+ DummyControl dummy = DummyControl::New();
+
+ dummy.SetSize(100.0f, 100.0f);
+ dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Stage::GetCurrent().Add(dummy);
+
+ dummy.MouseWheelEventSignal().Connect(&MouseWheelEventCallback);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ // simulate a mouse wheel event
+ Vector2 screenCoordinates( 20.0f, 20.0f );
+ Integration::MouseWheelEvent event(0, 0u, screenCoordinates, 1, 1000u);
+ application.GetCore().SendEvent(event);
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+static void UtcDaliControlImplKeyEvent()
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControl::New( true );
+ DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation());
+
+ Stage::GetCurrent().Add(dummy);
+ dummy.SetKeyInputFocus();
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( dummyImpl.keyEventCalled, false, TEST_LOCATION );
+ Integration::KeyEvent keyEvent;
+ application.GetCore().SendEvent(keyEvent);
+ DALI_TEST_EQUALS( dummyImpl.keyEventCalled, true, TEST_LOCATION );
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+
+ // Ensure full code coverage
+ {
+ DummyControl dummy = DummyControl::New();
+
+ Stage::GetCurrent().Add(dummy);
+ dummy.SetKeyInputFocus();
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ Integration::KeyEvent keyEvent;
+ application.GetCore().SendEvent(keyEvent);
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+}
+
+static void UtcDaliControlImplStyleChange()
+{
+ ToolkitTestApplication application;
+
+ DummyControl dummy = DummyControl::New( true );
+ DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation());
+
+ Stage::GetCurrent().Add(dummy);
+
+ application.Render();
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+
+ // Add a Control and normal Actor as children
+ DummyControl dummyChild = DummyControl::New();
+ dummy.Add(dummyChild);
+
+ Actor actor = Actor::New();
+ dummy.Add(actor);
+
+ DALI_TEST_EQUALS( dummyImpl.styleChangeCalled, false, TEST_LOCATION );
+ StyleChange styleChange;
+ styleChange.defaultFontChange = true;
+ application.GetAdaptor().GetToolkitStyleMonitor().EmitSignalStyleChange(styleChange);
+ DALI_TEST_EQUALS( dummyImpl.styleChangeCalled, true, TEST_LOCATION );
+
+ Stage::GetCurrent().Remove(dummy);
+}
+
+static void UtcDaliControlImplKeyInputFocusGained()
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControl::New( true );
+ DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation());
+
+ Stage::GetCurrent().Add(dummy);
+
+ DALI_TEST_EQUALS( dummyImpl.keyInputFocusGained, false, TEST_LOCATION );
+
+ dummy.SetKeyInputFocus();
+
+ DALI_TEST_EQUALS( dummyImpl.keyInputFocusGained, true, TEST_LOCATION );
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+
+ // Ensure full code coverage
+ {
+ DummyControl dummy = DummyControl::New();
+
+ Stage::GetCurrent().Add(dummy);
+ dummy.SetKeyInputFocus();
+ Stage::GetCurrent().Remove(dummy);
+ }
+}
+
+static void UtcDaliControlImplKeyInputFocusLost()
+{
+ ToolkitTestApplication application;
+
+ {
+ DummyControl dummy = DummyControl::New( true );
+ DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation());
+
+ Stage::GetCurrent().Add(dummy);
+
+ DALI_TEST_EQUALS( dummyImpl.keyInputFocusLost, false, TEST_LOCATION );
+
+ dummy.SetKeyInputFocus();
+ dummy.ClearKeyInputFocus();
+
+ DALI_TEST_EQUALS( dummyImpl.keyInputFocusLost, true, TEST_LOCATION );
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+
+ // Ensure full code coverage
+ {
+ DummyControl dummy = DummyControl::New();
+
+ Stage::GetCurrent().Add(dummy);
+ dummy.SetKeyInputFocus();
+ dummy.ClearKeyInputFocus();
+
+ DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation());
+
+ dummyImpl.OnAccessibilityValueChange( true );
+ dummyImpl.IsKeyboardNavigationSupported();
+ dummyImpl.IsKeyboardFocusGroup();
+
+ Stage::GetCurrent().Remove(dummy);
+ }
+}
diff --git a/automated-tests/dali-test-suite/default-controls/.gitignore b/automated-tests/dali-test-suite/default-controls/.gitignore
new file mode 100644
index 0000000..fa84f53
--- /dev/null
+++ b/automated-tests/dali-test-suite/default-controls/.gitignore
@@ -0,0 +1 @@
+utc-Dali-DefaultControls
diff --git a/automated-tests/dali-test-suite/default-controls/Makefile b/automated-tests/dali-test-suite/default-controls/Makefile
new file mode 120000
index 0000000..c88d5a7
--- /dev/null
+++ b/automated-tests/dali-test-suite/default-controls/Makefile
@@ -0,0 +1 @@
+../master-makefile.mk
\ No newline at end of file
diff --git a/automated-tests/dali-test-suite/default-controls/file.list b/automated-tests/dali-test-suite/default-controls/file.list
new file mode 100644
index 0000000..91c147c
--- /dev/null
+++ b/automated-tests/dali-test-suite/default-controls/file.list
@@ -0,0 +1,2 @@
+TARGETS += \
+ utc-Dali-DefaultControls \
diff --git a/automated-tests/dali-test-suite/default-controls/tslist b/automated-tests/dali-test-suite/default-controls/tslist
new file mode 100644
index 0000000..7dc630b
--- /dev/null
+++ b/automated-tests/dali-test-suite/default-controls/tslist
@@ -0,0 +1 @@
+/dali-test-suite/default-controls/utc-Dali-DefaultControls
diff --git a/automated-tests/dali-test-suite/default-controls/utc-Dali-DefaultControls.cpp b/automated-tests/dali-test-suite/default-controls/utc-Dali-DefaultControls.cpp
new file mode 100644
index 0000000..49ce54c
--- /dev/null
+++ b/automated-tests/dali-test-suite/default-controls/utc-Dali-DefaultControls.cpp
@@ -0,0 +1,258 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+#include
+#include
+#include
+#include
+
+#include
+
+using namespace Dali;
+using namespace Toolkit;
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( UtcDaliDefaultControlsCreateSolidColorActor, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliDefaultControlsCreatePushButton, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliDefaultControlsCreateCheckBoxButton, POSITIVE_TC_IDX );
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliDefaultControlsCreateSolidColorActor()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliDefaultControlsCreateSolidColorActor");
+
+ ImageActor image1 = CreateSolidColorActor( Color::RED );
+ ImageActor image2 = CreateSolidColorActor( Color::RED, true, Color::BLUE, 2 );
+ ImageActor image3 = CreateSolidColorActor( Color::RED, true, Color::BLUE, 12 );
+
+ DALI_TEST_CHECK(image1);
+ DALI_TEST_CHECK(image2);
+ DALI_TEST_CHECK(!image3);
+}
+
+static void UtcDaliDefaultControlsCreatePushButton()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliDefaultControlsCreatePushButton");
+
+ const std::string imagePath( "Facke image path" );
+ const std::string voidImagePath( "" );
+
+ ImageActor image = CreateSolidColorActor( Color::RED );
+ ImageActor voidImage;
+
+ PushButton button0, button1, button2, button3, button4, button5, button6;
+
+ try
+ {
+ button0 = CreatePushButton( voidImagePath, voidImagePath, voidImagePath, voidImagePath, voidImagePath );
+ button1 = CreatePushButton( imagePath, voidImagePath, voidImagePath, voidImagePath, voidImagePath );
+ button2 = CreatePushButton( voidImagePath, imagePath, voidImagePath, voidImagePath, voidImagePath );
+ button3 = CreatePushButton( voidImagePath, voidImagePath, imagePath, voidImagePath, voidImagePath );
+ button4 = CreatePushButton( voidImagePath, voidImagePath, voidImagePath, imagePath, voidImagePath );
+ button5 = CreatePushButton( voidImagePath, voidImagePath, voidImagePath, voidImagePath, imagePath );
+ button6 = CreatePushButton( imagePath, imagePath, imagePath, imagePath, imagePath );
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+
+ DALI_TEST_CHECK( button0 );
+ DALI_TEST_CHECK( button1 );
+ DALI_TEST_CHECK( button2 );
+ DALI_TEST_CHECK( button3 );
+ DALI_TEST_CHECK( button4 );
+ DALI_TEST_CHECK( button5 );
+ DALI_TEST_CHECK( button6 );
+
+ try
+ {
+ button0 = CreatePushButton( voidImage, voidImage, voidImage, voidImage, voidImage );
+ button1 = CreatePushButton( image, voidImage, voidImage, voidImage, voidImage );
+ button2 = CreatePushButton( voidImage, image, voidImage, voidImage, voidImage );
+ button3 = CreatePushButton( voidImage, voidImage, image, voidImage, voidImage );
+ button4 = CreatePushButton( voidImage, voidImage, voidImage, image, voidImage );
+ button5 = CreatePushButton( voidImage, voidImage, voidImage, voidImage, image );
+ button6 = CreatePushButton( image, image, image, image, image );
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+
+ DALI_TEST_CHECK( button0 );
+ DALI_TEST_CHECK( button1 );
+ DALI_TEST_CHECK( button2 );
+ DALI_TEST_CHECK( button3 );
+ DALI_TEST_CHECK( button4 );
+ DALI_TEST_CHECK( button5 );
+ DALI_TEST_CHECK( button6 );
+
+ try
+ {
+ button0 = CreatePushButton( voidImagePath );
+ button1 = CreatePushButton( imagePath );
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+
+ DALI_TEST_CHECK( button0 );
+ DALI_TEST_CHECK( button1 );
+
+ try
+ {
+ button0 = CreatePushButton( voidImage );
+ button1 = CreatePushButton( image );
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+
+ DALI_TEST_CHECK( button0 );
+ DALI_TEST_CHECK( button1 );
+}
+
+static void UtcDaliDefaultControlsCreateCheckBoxButton()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliDefaultControlsCreateCheckBoxButton");
+
+ const std::string imagePath( "Facke image path" );
+ const std::string voidImagePath( "" );
+
+ ImageActor image = CreateSolidColorActor( Color::RED );
+ ImageActor voidImage;
+
+ CheckBoxButton button0, button1, button2, button3, button4, button5;
+
+ try
+ {
+ button0 = CreateCheckBoxButton( voidImagePath, voidImagePath, voidImagePath, voidImagePath );
+ button1 = CreateCheckBoxButton( imagePath, voidImagePath, voidImagePath, voidImagePath );
+ button2 = CreateCheckBoxButton( voidImagePath, imagePath, voidImagePath, voidImagePath );
+ button3 = CreateCheckBoxButton( voidImagePath, voidImagePath, imagePath, voidImagePath );
+ button4 = CreateCheckBoxButton( voidImagePath, voidImagePath, voidImagePath, imagePath );
+ button5 = CreateCheckBoxButton( imagePath, imagePath, imagePath, imagePath );
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+
+ DALI_TEST_CHECK( button0 );
+ DALI_TEST_CHECK( button1 );
+ DALI_TEST_CHECK( button2 );
+ DALI_TEST_CHECK( button3 );
+ DALI_TEST_CHECK( button4 );
+ DALI_TEST_CHECK( button5 );
+
+ try
+ {
+ button0 = CreateCheckBoxButton( voidImage, voidImage, voidImage, voidImage );
+ button1 = CreateCheckBoxButton( image, voidImage, voidImage, voidImage );
+ button2 = CreateCheckBoxButton( voidImage, image, voidImage, voidImage );
+ button3 = CreateCheckBoxButton( voidImage, voidImage, image, voidImage );
+ button4 = CreateCheckBoxButton( voidImage, voidImage, voidImage, image );
+ button5 = CreateCheckBoxButton( image, image, image, image );
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+
+ DALI_TEST_CHECK( button0 );
+ DALI_TEST_CHECK( button1 );
+ DALI_TEST_CHECK( button2 );
+ DALI_TEST_CHECK( button3 );
+ DALI_TEST_CHECK( button4 );
+ DALI_TEST_CHECK( button5 );
+
+ try
+ {
+ button0 = CreateCheckBoxButton( voidImagePath, voidImagePath );
+ button1 = CreateCheckBoxButton( voidImagePath, imagePath );
+ button2 = CreateCheckBoxButton( imagePath, voidImagePath );
+ button3 = CreateCheckBoxButton( imagePath, imagePath );
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+
+ DALI_TEST_CHECK( button0 );
+ DALI_TEST_CHECK( button1 );
+ DALI_TEST_CHECK( button2 );
+ DALI_TEST_CHECK( button3 );
+
+ try
+ {
+ button0 = CreateCheckBoxButton( voidImage, voidImage );
+ button2 = CreateCheckBoxButton( voidImage, image );
+ button3 = CreateCheckBoxButton( voidImage, image );
+ button4 = CreateCheckBoxButton( image, image );
+ }
+ catch( ... )
+ {
+ tet_result( TET_FAIL );
+ }
+
+ DALI_TEST_CHECK( button0 );
+ DALI_TEST_CHECK( button1 );
+ DALI_TEST_CHECK( button2 );
+ DALI_TEST_CHECK( button3 );
+}
diff --git a/automated-tests/dali-test-suite/focus-manager/.gitignore b/automated-tests/dali-test-suite/focus-manager/.gitignore
new file mode 100644
index 0000000..000ce4a
--- /dev/null
+++ b/automated-tests/dali-test-suite/focus-manager/.gitignore
@@ -0,0 +1,3 @@
+utc-Dali-FocusManager
+utc-Dali-KeyInputFocusManager
+utc-Dali-KeyboardFocusManager
diff --git a/automated-tests/dali-test-suite/focus-manager/Makefile b/automated-tests/dali-test-suite/focus-manager/Makefile
new file mode 120000
index 0000000..c88d5a7
--- /dev/null
+++ b/automated-tests/dali-test-suite/focus-manager/Makefile
@@ -0,0 +1 @@
+../master-makefile.mk
\ No newline at end of file
diff --git a/automated-tests/dali-test-suite/focus-manager/file.list b/automated-tests/dali-test-suite/focus-manager/file.list
new file mode 100644
index 0000000..13851a6
--- /dev/null
+++ b/automated-tests/dali-test-suite/focus-manager/file.list
@@ -0,0 +1,4 @@
+TARGETS += \
+ utc-Dali-FocusManager \
+ utc-Dali-KeyInputFocusManager \
+ utc-Dali-KeyboardFocusManager
diff --git a/automated-tests/dali-test-suite/focus-manager/tslist b/automated-tests/dali-test-suite/focus-manager/tslist
new file mode 100644
index 0000000..409996a
--- /dev/null
+++ b/automated-tests/dali-test-suite/focus-manager/tslist
@@ -0,0 +1,3 @@
+/dali-test-suite/focus-manager/utc-Dali-FocusManager
+/dali-test-suite/focus-manager/utc-Dali-KeyInputFocusManager
+/dali-test-suite/focus-manager/utc-Dali-KeyboardFocusManager
diff --git a/automated-tests/dali-test-suite/focus-manager/utc-Dali-FocusManager.cpp b/automated-tests/dali-test-suite/focus-manager/utc-Dali-FocusManager.cpp
new file mode 100644
index 0000000..c614f53
--- /dev/null
+++ b/automated-tests/dali-test-suite/focus-manager/utc-Dali-FocusManager.cpp
@@ -0,0 +1,1070 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+
+#include
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+// Functors to test whether focus changed signal is emitted when the focus is changed
+class FocusChangedCallback : public Dali::ConnectionTracker
+{
+public:
+ FocusChangedCallback(bool& signalReceived)
+ : mSignalVerified(signalReceived),
+ mOriginalFocusedActor(),
+ mCurrentFocusedActor()
+ {
+ }
+
+ void Callback(Actor originalFocusedActor, Actor currentFocusedActor)
+ {
+ tet_infoline("Verifying FocusChangedCallback()");
+
+ if(originalFocusedActor == mCurrentFocusedActor)
+ {
+ mSignalVerified = true;
+ }
+
+ mOriginalFocusedActor = originalFocusedActor;
+ mCurrentFocusedActor = currentFocusedActor;
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ }
+
+ bool& mSignalVerified;
+ Actor mOriginalFocusedActor;
+ Actor mCurrentFocusedActor;
+};
+
+// Functors to test whether focus overshot signal is emitted when there is no way to move focus further.
+class FocusOvershotCallback : public Dali::ConnectionTracker
+{
+public:
+ FocusOvershotCallback(bool& signalReceived)
+ : mSignalVerified(signalReceived),
+ mCurrentFocusedActor(),
+ mFocusOvershotDirection(Toolkit::FocusManager::OVERSHOT_NEXT)
+ {
+ }
+
+ void Callback(Actor currentFocusedActor, Toolkit::FocusManager::FocusOvershotDirection direction)
+ {
+ tet_infoline("Verifying FocusOvershotCallback()");
+
+ if(currentFocusedActor == mCurrentFocusedActor && direction == mFocusOvershotDirection)
+ {
+ mSignalVerified = true;
+ }
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ }
+
+ bool& mSignalVerified;
+ Actor mCurrentFocusedActor;
+ Toolkit::FocusManager::FocusOvershotDirection mFocusOvershotDirection;
+};
+
+} // namespace
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( UtcDaliFocusManagerGet, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliFocusManagerSetAndGetAccessibilityAttribute, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliFocusManagerSetAndGetFocusOrder, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliFocusManagerGenerateNewFocusOrder, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliFocusManagerGetActorByFocusOrder, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliFocusManagerSetAndGetCurrentFocusActor, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliFocusManagerGetCurrentFocusGroup, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliFocusManagerGetCurrentFocusOrder, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliFocusManagerMoveFocusForward, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliFocusManagerMoveFocusBackward, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliFocusManagerClearFocus, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliFocusManagerReset, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliFocusManagerFocusGroup, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliFocusManagerSetAndGetFocusIndicator, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliFocusManagerSignalFocusChanged, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliFocusManagerSignalFocusOvershot, POSITIVE_TC_IDX );
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliFocusManagerGet()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerGet");
+
+ FocusManager manager;
+
+ //Ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK(registry);
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestCallback );
+ {
+ manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+
+ FocusManager newManager = FocusManager::Get();
+ DALI_TEST_CHECK(newManager);
+
+ // Check that focus manager is a singleton
+ DALI_TEST_CHECK(manager == newManager);
+}
+
+static void UtcDaliFocusManagerSetAndGetAccessibilityAttribute()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerSetAndGetAccessibilityAttribute");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor actor = Actor::New();
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL) == "");
+
+ manager.SetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL, "Description");
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL) == "Description");
+
+ manager.SetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL, "New description");
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, FocusManager::ACCESSIBILITY_LABEL) == "New description");
+}
+
+static void UtcDaliFocusManagerSetAndGetFocusOrder()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerSetAndGetFocusOrder");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor first = Actor::New();
+ Actor second = Actor::New();
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0);
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 0);
+
+ // Set the focus order and description for the first actor
+ manager.SetFocusOrder(first, 1);
+ manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first");
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Set the focus order and description for the second actor
+ manager.SetFocusOrder(second, 2);
+ manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "second");
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
+
+ // check that the focus order of the first actor is changed
+ manager.SetFocusOrder(first, 2);
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 2);
+ // make sure the change of focus order doesn't affect the actor's description
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // check that the focus order of the second actor is increased to 3
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 3);
+ // make sure the change of focus order doesn't affect the actor's description
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
+
+ // check that the focus order of the second actor is changed to 1
+ manager.SetFocusOrder(second, 1);
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 1);
+ // make sure the change of focus order doesn't affect the actor's description
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
+
+ // Set the focus order and description for the third actor
+ Actor third = Actor::New();
+ manager.SetFocusOrder(third, 1);
+ manager.SetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL, "third");
+ DALI_TEST_CHECK(manager.GetFocusOrder(third) == 1);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // check that the focus order of the second actor is increased to 2.
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
+ // make sure the change of focus order doesn't affect the actor's description
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
+
+ // check that the focus order of the first actor is increased to 3.
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 3);
+ // make sure the change of focus order doesn't affect the actor's description
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first");
+}
+
+static void UtcDaliFocusManagerGenerateNewFocusOrder()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerGenerateNewFocusOrder");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ DALI_TEST_CHECK(1 == manager.GenerateNewFocusOrder());
+ DALI_TEST_CHECK(1 == manager.GenerateNewFocusOrder());
+
+ Actor first = Actor::New();
+ Actor second = Actor::New();
+
+ // Set the focus order for the first actor
+ manager.SetFocusOrder(first, 1);
+ manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first");
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
+
+ //Test for new focus order
+ DALI_TEST_CHECK(2 == manager.GenerateNewFocusOrder());
+
+ // Set the focus order for the first actor
+ manager.SetFocusOrder(second, 2);
+ manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "first");
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
+}
+
+static void UtcDaliFocusManagerGetActorByFocusOrder()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerGetActorByFocusOrder");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create the actors and set their focus orders
+ Actor first = Actor::New();
+ manager.SetFocusOrder(first, 1);
+
+ Actor second = Actor::New();
+ manager.SetFocusOrder(second, 2);
+
+ Actor third = Actor::New();
+ manager.SetFocusOrder(third, 3);
+
+ // Check that we get an empty handle as no actor is added to the stage yet.
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == Actor());
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == Actor());
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == Actor());
+
+ // Add the actors to the stage
+ Stage::GetCurrent().Add(first);
+ Stage::GetCurrent().Add(second);
+ Stage::GetCurrent().Add(third);
+
+ // Check that we get an empty handle because focus order 0 means undefined.
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(0) == Actor());
+
+ // Check that we get correct actors for the specified focus orders
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == first);
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == second);
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == third);
+
+ // Change the focus order of the third actor to 1
+ manager.SetFocusOrder(third, 1);
+
+ // Check that we still get correct actors after changing their focus orders
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == third);
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == first);
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == second);
+
+ // Check that we get an empty handle because no actor has a focus order of 4
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(4) == Actor());
+}
+
+static void UtcDaliFocusManagerSetAndGetCurrentFocusActor()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerSetAndGetCurrentFocusActor");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ manager.SetFocusOrder(first, 1);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ manager.SetFocusOrder(second, 2);
+ Stage::GetCurrent().Add(second);
+
+ // Create the third actor but don't add it to the stage
+ Actor third = Actor::New();
+ manager.SetFocusOrder(third, 3);
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Check that it will fail to set focus on an invalid actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(Actor()) == false);
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Check that it will fail to set focus on the third actor as it's not in the stage
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
+
+ // Add the third actor to the stage
+ Stage::GetCurrent().Add(third);
+
+ // make the third actor invisible
+ third.SetVisible(false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Check that it will fail to set focus on the third actor as it's invisible
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
+
+ // Make the third actor visible
+ third.SetVisible(true);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Make the third actor not focusable
+ Property::Index propertyActorFocusable = third.GetPropertyIndex(Toolkit::FocusManager::ACTOR_FOCUSABLE);
+ third.SetProperty(propertyActorFocusable, false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Check that it will fail to set focus on the third actor as it's not focusable
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
+
+ // Make the third actor focusable
+ third.SetProperty(propertyActorFocusable, true);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Check that the focus is successfully moved to the third actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
+
+ // Make the current focused actor to be not focusable by setting its focus order to be 0
+ manager.SetFocusOrder(third, 0);
+
+ // Check that the focus is automatically cleared
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Set the focus order of the third actor again
+ manager.SetFocusOrder(third, 3);
+
+ // Check that the third actor can be focused successfully now
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
+}
+
+static void UtcDaliFocusManagerGetCurrentFocusGroup()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerGetCurrentFocusGroup");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create an actor with two child actors and add it to the stage
+ Actor parent = Actor::New();
+ Actor firstChild = Actor::New();
+ Actor secondChild = Actor::New();
+ parent.Add(firstChild);
+ parent.Add(secondChild);
+ Stage::GetCurrent().Add(parent);
+
+ // Create three actors and add them as the children of the first child actor
+ Actor firstGrandChild = Actor::New();
+ Actor secondGrandChild = Actor::New();
+ Actor thirdGrandChild = Actor::New();
+ firstChild.Add(firstGrandChild);
+ firstChild.Add(secondGrandChild);
+ firstChild.Add(thirdGrandChild);
+
+ // Set focus order to the actors
+ manager.SetFocusOrder(parent, 1);
+ manager.SetFocusOrder(firstChild, 2);
+ manager.SetFocusOrder(firstGrandChild, 3);
+ manager.SetFocusOrder(secondGrandChild, 4);
+ manager.SetFocusOrder(thirdGrandChild, 5);
+ manager.SetFocusOrder(secondChild, 6);
+
+ // Set the parent and the first child actor as focus groups
+ manager.SetFocusGroup(parent, true);
+ DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true);
+
+ // Set focus to the first grand child actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(firstGrandChild) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
+
+ // The current focus group should be the parent, As it is the immediate parent which is also a focus group.
+ DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == parent);
+
+ manager.SetFocusGroup(firstChild, true);
+ DALI_TEST_CHECK(manager.IsFocusGroup(firstChild) == true);
+
+ // The current focus group should be the firstChild, As it is the immediate parent which is also a focus group.
+ DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstChild);
+
+ manager.SetFocusGroup(firstGrandChild, true);
+ DALI_TEST_CHECK(manager.IsFocusGroup(firstGrandChild) == true);
+
+ // The current focus group should be itself, As it is also a focus group.
+ DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstGrandChild);
+
+ // Set focus to the second grand child actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(secondGrandChild) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild);
+
+ // The current focus group should be the firstChild, As it is the immediate parent which is also a
+ // focus group for the current focus actor.
+ DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstChild);
+
+}
+
+static void UtcDaliFocusManagerGetCurrentFocusOrder()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerGetCurrentFocusOrder");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor first = Actor::New();
+ Stage::GetCurrent().Add(first);
+
+ Actor second = Actor::New();
+ Stage::GetCurrent().Add(second);
+
+ Actor third = Actor::New();
+ Stage::GetCurrent().Add(third);
+
+ // Set the focus order and description for the first actor
+ manager.SetFocusOrder(first, 1);
+ manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first");
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Set the focus order and description for the second actor
+ manager.SetFocusOrder(second, 2);
+ manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "second");
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
+
+ // Set the focus order and description for the second actor
+ manager.SetFocusOrder(third, 3);
+ manager.SetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL, "third");
+ DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 0);
+
+ // Set the focus on the first actor and test
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 1);
+
+ // Move the focus forward to the second actor and test
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 2);
+
+ // Move the focus forward to the third actor and test
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 3);
+
+ // Clear focus and test
+ manager.ClearFocus();
+ DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 0);
+}
+
+static void UtcDaliFocusManagerMoveFocusForward()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerMoveFocusForward");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor first = Actor::New();
+ Stage::GetCurrent().Add(first);
+
+ Actor second = Actor::New();
+ Stage::GetCurrent().Add(second);
+
+ Actor third = Actor::New();
+ Stage::GetCurrent().Add(third);
+
+ // Set the focus order and description for the first actor
+ manager.SetFocusOrder(first, 1);
+ manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first");
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Set the focus order and description for the second actor
+ manager.SetFocusOrder(second, 2);
+ manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "second");
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
+
+ // Set the focus order and description for the second actor
+ manager.SetFocusOrder(third, 3);
+ manager.SetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL, "third");
+ DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Set the focus on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Test the non-wrapped move first
+ manager.SetWrapMode(false);
+ DALI_TEST_CHECK(manager.GetWrapMode() == false);
+
+ // Move the focus forward to the second actor
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "second");
+
+ // Move the focus forward to the third actor
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Check that it will fail to move the focus forward again as the third actor is the last
+ // focusable actor in the focus chain
+ manager.MoveFocusForward();
+ // The focus should still be set on the third actor
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Now test the wrapped move
+ manager.SetWrapMode(true);
+ DALI_TEST_CHECK(manager.GetWrapMode() == true);
+
+ // Move the focus forward recursively and this time the first actor should be focused
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Make the second actor not focusable
+ Property::Index propertyActorFocusable = second.GetPropertyIndex(Toolkit::FocusManager::ACTOR_FOCUSABLE);
+ second.SetProperty(propertyActorFocusable, false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Move the focus forward and check that the second actor should be skipped and
+ // the third actor should be focused now.
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Make the first actor invisible
+ first.SetVisible(false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Move the focus forward and check that the first actor should be skipped as it's
+ // invisible and the second actor should also be skipped as it's not focusable,
+ // so the focus will still be on the third actor
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Make the third actor invisible so that no actor can be focused.
+ third.SetVisible(false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Check that the focus move is failed as all the three actors can not be focused
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
+}
+
+static void UtcDaliFocusManagerMoveFocusBackward()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerMoveFocusBackward");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor first = Actor::New();
+ Stage::GetCurrent().Add(first);
+
+ Actor second = Actor::New();
+ Stage::GetCurrent().Add(second);
+
+ Actor third = Actor::New();
+ Stage::GetCurrent().Add(third);
+
+ // Set the focus order and description for the first actor
+ manager.SetFocusOrder(first, 1);
+ manager.SetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL, "first");
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Set the focus order and description for the second actor
+ manager.SetFocusOrder(second, 2);
+ manager.SetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL, "second");
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, FocusManager::ACCESSIBILITY_LABEL) == "second");
+
+ // Set the focus order and description for the second actor
+ manager.SetFocusOrder(third, 3);
+ manager.SetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL, "third");
+ DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Set the focus on the third actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Test the non-wrapped move first
+ manager.SetWrapMode(false);
+ DALI_TEST_CHECK(manager.GetWrapMode() == false);
+
+ // Move the focus backward to the second actor
+ manager.MoveFocusBackward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "second");
+
+ // Move the focus backward to the first actor
+ manager.MoveFocusBackward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Check that it will fail to move the focus backward again as the first actor is the first
+ // focusable actor in the focus chain
+ manager.MoveFocusBackward();
+ // The focus should still be set on the first actor
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Now test the wrapped move
+ manager.SetWrapMode(true);
+ DALI_TEST_CHECK(manager.GetWrapMode() == true);
+
+ // Move the focus backward recursively and this time the third actor should be focused
+ manager.MoveFocusBackward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Make the second actor not focusable
+ Property::Index propertyActorFocusable = second.GetPropertyIndex(Toolkit::FocusManager::ACTOR_FOCUSABLE);
+ second.SetProperty(propertyActorFocusable, false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Move the focus backward and check that the second actor should be skipped and
+ // the first actor should be focused now.
+ manager.MoveFocusBackward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Make the third actor invisible
+ third.SetVisible(false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Move the focus backward and check that the third actor should be skipped as it's
+ // invisible and the second actor should also be skipped as it's not focusable,
+ // so the focus will still be on the first actor
+ manager.MoveFocusBackward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Make the first actor invisible so that no actor can be focused.
+ first.SetVisible(false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Check that the focus move is failed as all the three actors can not be focused
+ manager.MoveFocusBackward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), FocusManager::ACCESSIBILITY_LABEL) == "first");
+}
+
+static void UtcDaliFocusManagerClearFocus()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerClearFocus");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ manager.SetFocusOrder(first, 1);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ manager.SetFocusOrder(second, 2);
+ Stage::GetCurrent().Add(second);
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Clear the focus
+ manager.ClearFocus();
+
+ // Check that no actor is being focused now.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+}
+
+static void UtcDaliFocusManagerReset()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerReset");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ manager.SetFocusOrder(first, 1);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ manager.SetFocusOrder(second, 2);
+ Stage::GetCurrent().Add(second);
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Clear the focus
+ manager.Reset();
+
+ // Check that no actor is being focused now and the focus order of actors have been cleared
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0);
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0);
+}
+
+static void UtcDaliFocusManagerFocusGroup()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerFocusGroup");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create an actor with two child actors and add it to the stage
+ Actor parent = Actor::New();
+ Actor firstChild = Actor::New();
+ Actor secondChild = Actor::New();
+ parent.Add(firstChild);
+ parent.Add(secondChild);
+ Stage::GetCurrent().Add(parent);
+
+ // Create three actors and add them as the children of the first child actor
+ Actor firstGrandChild = Actor::New();
+ Actor secondGrandChild = Actor::New();
+ Actor thirdGrandChild = Actor::New();
+ firstChild.Add(firstGrandChild);
+ firstChild.Add(secondGrandChild);
+ firstChild.Add(thirdGrandChild);
+
+ // Set focus order to the actors
+ manager.SetFocusOrder(parent, 1);
+ manager.SetFocusOrder(firstChild, 2);
+ manager.SetFocusOrder(firstGrandChild, 3);
+ manager.SetFocusOrder(secondGrandChild, 4);
+ manager.SetFocusOrder(thirdGrandChild, 5);
+ manager.SetFocusOrder(secondChild, 6);
+
+ // Set the parent and the first child actor as focus groups
+ manager.SetFocusGroup(parent, true);
+ DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true);
+
+ // The focus group of the parent should be itself, as it is set to be a focus group.
+ DALI_TEST_CHECK(manager.GetFocusGroup(parent) == parent);
+
+ // The focus group of the firstChild should be its parent, as it is the immediate parent which is also a group.
+ DALI_TEST_CHECK(manager.GetFocusGroup(firstChild) == parent);
+
+ manager.SetFocusGroup(firstChild, true);
+ DALI_TEST_CHECK(manager.IsFocusGroup(firstChild) == true);
+
+ // The focus group of the firstChild should be itself, as it is set to be a focus group now.
+ DALI_TEST_CHECK(manager.GetFocusGroup(firstChild) == firstChild);
+
+ // Enable wrap mode for focus movement.
+ manager.SetWrapMode(true);
+ DALI_TEST_CHECK(manager.GetWrapMode() == true);
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Check that the focus is set on the parent actor.
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(parent) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == parent);
+
+ // Check that group mode is disabled.
+ DALI_TEST_CHECK(manager.GetGroupMode() == false);
+
+ // Check that the focus movement is wrapped as normal.
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == thirdGrandChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == parent);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
+
+ // Enable the group mode.
+ manager.SetGroupMode(true);
+ DALI_TEST_CHECK(manager.GetGroupMode() == true);
+
+ // Check that the focus movement is now limited to the current focus group.
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == thirdGrandChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
+}
+
+static void UtcDaliFocusManagerSetAndGetFocusIndicator()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerSetAndGetFocusIndicator");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor defaultFocusIndicatorActor = manager.GetFocusIndicatorActor();
+ DALI_TEST_CHECK(defaultFocusIndicatorActor);
+
+ Actor newFocusIndicatorActor = Actor::New();
+ manager.SetFocusIndicatorActor(newFocusIndicatorActor);
+ DALI_TEST_CHECK(manager.GetFocusIndicatorActor() == newFocusIndicatorActor);
+}
+
+static void UtcDaliFocusManagerSignalFocusChanged()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerSignalFocusChanged");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ bool signalVerified = false;
+ FocusChangedCallback callback(signalVerified);
+ manager.FocusChangedSignal().Connect( &callback, &FocusChangedCallback::Callback );
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ manager.SetFocusOrder(first, 1);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ manager.SetFocusOrder(second, 2);
+ Stage::GetCurrent().Add(second);
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(callback.mSignalVerified);
+ callback.Reset();
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ DALI_TEST_CHECK(callback.mSignalVerified);
+ callback.Reset();
+
+ // Clear the focus
+ manager.ClearFocus();
+
+ // Check that no actor is being focused now.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+ DALI_TEST_CHECK(callback.mSignalVerified);
+}
+
+static void UtcDaliFocusManagerSignalFocusOvershot()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliFocusManagerSignalFocusOvershot");
+
+ FocusManager manager = FocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ bool signalVerified = false;
+ FocusOvershotCallback callback(signalVerified);
+ manager.FocusOvershotSignal().Connect(&callback, &FocusOvershotCallback::Callback);
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ manager.SetFocusOrder(first, 1);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ manager.SetFocusOrder(second, 2);
+ Stage::GetCurrent().Add(second);
+
+ // Check that the wrap mode is disabled
+ DALI_TEST_CHECK(manager.GetWrapMode() == false);
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+
+ // Check that the focus is moved to the second actor successfully.
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Check that the forward focus movement is overshot.
+ callback.mCurrentFocusedActor = second;
+ callback.mFocusOvershotDirection = Toolkit::FocusManager::OVERSHOT_NEXT;
+ DALI_TEST_CHECK(manager.MoveFocusForward() == false);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ DALI_TEST_CHECK(signalVerified);
+ callback.Reset();
+
+ // Enable the wrap mode
+ manager.SetWrapMode(true);
+ DALI_TEST_CHECK(manager.GetWrapMode() == true);
+
+ // Check that the forward focus movement is wrapped and no overshot happens.
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(signalVerified == false);
+
+ // Disable the wrap mode
+ manager.SetWrapMode(false);
+ DALI_TEST_CHECK(manager.GetWrapMode() == false);
+
+ // Check that the backward focus movement is overshot.
+ callback.mCurrentFocusedActor = first;
+ callback.mFocusOvershotDirection = Toolkit::FocusManager::OVERSHOT_PREVIOUS;
+ DALI_TEST_CHECK(manager.MoveFocusBackward() == false);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(signalVerified);
+}
diff --git a/automated-tests/dali-test-suite/focus-manager/utc-Dali-KeyInputFocusManager.cpp b/automated-tests/dali-test-suite/focus-manager/utc-Dali-KeyInputFocusManager.cpp
new file mode 100644
index 0000000..68dd8b3
--- /dev/null
+++ b/automated-tests/dali-test-suite/focus-manager/utc-Dali-KeyInputFocusManager.cpp
@@ -0,0 +1,336 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+
+#include
+
+#include
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+
+/**
+ * Callback class for KeyInputFocusChanged signal.
+ */
+class KeyInputFocusChangedCallback : public Dali::ConnectionTracker
+{
+public:
+ /**
+ * Constructor
+ * @param[in] gainActor Ref to the actor that should be set as the one that gains key input focus.
+ * @param[in] lostActor Ref to the actor that should be set as the one that loses key input focus.
+ */
+ KeyInputFocusChangedCallback( Control& gainActor, Control& lostActor )
+ : mActorGain( gainActor ),
+ mActorLost( lostActor )
+ {
+ }
+
+ void Callback( Control gainingActor, Control lostActor )
+ {
+ mActorGain = gainingActor;
+ mActorLost = lostActor;
+ }
+
+ Control& mActorGain;
+ Control& mActorLost;
+};
+
+// Stores data that is populated in the callback and will be read by the TET cases
+struct SignalData
+{
+ SignalData()
+ : functorCalled(false)
+ {}
+
+ void Reset()
+ {
+ functorCalled = false;
+
+ receivedKeyEvent.keyModifier = 0;
+ receivedKeyEvent.keyPressedName.clear();
+ receivedKeyEvent.keyPressed.clear();
+
+ }
+
+ bool functorCalled;
+ KeyEvent receivedKeyEvent;
+};
+
+/**
+ * Callback class to test SignalUnhandledKeyEvent signal
+ */
+class SignalUnhandledKeyEventCallback : public Dali::ConnectionTracker
+{
+public:
+ SignalUnhandledKeyEventCallback( SignalData& data ) : mSignalData( data ) { }
+
+ void Callback(const KeyEvent& event)
+ {
+ mSignalData.functorCalled = true;
+ mSignalData.receivedKeyEvent = event;
+ }
+
+ SignalData& mSignalData;
+};
+
+} // namespace
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( UtcDaliKeyInputFocusManagerGet, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliKeyInputFocusManagerSetFocus, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliKeyInputFocusManagerGetCurrentFocusControl, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliKeyInputFocusManagerRemoveFocus, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliKeyInputFocusManagerIsKeyboardListener, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent, POSITIVE_TC_IDX );
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliKeyInputFocusManagerGet()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyInputFocusManagerGet");
+
+ KeyInputFocusManager manager;
+ {
+ manager = KeyInputFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+ }
+
+ KeyInputFocusManager newManager = KeyInputFocusManager::Get();
+ DALI_TEST_CHECK(newManager);
+
+ // Check that focus manager is a singleton
+ DALI_TEST_CHECK(manager == newManager);
+}
+
+static void UtcDaliKeyInputFocusManagerSetFocus()
+{
+ ToolkitTestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ tet_infoline(" UtcDaliKeyInputFocusManagerSetFocus");
+
+ KeyInputFocusManager manager = KeyInputFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ PushButton pushButton1 = PushButton::New();
+ stage.Add( pushButton1 );
+
+ manager.SetFocus(pushButton1);
+ DALI_TEST_CHECK(pushButton1.HasKeyInputFocus());
+}
+
+static void UtcDaliKeyInputFocusManagerGetCurrentFocusControl()
+{
+ ToolkitTestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ tet_infoline(" UtcDaliKeyInputFocusManagerGetCurrentFocusControl");
+
+ KeyInputFocusManager manager = KeyInputFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ PushButton pushButton1 = PushButton::New();
+ PushButton pushButton2 = PushButton::New();
+ stage.Add( pushButton1 );
+ stage.Add( pushButton2 );
+
+ manager.SetFocus(pushButton1);
+ DALI_TEST_CHECK(pushButton1 == manager.GetCurrentFocusControl());
+
+ manager.SetFocus(pushButton2);
+ DALI_TEST_CHECK(pushButton2 == manager.GetCurrentFocusControl());
+
+ manager.SetFocus(pushButton1);
+ DALI_TEST_CHECK(pushButton1 == manager.GetCurrentFocusControl());
+}
+
+static void UtcDaliKeyInputFocusManagerRemoveFocus()
+{
+ ToolkitTestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ tet_infoline(" UtcDaliKeyInputFocusManagerRemoveFocus");
+
+ KeyInputFocusManager manager = KeyInputFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ PushButton pushButton1 = PushButton::New();
+ PushButton pushButton2 = PushButton::New();
+ stage.Add( pushButton1 );
+ stage.Add( pushButton2 );
+
+ manager.SetFocus(pushButton1);
+ DALI_TEST_CHECK(pushButton1 == manager.GetCurrentFocusControl());
+
+ manager.SetFocus(pushButton2);
+ DALI_TEST_CHECK(pushButton2 == manager.GetCurrentFocusControl());
+
+ manager.RemoveFocus(pushButton2);
+ DALI_TEST_CHECK(pushButton1 == manager.GetCurrentFocusControl());
+
+ manager.RemoveFocus(pushButton1);
+ DALI_TEST_CHECK(Control() == manager.GetCurrentFocusControl());
+}
+
+static void UtcDaliKeyInputFocusManagerIsKeyboardListener()
+{
+ ToolkitTestApplication application;
+ Stage stage = Stage::GetCurrent();
+
+ tet_infoline(" UtcDaliKeyInputFocusManagerIsKeyboardListener");
+
+ KeyInputFocusManager manager = KeyInputFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ PushButton pushButton1 = PushButton::New();
+ PushButton pushButton2 = PushButton::New();
+ stage.Add( pushButton1 );
+ stage.Add( pushButton2 );
+
+ manager.SetFocus(pushButton1);
+ DALI_TEST_CHECK(pushButton1 == manager.GetCurrentFocusControl());
+
+ manager.SetFocus(pushButton2);
+ DALI_TEST_CHECK(pushButton2 == manager.GetCurrentFocusControl());
+
+ DALI_TEST_CHECK(manager.IsKeyboardListener(pushButton1));
+ DALI_TEST_CHECK(manager.IsKeyboardListener(pushButton2));
+
+ manager.RemoveFocus(pushButton2);
+ DALI_TEST_CHECK(!manager.IsKeyboardListener(pushButton2));
+
+ manager.RemoveFocus(pushButton1);
+ DALI_TEST_CHECK(!manager.IsKeyboardListener(pushButton1));
+
+ manager.SetFocus(pushButton2);
+ DALI_TEST_CHECK(manager.IsKeyboardListener(pushButton2));
+ pushButton2.ClearKeyInputFocus();
+ DALI_TEST_CHECK(!manager.IsKeyboardListener(pushButton2));
+}
+
+static void UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged()
+{
+ ToolkitTestApplication application;
+ KeyInputFocusManager manager = KeyInputFocusManager::Get();
+ Stage stage = Stage::GetCurrent();
+
+ tet_infoline(" UtcDaliKeyInputFocusManagerSignalKeyInputFocusChanged");
+
+ PushButton pushButton1 = PushButton::New();
+ PushButton pushButton2 = PushButton::New();
+
+ stage.Add( pushButton1 );
+ stage.Add( pushButton2 );
+
+ PushButton gainActor, lostActor;
+ KeyInputFocusChangedCallback callback( gainActor, lostActor );
+ manager.KeyInputFocusChangedSignal().Connect( &callback, &KeyInputFocusChangedCallback::Callback );
+
+ manager.SetFocus(pushButton1);
+
+ DALI_TEST_CHECK( gainActor == pushButton1 );
+ DALI_TEST_CHECK( lostActor == Control() );
+
+ gainActor = lostActor = NULL;
+
+ manager.SetFocus(pushButton2);
+
+ DALI_TEST_CHECK( gainActor == pushButton2 );
+ DALI_TEST_CHECK( lostActor == pushButton1 );
+
+ gainActor = lostActor = NULL;
+
+ // Removing the focus actor from the stage would also result in signal emission.
+ stage.Remove( pushButton1 );
+ stage.Remove( pushButton2 );
+
+ DALI_TEST_CHECK( gainActor == Control() );
+ DALI_TEST_CHECK( lostActor == Control() );
+}
+
+static void UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline("UtcDaliKeyInputFocusManagerSignalUnhandledKeyEvent");
+
+ SignalData data;
+ SignalUnhandledKeyEventCallback callback( data );
+
+ KeyInputFocusManager manager = KeyInputFocusManager::Get();
+ manager.UnhandledKeyEventSignal().Connect( &callback, &SignalUnhandledKeyEventCallback::Callback );
+
+ Dali::Integration::Core& core = application.GetCore();
+
+ Integration::KeyEvent event("a", "a", 0, 0, 0, Integration::KeyEvent::Up);
+ core.SendEvent(event);
+
+ DALI_TEST_CHECK(data.functorCalled);
+ DALI_TEST_CHECK(event.keyName == data.receivedKeyEvent.keyPressedName );
+ DALI_TEST_CHECK(event.keyCode == data.receivedKeyEvent.keyCode);
+ DALI_TEST_CHECK(event.keyString == data.receivedKeyEvent.keyPressed );
+ DALI_TEST_CHECK(event.state == data.receivedKeyEvent.state );
+
+ data.Reset();
+
+ Integration::KeyEvent event2("v", "v", 0, 0, 0, Integration::KeyEvent::Up);
+ core.SendEvent(event2);
+
+ DALI_TEST_CHECK(data.functorCalled);
+ DALI_TEST_CHECK(event2.keyName == data.receivedKeyEvent.keyPressedName );
+ DALI_TEST_CHECK(event2.keyCode == data.receivedKeyEvent.keyCode);
+ DALI_TEST_CHECK(event2.keyString == data.receivedKeyEvent.keyPressed );
+}
diff --git a/automated-tests/dali-test-suite/focus-manager/utc-Dali-KeyboardFocusManager.cpp b/automated-tests/dali-test-suite/focus-manager/utc-Dali-KeyboardFocusManager.cpp
new file mode 100644
index 0000000..6f4d447
--- /dev/null
+++ b/automated-tests/dali-test-suite/focus-manager/utc-Dali-KeyboardFocusManager.cpp
@@ -0,0 +1,738 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+
+#include
+
+#include
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+namespace
+{
+
+// Functors to test whether PreFocusChange signal is emitted when the keyboard focus is about to change
+class PreFocusChangeCallback : public Dali::ConnectionTracker
+{
+public:
+ PreFocusChangeCallback(bool& signalReceived)
+ : mSignalVerified(signalReceived),
+ mCurrentFocusedActor(),
+ mProposedActorToFocus(),
+ mDirection(Control::Left)
+ {
+ }
+
+ Actor Callback(Actor currentFocusedActor, Actor proposedActorToFocus, Control::KeyboardFocusNavigationDirection direction)
+ {
+ tet_infoline("Verifying PreFocusChangeCallback()");
+
+ mSignalVerified = true;
+
+ mCurrentFocusedActor = currentFocusedActor;
+ mProposedActorToFocus = proposedActorToFocus;
+ mDirection = direction;
+
+ return mProposedActorToFocus;
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ mCurrentFocusedActor = Actor();
+ mProposedActorToFocus = Actor();
+ mDirection = Control::Left;
+ }
+
+ bool& mSignalVerified;
+ Actor mCurrentFocusedActor;
+ Actor mProposedActorToFocus;
+ Control::KeyboardFocusNavigationDirection mDirection;
+};
+
+// Functors to test whether focus changed signal is emitted when the keyboard focus is changed
+class FocusChangedCallback : public Dali::ConnectionTracker
+{
+public:
+ FocusChangedCallback(bool& signalReceived)
+ : mSignalVerified(signalReceived),
+ mOriginalFocusedActor(),
+ mCurrentFocusedActor()
+ {
+ }
+
+ void Callback(Actor originalFocusedActor, Actor currentFocusedActor)
+ {
+ tet_infoline("Verifying FocusChangedCallback()");
+
+ if(originalFocusedActor == mCurrentFocusedActor)
+ {
+ mSignalVerified = true;
+ }
+
+ mOriginalFocusedActor = originalFocusedActor;
+ mCurrentFocusedActor = currentFocusedActor;
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ }
+
+ bool& mSignalVerified;
+ Actor mOriginalFocusedActor;
+ Actor mCurrentFocusedActor;
+};
+
+// Functors to test whether focus group changed signal is emitted when the keyboard focus group is changed
+class FocusGroupChangedCallback : public Dali::ConnectionTracker
+{
+public:
+ FocusGroupChangedCallback(bool& signalReceived)
+ : mSignalVerified(signalReceived),
+ mCurrentFocusedActor(),
+ mForward(true)
+ {
+ }
+
+ void Callback(Actor currentFocusedActor, bool forward)
+ {
+ tet_infoline("Verifying FocusGroupChangedCallback()");
+
+ mSignalVerified = true;
+
+ mCurrentFocusedActor = currentFocusedActor;
+ mForward = forward;
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ }
+
+ bool& mSignalVerified;
+ Actor mCurrentFocusedActor;
+ bool mForward;
+};
+
+// Functors to test whether focused actor activated signal is emitted when the focused actor is activated
+class FocusedActorActivatedCallback : public Dali::ConnectionTracker
+{
+public:
+ FocusedActorActivatedCallback(bool& signalReceived)
+ : mSignalVerified(signalReceived),
+ mActivatedActor()
+ {
+ }
+
+ void Callback(Actor activatedActor)
+ {
+ tet_infoline("Verifying FocusedActorActivatedCallback()");
+
+ mSignalVerified = true;
+
+ mActivatedActor = activatedActor;
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ }
+
+ bool& mSignalVerified;
+ Actor mActivatedActor;
+};
+
+} // namespace
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MAX_NUMBER_OF_TESTS 10000
+extern "C" {
+ struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
+}
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+TEST_FUNCTION( UtcDaliKeyboardFocusManagerGet, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliKeyboardFocusManagerMoveFocus, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliKeyboardFocusManagerClearFocus, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliKeyboardFocusManagerSetAsFocusGroup, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliKeyboardFocusManagerGetFocusGroup, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliKeyboardFocusManagerSignalFocusGroupChanged, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliKeyboardFocusManagerSignalFocusedActorActivated, POSITIVE_TC_IDX );
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliKeyboardFocusManagerGet()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardKeyboardFocusManagerGet");
+
+ // Register Type
+ TypeInfo type;
+ type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
+ DALI_TEST_CHECK( type );
+ BaseHandle handle = type.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ KeyboardFocusManager manager;
+
+ manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ KeyboardFocusManager newManager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(newManager);
+
+ // Check that focus manager is a singleton
+ DALI_TEST_CHECK(manager == newManager);
+}
+
+static void UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor");
+
+ // Register Type
+ TypeInfo type;
+ type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
+ DALI_TEST_CHECK( type );
+ BaseHandle handle = type.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ first.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ second.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(second);
+
+ // Create the third actor but don't add it to the stage
+ Actor third = Actor::New();
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Check that it will fail to set focus on an invalid actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(Actor()) == false);
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Check that it will fail to set focus on the third actor as it's not in the stage
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Add the third actor to the stage
+ Stage::GetCurrent().Add(third);
+
+ // Check that it will fail to set focus on the third actor as it's not focusable
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Make the third actor focusable
+ third.SetKeyboardFocusable(true);
+
+ // Check that the focus is successfully moved to the third actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+}
+
+static void UtcDaliKeyboardFocusManagerMoveFocus()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerMoveFocus");
+
+ // Register Type
+ TypeInfo type;
+ type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
+ DALI_TEST_CHECK( type );
+ BaseHandle handle = type.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ bool preFocusChangeSignalVerified = false;
+ PreFocusChangeCallback preFocusChangeCallback(preFocusChangeSignalVerified);
+ manager.PreFocusChangeSignal().Connect( &preFocusChangeCallback, &PreFocusChangeCallback::Callback );
+
+ bool focusChangedSignalVerified = false;
+ FocusChangedCallback focusChangedCallback(focusChangedSignalVerified);
+ manager.FocusChangedSignal().Connect( &focusChangedCallback, &FocusChangedCallback::Callback );
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ first.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ second.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(second);
+
+ // Move the focus to the right
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Right) == false);
+
+ // Because no layout control in the stage and no actor is focused, it should emit the PreFocusChange signal
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::Right);
+ preFocusChangeCallback.Reset();
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == Actor());
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
+ focusChangedCallback.Reset();
+
+ // Move the focus towards right
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Right) == false);
+
+ // Because no layout control in the stage and the first actor is focused, it should emit the PreFocusChange signal
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first);
+ DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::Right);
+ preFocusChangeCallback.Reset();
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second);
+ focusChangedCallback.Reset();
+
+ // Move the focus towards up
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Up) == false);
+
+ // Because no layout control in the stage and no actor is focused, it should emit the PreFocusChange signal
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == second);
+ DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::Up);
+ preFocusChangeCallback.Reset();
+ DALI_TEST_CHECK(!focusChangedCallback.mSignalVerified);
+
+ // Create a 2x2 table view and try to move focus inside it
+ TableView tableView = TableView::New( 2, 2 );
+ Stage::GetCurrent().Add(tableView);
+
+ // Create the third actor
+ Actor third = Actor::New();
+ third.SetKeyboardFocusable(true);
+
+ // Create the fourth actor
+ Actor fourth = Actor::New();
+ fourth.SetKeyboardFocusable(true);
+
+ // Add the four children to table view
+ tableView.AddChild(first, TableView::CellPosition(0, 0));
+ tableView.AddChild(second, TableView::CellPosition(0, 1));
+ tableView.AddChild(third, TableView::CellPosition(1, 0));
+ tableView.AddChild(fourth, TableView::CellPosition(1, 1));
+
+ // Set the focus to the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == second);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
+ focusChangedCallback.Reset();
+
+ // Move the focus towards right
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Right) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second);
+ focusChangedCallback.Reset();
+
+ // Move the focus towards down
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Down) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == fourth);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == second);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == fourth);
+ focusChangedCallback.Reset();
+
+ // Move the focus towards left
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Left) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == fourth);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == third);
+ focusChangedCallback.Reset();
+
+ // Move the focus towards up
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Up) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == third);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
+ focusChangedCallback.Reset();
+
+ // Move the focus towards left. The focus move will fail as no way to move it upwards
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Left) == false);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first);
+ DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::Left);
+ preFocusChangeCallback.Reset();
+ DALI_TEST_CHECK(!focusChangedCallback.mSignalVerified);
+
+ // Enable the loop
+ manager.SetFocusGroupLoop(true);
+ DALI_TEST_CHECK(manager.GetFocusGroupLoop() == true);
+
+ // Move the focus towards left again. The focus should move to the fourth actor.
+ DALI_TEST_CHECK(manager.MoveFocus(Control::Left) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == fourth);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == fourth);
+ focusChangedCallback.Reset();
+}
+
+static void UtcDaliKeyboardFocusManagerClearFocus()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerClearFocus");
+
+ // Register Type
+ TypeInfo type;
+ type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
+ DALI_TEST_CHECK( type );
+ BaseHandle handle = type.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ first.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ second.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(second);
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Clear the focus
+ manager.ClearFocus();
+
+ // Check that no actor is being focused now.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+}
+
+static void UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerSetAndGetFocusGroupLoop");
+
+ // Register Type
+ TypeInfo type;
+ type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
+ DALI_TEST_CHECK( type );
+ BaseHandle handle = type.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Check that the focus movement is not looped within the same focus group by default
+ DALI_TEST_CHECK(manager.GetFocusGroupLoop() == false);
+
+ // Enable the loop
+ manager.SetFocusGroupLoop(true);
+ DALI_TEST_CHECK(manager.GetFocusGroupLoop() == true);
+}
+
+static void UtcDaliKeyboardFocusManagerSetAsFocusGroup()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerSetAsFocusGroup");
+
+ // Register Type
+ TypeInfo type;
+ type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
+ DALI_TEST_CHECK( type );
+ BaseHandle handle = type.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create an actor and check that it is not a focus group by default
+ Actor actor = Actor::New();
+ DALI_TEST_CHECK(manager.IsFocusGroup(actor) == false);
+
+ // Set the actor as focus group
+ manager.SetAsFocusGroup(actor, true);
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(manager.IsFocusGroup(actor) == true);
+
+ // Set the actor not as focus group
+ manager.SetAsFocusGroup(actor, false);
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(manager.IsFocusGroup(actor) == false);
+}
+
+static void UtcDaliKeyboardFocusManagerGetFocusGroup()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerGetFocusGroup");
+
+ // Register Type
+ TypeInfo type;
+ type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
+ DALI_TEST_CHECK( type );
+ BaseHandle handle = type.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create an actor with two child actors and add it to the stage
+ Actor parent = Actor::New();
+ Actor child = Actor::New();
+ parent.Add(child);
+ Stage::GetCurrent().Add(parent);
+
+ // Create three actors and add them as the children of the first child actor
+ Actor grandChild = Actor::New();
+ child.Add(grandChild);
+
+ // Set the parent and the first child actor as focus groups
+ manager.SetAsFocusGroup(parent, true);
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true);
+
+ // The current focus group should be the parent, As it is the immediate parent which is also a focus group.
+ DALI_TEST_CHECK(manager.GetFocusGroup(grandChild) == parent);
+
+ manager.SetAsFocusGroup(child, true);
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(manager.IsFocusGroup(child) == true);
+
+ // The focus group should be the child, As it is the immediate parent which is also a focus group.
+ DALI_TEST_CHECK(manager.GetFocusGroup(grandChild) == child);
+
+ manager.SetAsFocusGroup(grandChild, true);
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(manager.IsFocusGroup(grandChild) == true);
+
+ // The current focus group should be itself, As it is also a focus group.
+ DALI_TEST_CHECK(manager.GetFocusGroup(grandChild) == grandChild);
+}
+
+static void UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerSetAndGetFocusIndicator");
+
+ // Register Type
+ TypeInfo type;
+ type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
+ DALI_TEST_CHECK( type );
+ BaseHandle handle = type.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor defaultFocusIndicatorActor = manager.GetFocusIndicatorActor();
+ DALI_TEST_CHECK(defaultFocusIndicatorActor);
+
+ Actor newFocusIndicatorActor = Actor::New();
+ manager.SetFocusIndicatorActor(newFocusIndicatorActor);
+ DALI_TEST_CHECK(manager.GetFocusIndicatorActor() == newFocusIndicatorActor);
+}
+
+static void UtcDaliKeyboardFocusManagerSignalFocusGroupChanged()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerSignalFocusGroupChanged");
+
+ // Register Type
+ TypeInfo type;
+ type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
+ DALI_TEST_CHECK( type );
+ BaseHandle handle = type.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ bool focusGroupChangedSignalVerified = false;
+ FocusGroupChangedCallback focusGroupChangedCallback(focusGroupChangedSignalVerified);
+ manager.FocusGroupChangedSignal().Connect( &focusGroupChangedCallback, &FocusGroupChangedCallback::Callback );
+
+ Dali::Integration::Core& core = application.GetCore();
+ Integration::KeyEvent tabEvent("Tab", "", 0, 0, 0, Integration::KeyEvent::Down);
+ Integration::KeyEvent shiftTabEvent("Tab", "", 1, 0, 0, Integration::KeyEvent::Down);
+
+ // Send the tab event to change focus group in the forward direction
+ core.SendEvent(tabEvent);
+ DALI_TEST_CHECK(focusGroupChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusGroupChangedCallback.mCurrentFocusedActor == Actor());
+ DALI_TEST_CHECK(focusGroupChangedCallback.mForward == true);
+ focusGroupChangedCallback.Reset();
+
+ // Send the shift tab event to change focus group in the backward direction
+ core.SendEvent(shiftTabEvent);
+ DALI_TEST_CHECK(focusGroupChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusGroupChangedCallback.mCurrentFocusedActor == Actor());
+ DALI_TEST_CHECK(focusGroupChangedCallback.mForward == false);
+ focusGroupChangedCallback.Reset();
+}
+
+static void UtcDaliKeyboardFocusManagerSignalFocusedActorActivated()
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerSignalFocusedActorActivated");
+
+ // Register Type
+ TypeInfo type;
+ type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
+ DALI_TEST_CHECK( type );
+ BaseHandle handle = type.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ bool focusedActorActivatedSignalVerified = false;
+ FocusedActorActivatedCallback focusedActorActivatedCallback(focusedActorActivatedSignalVerified);
+ manager.FocusedActorActivatedSignal().Connect( &focusedActorActivatedCallback, &FocusedActorActivatedCallback::Callback );
+
+ Dali::Integration::Core& core = application.GetCore();
+ Integration::KeyEvent returnEvent("Return", "", 0, 0, 0, Integration::KeyEvent::Up);
+
+ // Create the first button and add it to the stage
+ PushButton firstPushButton = PushButton::New();
+ firstPushButton.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(firstPushButton);
+
+ // Create the second button and add it to the stage
+ PushButton secondPushButton = PushButton::New();
+ secondPushButton.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(secondPushButton);
+
+ // Check that the focus is set on the first button
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(firstPushButton) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstPushButton);
+
+ // Send the return event to activate the first button
+ core.SendEvent(returnEvent);
+ DALI_TEST_CHECK(focusedActorActivatedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusedActorActivatedCallback.mActivatedActor == firstPushButton);
+ focusedActorActivatedCallback.Reset();
+
+ // Check that the focus is set on the second button
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(secondPushButton) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondPushButton);
+
+ // Send the return event again to activate the second button
+ core.SendEvent(returnEvent);
+ DALI_TEST_CHECK(focusedActorActivatedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusedActorActivatedCallback.mActivatedActor == secondPushButton);
+ focusedActorActivatedCallback.Reset();
+}
diff --git a/automated-tests/dali-test-suite/item-view/.gitignore b/automated-tests/dali-test-suite/item-view/.gitignore
new file mode 100644
index 0000000..390c9e4
--- /dev/null
+++ b/automated-tests/dali-test-suite/item-view/.gitignore
@@ -0,0 +1,8 @@
+utc-Dali-ItemView
+utc-Dali-ItemLayout
+utc-Dali-GridLayout
+utc-Dali-DepthLayout
+utc-Dali-SpiralLayout
+utc-Dali-NavigationLayout
+utc-Dali-AlbumLayout
+utc-Dali-RollLayout
diff --git a/automated-tests/dali-test-suite/item-view/Makefile b/automated-tests/dali-test-suite/item-view/Makefile
new file mode 120000
index 0000000..c88d5a7
--- /dev/null
+++ b/automated-tests/dali-test-suite/item-view/Makefile
@@ -0,0 +1 @@
+../master-makefile.mk
\ No newline at end of file
diff --git a/automated-tests/dali-test-suite/item-view/file.list b/automated-tests/dali-test-suite/item-view/file.list
new file mode 100644
index 0000000..37417ed
--- /dev/null
+++ b/automated-tests/dali-test-suite/item-view/file.list
@@ -0,0 +1,9 @@
+TARGETS += \
+ utc-Dali-ItemView \
+ utc-Dali-ItemLayout \
+ utc-Dali-GridLayout \
+ utc-Dali-DepthLayout \
+ utc-Dali-SpiralLayout \
+ utc-Dali-NavigationLayout \
+ utc-Dali-AlbumLayout \
+ utc-Dali-RollLayout \
diff --git a/automated-tests/dali-test-suite/item-view/tslist b/automated-tests/dali-test-suite/item-view/tslist
new file mode 100644
index 0000000..e6beeab
--- /dev/null
+++ b/automated-tests/dali-test-suite/item-view/tslist
@@ -0,0 +1,8 @@
+/dali-test-suite/item-view/utc-Dali-ItemView
+/dali-test-suite/item-view/utc-Dali-ItemLayout
+/dali-test-suite/item-view/utc-Dali-GridLayout
+/dali-test-suite/item-view/utc-Dali-DepthLayout
+/dali-test-suite/item-view/utc-Dali-SpiralLayout
+/dali-test-suite/item-view/utc-Dali-NavigationLayout
+/dali-test-suite/item-view/utc-Dali-AlbumLayout
+/dali-test-suite/item-view/utc-Dali-RollLayout
diff --git a/automated-tests/dali-test-suite/item-view/utc-Dali-AlbumLayout.cpp b/automated-tests/dali-test-suite/item-view/utc-Dali-AlbumLayout.cpp
new file mode 100755
index 0000000..4569164
--- /dev/null
+++ b/automated-tests/dali-test-suite/item-view/utc-Dali-AlbumLayout.cpp
@@ -0,0 +1,402 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+
+#include
+
+using namespace Dali;
+
+using namespace Toolkit;
+
+using namespace std;
+
+
+namespace
+{
+
+Vector3 AlbumLayoutItemSizeFunction(const Vector3& layoutSize)
+{
+ float width = layoutSize.width * 0.2f;
+ return Vector3(width, width, width);
+}
+
+float AlbumLayoutAlbumRadiusFunction(const Vector3& layoutSize)
+{
+ return layoutSize.width * 0.5f;
+}
+} // namespace
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+static void UtcDaliAlbumLayoutNew();
+static void UtcDaliAlbumSetAndGetItemSizeFunction();
+static void UtcDaliAlbumSetAndGetScrollSpeedFactor();
+static void UtcDaliAlbumSetAndGetMaximumSwipeSpeed();
+static void UtcDaliAlbumLayoutSetAndGetItemFlickAnimationDuration();
+static void UtcDaliAlbumSetNumOfItems();
+static void UtcDaliAlbumSetStackNum();
+static void UtcDaliAlbumSetPosition();
+static void UtcDaliAlbumSetRotationX();
+static void UtcDaliAlbumSetRotationZ();
+static void UtcDaliAlbumSetScale();
+static void UtcDaliAlbumSetColor();
+static void UtcDaliAlbumSetCenterPosition();
+static void UtcDaliAlbumSetSetCenterScale();
+static void UtcDaliAlbumSetSetCenterColor();
+static void UtcDaliAlbumSetStackPosition();
+static void UtcDaliAlbumSetSetStackScale();
+static void UtcDaliAlbumSetStackColor();
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+extern "C" {
+ struct tet_testlist tet_testlist[] = {
+ { UtcDaliAlbumLayoutNew, POSITIVE_TC_IDX },
+ { UtcDaliAlbumSetAndGetItemSizeFunction, POSITIVE_TC_IDX },
+ { UtcDaliAlbumSetAndGetScrollSpeedFactor, POSITIVE_TC_IDX },
+ { UtcDaliAlbumSetAndGetMaximumSwipeSpeed, POSITIVE_TC_IDX },
+ { UtcDaliAlbumLayoutSetAndGetItemFlickAnimationDuration, POSITIVE_TC_IDX },
+ { UtcDaliAlbumSetNumOfItems, POSITIVE_TC_IDX },
+ { UtcDaliAlbumSetStackNum, POSITIVE_TC_IDX },
+ { UtcDaliAlbumSetPosition, POSITIVE_TC_IDX },
+ { UtcDaliAlbumSetRotationX, POSITIVE_TC_IDX },
+ { UtcDaliAlbumSetRotationZ, POSITIVE_TC_IDX },
+ { UtcDaliAlbumSetScale, POSITIVE_TC_IDX },
+ { UtcDaliAlbumSetColor, POSITIVE_TC_IDX },
+ { UtcDaliAlbumSetCenterPosition, POSITIVE_TC_IDX },
+ { UtcDaliAlbumSetSetCenterScale, POSITIVE_TC_IDX },
+ { UtcDaliAlbumSetSetCenterColor, POSITIVE_TC_IDX },
+ { UtcDaliAlbumSetStackPosition, POSITIVE_TC_IDX },
+ { UtcDaliAlbumSetSetStackScale, POSITIVE_TC_IDX },
+ { UtcDaliAlbumSetStackColor, POSITIVE_TC_IDX },
+ { NULL, 0 }
+ };
+}
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliAlbumLayoutNew()
+{
+ ToolkitTestApplication application;
+
+ // Create a album layout
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ DALI_TEST_CHECK(albumLayout);
+}
+
+static void UtcDaliAlbumSetAndGetItemSizeFunction()
+{
+ ToolkitTestApplication application;
+
+ // Create a album layout
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ // Set the item size function
+ albumLayout->SetItemSizeFunction(AlbumLayoutItemSizeFunction);
+
+ // Check whether we get the correct item size function
+ DALI_TEST_CHECK(albumLayout->GetItemSizeFunction() == AlbumLayoutItemSizeFunction);
+}
+
+static void UtcDaliAlbumSetAndGetScrollSpeedFactor()
+{
+ ToolkitTestApplication application;
+
+ // Create a album layout
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ // Set the scroll speed factor
+ albumLayout->SetScrollSpeedFactor(0.05f);
+
+ // Check whether we get the correct scroll speed factor
+ DALI_TEST_EQUALS( albumLayout->GetScrollSpeedFactor(), 0.05f, TEST_LOCATION );
+}
+
+static void UtcDaliAlbumSetAndGetMaximumSwipeSpeed()
+{
+ ToolkitTestApplication application;
+
+ // Create a album layout
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ // Set the maximum swipe speed
+ albumLayout->SetMaximumSwipeSpeed(50.0f);
+
+ // Check whether we get the correct maximum swipe speed
+ DALI_TEST_EQUALS( albumLayout->GetMaximumSwipeSpeed(), 50.0f, TEST_LOCATION );
+}
+
+static void UtcDaliAlbumLayoutSetAndGetItemFlickAnimationDuration()
+{
+ ToolkitTestApplication application;
+
+ // Create a album layout
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ // Set the flick animaiton duration
+ albumLayout->SetItemFlickAnimationDuration(0.35f);
+
+ // Check whether we get the correct flick animaiton duration
+ DALI_TEST_EQUALS( albumLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION );
+}
+
+static void UtcDaliAlbumSetNumOfItems()
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ albumLayout->SetNumOfItems(15);
+
+ DALI_TEST_CHECK(albumLayout->GetNumOfItems() == 15);
+}
+
+static void UtcDaliAlbumSetStackNum()
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ albumLayout->SetStackNum(30);
+
+ DALI_TEST_CHECK(albumLayout->GetStackNum() == 30);
+}
+
+static void UtcDaliAlbumSetPosition()
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ std::vector position_list;
+
+ /*(0.0f)*/
+ Vector3 pos = Vector3(850.0f,-250.0f,0.0);
+ position_list.push_back(pos);
+
+ /*(1.0f)*/
+ pos = Vector3(700.0f,50.0f,0.0);
+ position_list.push_back(pos);
+
+ /*(2.0f)*/
+ pos = Vector3(440.0f,227.0f,0.0);
+ position_list.push_back(pos);
+
+ /*(4.0f)*/
+ pos = Vector3(-440.0f,227.0f,0.0);
+ position_list.push_back(pos);
+
+ /*(5.0f)*/
+ pos = Vector3(-700.0f,50.0f,0.0);
+ position_list.push_back(pos);
+
+ /*(6.0f)*/
+ pos = Vector3(-850.0f,-250.0f,0.0);
+ position_list.push_back(pos);
+
+ albumLayout->SetPosition(position_list);
+
+ DALI_TEST_CHECK(albumLayout->GetPosition() == position_list);
+}
+
+static void UtcDaliAlbumSetRotationX()
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ albumLayout->SetRotationX(Math::PI/4.0f);
+
+ DALI_TEST_CHECK(albumLayout->GetRotationX() == Math::PI/4.0f);
+}
+
+static void UtcDaliAlbumSetRotationZ()
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ std::vector rotation_list;
+
+ /*(0.0f)*/
+ float rotate = Math::PI/6.0f;
+ rotation_list.push_back(rotate);
+
+ /*(1.0f)*/
+ rotate = 0.0f;
+ rotation_list.push_back(rotate);
+
+ /*(2.0f)*/
+ rotate = Math::PI/6.0f;
+ rotation_list.push_back(rotate);
+
+ /*(4.0f)*/
+ rotate = -Math::PI/6.0f;
+ rotation_list.push_back(rotate);
+
+ /*(5.0f)*/
+ rotate = 0.0f;
+ rotation_list.push_back(rotate);
+
+ /*(6.0f)*/
+ rotate = -Math::PI/6.0f;
+ rotation_list.push_back(rotate);
+
+ albumLayout->SetRotationZ(rotation_list);
+
+ DALI_TEST_CHECK(albumLayout->GetRotationZ() == rotation_list);
+}
+
+static void UtcDaliAlbumSetScale()
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ std::vector scale_list;
+
+ /*(0.0f)*/
+ float scale = 1.0f;
+ scale_list.push_back(scale);
+
+ /*(1.0f)*/
+ scale = 0.0f;
+ scale_list.push_back(scale);
+
+ /*(2.0f)*/
+ scale = Math::PI/6.0f;
+ scale_list.push_back(scale);
+
+ /*(4.0f)*/
+ scale = -Math::PI/6.0f;
+ scale_list.push_back(scale);
+
+ /*(5.0f)*/
+ scale = 0.0f;
+ scale_list.push_back(scale);
+
+ /*(6.0f)*/
+ scale = -Math::PI/6.0f;
+ scale_list.push_back(scale);
+
+ albumLayout->SetScale(scale_list);
+
+ DALI_TEST_CHECK(albumLayout->GetScale() == scale_list);
+}
+
+static void UtcDaliAlbumSetColor()
+{
+ // Create a album layout
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ std::vector color_list;
+
+ /*(0.0f)*/
+ Vector2 color = Vector2(1.0f,1.0f);
+ color_list.push_back(color);
+
+ /*(1.0f)*/
+ color = Vector2(1.0f,1.0f);
+ color_list.push_back(color);
+
+ /*(2.0f)*/
+ color = Vector2(1.0f,1.0f);
+ color_list.push_back(color);
+
+ /*(4.0f)*/
+ color = Vector2(1.0f,1.0f);
+ color_list.push_back(color);
+
+ /*(5.0f)*/
+ color = Vector2(1.0f,1.0f);
+ color_list.push_back(color);
+
+ /*(6.0f)*/
+ color = Vector2(1.0f,1.0f);
+ color_list.push_back(color);
+
+ albumLayout->SetColor(color_list);
+
+ DALI_TEST_CHECK(albumLayout->GetColor() == color_list);
+}
+
+static void UtcDaliAlbumSetCenterPosition()
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ albumLayout->SetCenterPosition(Vector3( 0.0f,-80.0f,100.0f));
+
+ DALI_TEST_CHECK(albumLayout->GetCenterPosition() == Vector3( 0.0f,-80.0f,100.0f));
+}
+
+static void UtcDaliAlbumSetSetCenterScale()
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ albumLayout->SetCenterScale(1.75f);
+
+ DALI_TEST_CHECK(albumLayout->GetCenterScale() == 1.75f);
+}
+
+static void UtcDaliAlbumSetSetCenterColor()
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ albumLayout->SetCenterColor(Vector2(1.0f,1.0f));
+
+ DALI_TEST_CHECK(albumLayout->GetCenterColor() == Vector2(1.0f,1.0f));
+}
+
+static void UtcDaliAlbumSetStackPosition()
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ albumLayout->SetStackPosition(Vector3(750.0f,-500.0f,0.0f),Vector3(-750.0f,-500.0f,0.0f));
+
+ DALI_TEST_CHECK(albumLayout->GetRightStackPosition() == Vector3(750.0f,-500.0f,0.0f) && albumLayout->GetLeftStackPosition() == Vector3(-750.0f,-500.0f,0.0f));
+}
+
+static void UtcDaliAlbumSetSetStackScale()
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ albumLayout->SetStackScale(1.0f,1.0f);
+
+ DALI_TEST_CHECK(albumLayout->GetRightStackScale() == 1.0f && albumLayout->GetLeftStackScale() == 1.0f);
+}
+
+static void UtcDaliAlbumSetStackColor()
+{
+ AlbumLayoutPtr albumLayout = AlbumLayout::New();
+
+ albumLayout->SetStackColor(Vector2(1.0f,1.0f),Vector2(1.0f,1.0f));
+
+ DALI_TEST_CHECK(albumLayout->GetRightStackColor() == Vector2(1.0f,1.0f) && albumLayout->GetLeftStackColor() == Vector2(1.0f,1.0f));
+}
diff --git a/automated-tests/dali-test-suite/item-view/utc-Dali-DepthLayout.cpp b/automated-tests/dali-test-suite/item-view/utc-Dali-DepthLayout.cpp
new file mode 100644
index 0000000..bedbc19
--- /dev/null
+++ b/automated-tests/dali-test-suite/item-view/utc-Dali-DepthLayout.cpp
@@ -0,0 +1,658 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 // for FLT_MAX
+#include
+#include
+#include
+#include
+#include
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+const unsigned int TOTAL_ITEM_NUMBER = 200;
+
+Vector3 DepthLayoutItemSizeFunction(unsigned int numberOfColumns, float layoutWidth)
+{
+ float width = (layoutWidth / static_cast(numberOfColumns + 1)) * 0.8f;
+ return Vector3(width, width, width);
+}
+
+float DepthLayoutBottomMarginFunction(float layoutHeight)
+{
+ return layoutHeight * 0.25f;
+}
+
+float DepthLayoutColumnPositionFunction(unsigned int numberOfColumns, unsigned int columnNumber, const Vector3& itemSize, float layoutWidth)
+{
+ float availableSpace = layoutWidth - itemSize.width * numberOfColumns;
+ float leftMargin = availableSpace / numberOfColumns * 0.5f;
+ float columnPosition = leftMargin + itemSize.width * 0.5f + columnNumber * (itemSize.width + availableSpace / numberOfColumns);
+ return columnPosition - layoutWidth * 0.5f;
+}
+} // namespace
+
+static void Startup();
+static void Cleanup();
+
+// Implementation of ItemFactory for providing actors to ItemView
+class TestItemFactory : public ItemFactory
+{
+public:
+
+ /**
+ * Constructor
+ * @param application class, stored as reference
+ */
+ TestItemFactory()
+ {
+ }
+
+public: // From ItemFactory
+
+ /**
+ * Query the number of items available from the factory.
+ * The maximum available item has an ID of GetNumberOfItems() - 1.
+ */
+ virtual unsigned int GetNumberOfItems()
+ {
+ return TOTAL_ITEM_NUMBER;
+ }
+
+ /**
+ * Create an Actor to represent a visible item.
+ * @param itemId
+ * @return the created actor.
+ */
+ virtual Actor NewItem(unsigned int itemId)
+ {
+ // Create an test actor for this item
+ ImageActor actor = CreateSolidColorActor(Color::RED);
+ actor.SetSize(64.0f, 64.0f);
+
+ return actor;
+ }
+};
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+static void UtcDaliDepthLayoutNew();
+static void UtcDaliDepthLayoutSetAndGetNumberOfColumns();
+static void UtcDaliDepthLayoutSetAndGetNumberOfRows();
+static void UtcDaliDepthLayoutSetAndGetRowSpacing();
+static void UtcDaliDepthLayoutSetAndGetTiltAngle();
+static void UtcDaliDepthLayoutSetAndGetItemSizeFunction();
+static void UtcDaliDepthLayoutSetAndGetBottomMarginFunction();
+static void UtcDaliDepthLayoutSetAndGetItemTiltAngle();
+static void UtcDaliDepthLayoutSetAndGetColumnPositionFunction();
+static void UtcDaliDepthLayoutSetAndGetScrollSpeedFactor();
+static void UtcDaliDepthLayoutSetAndGetMaximumSwipeSpeed();
+static void UtcDaliDepthLayoutSetAndGetItemFlickAnimationDuration();
+static void UtcDaliDepthLayoutConstraintLeft();
+static void UtcDaliDepthLayoutConstraintRight();
+static void UtcDaliDepthLayoutConstraintUp();
+static void UtcDaliDepthLayoutConstraintDown();
+static void UtcDaliDepthLayoutGetScrollToPosition();
+static void UtcDaliDepthLayoutScrollDirection();
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+extern "C" {
+ struct tet_testlist tet_testlist[] = {
+ { UtcDaliDepthLayoutNew, POSITIVE_TC_IDX },
+ { UtcDaliDepthLayoutScrollDirection, POSITIVE_TC_IDX },
+ { UtcDaliDepthLayoutSetAndGetNumberOfColumns, POSITIVE_TC_IDX },
+ { UtcDaliDepthLayoutSetAndGetNumberOfRows, POSITIVE_TC_IDX },
+ { UtcDaliDepthLayoutSetAndGetRowSpacing, POSITIVE_TC_IDX },
+ { UtcDaliDepthLayoutSetAndGetTiltAngle, POSITIVE_TC_IDX },
+ { UtcDaliDepthLayoutSetAndGetItemSizeFunction, POSITIVE_TC_IDX },
+ { UtcDaliDepthLayoutSetAndGetBottomMarginFunction, POSITIVE_TC_IDX },
+ { UtcDaliDepthLayoutSetAndGetItemTiltAngle, POSITIVE_TC_IDX },
+ { UtcDaliDepthLayoutSetAndGetColumnPositionFunction, POSITIVE_TC_IDX },
+ { UtcDaliDepthLayoutSetAndGetScrollSpeedFactor, POSITIVE_TC_IDX },
+ { UtcDaliDepthLayoutSetAndGetMaximumSwipeSpeed, POSITIVE_TC_IDX },
+ { UtcDaliDepthLayoutSetAndGetItemFlickAnimationDuration, POSITIVE_TC_IDX },
+ { UtcDaliDepthLayoutConstraintLeft, POSITIVE_TC_IDX },
+ { UtcDaliDepthLayoutConstraintRight, POSITIVE_TC_IDX },
+ { UtcDaliDepthLayoutConstraintUp, POSITIVE_TC_IDX },
+ { UtcDaliDepthLayoutConstraintDown, POSITIVE_TC_IDX },
+ { UtcDaliDepthLayoutGetScrollToPosition, POSITIVE_TC_IDX },
+ { NULL, 0 }
+ };
+}
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliDepthLayoutNew()
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ DALI_TEST_CHECK(depthLayout);
+}
+
+static void UtcDaliDepthLayoutSetAndGetNumberOfColumns()
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the number of columns
+ depthLayout->SetNumberOfColumns(5);
+
+ // Check whether we get the correct number of columns
+ DALI_TEST_CHECK(depthLayout->GetNumberOfColumns() == 5);
+}
+
+static void UtcDaliDepthLayoutSetAndGetNumberOfRows()
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the number of rows
+ depthLayout->SetNumberOfRows(15);
+
+ // Check whether we get the correct number of rows
+ DALI_TEST_CHECK(depthLayout->GetNumberOfRows() == 15);
+}
+
+static void UtcDaliDepthLayoutSetAndGetRowSpacing()
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the row spacing
+ depthLayout->SetRowSpacing(30.0f);
+
+ // Check whether we get the correct row spacing
+ DALI_TEST_EQUALS(depthLayout->GetRowSpacing(), 30.0f, TEST_LOCATION );
+}
+
+static void UtcDaliDepthLayoutSetAndGetTiltAngle()
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the tilt angle
+ depthLayout->SetTiltAngle(Degree(25.0f));
+
+ // Check whether we get the correct tilt angle
+ DALI_TEST_EQUALS(float(depthLayout->GetTiltAngle()), 25.0f, 0.001f, TEST_LOCATION );
+}
+
+static void UtcDaliDepthLayoutSetAndGetItemSizeFunction()
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the item size function
+ depthLayout->SetItemSizeFunction(DepthLayoutItemSizeFunction);
+
+ // Check whether we get the correct item size function
+ DALI_TEST_CHECK(depthLayout->GetItemSizeFunction() == DepthLayoutItemSizeFunction);
+}
+
+static void UtcDaliDepthLayoutSetAndGetBottomMarginFunction()
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the bottom margin function
+ depthLayout->SetBottomMarginFunction(DepthLayoutBottomMarginFunction);
+
+ // Check whether we get the correct bottom margin function
+ DALI_TEST_CHECK(depthLayout->GetBottomMarginFunction() == DepthLayoutBottomMarginFunction);
+}
+
+static void UtcDaliDepthLayoutSetAndGetItemTiltAngle()
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the item's tilt angle
+ depthLayout->SetItemTiltAngle(Degree(5.0f));
+
+ // Check whether we get the correct item's tilt angle
+ DALI_TEST_EQUALS(float(depthLayout->GetItemTiltAngle()), 5.0f, 0.001f, TEST_LOCATION );
+}
+
+static void UtcDaliDepthLayoutSetAndGetColumnPositionFunction()
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the column position function
+ depthLayout->SetColumnPositionFunction(DepthLayoutColumnPositionFunction);
+
+ // Check whether we get the correct column position function
+ DALI_TEST_CHECK(depthLayout->GetColumnPositionFunction() == DepthLayoutColumnPositionFunction);
+}
+
+static void UtcDaliDepthLayoutSetAndGetScrollSpeedFactor()
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the scroll speed factor
+ depthLayout->SetScrollSpeedFactor(0.05f);
+
+ // Check whether we get the correct scroll speed factor
+ DALI_TEST_EQUALS(depthLayout->GetScrollSpeedFactor(), 0.05f, TEST_LOCATION );
+}
+
+static void UtcDaliDepthLayoutSetAndGetMaximumSwipeSpeed()
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the maximum swipe speed
+ depthLayout->SetMaximumSwipeSpeed(50.0f);
+
+ // Check whether we get the correct maximum swipe speed
+ DALI_TEST_EQUALS(depthLayout->GetMaximumSwipeSpeed(), 50.0f, TEST_LOCATION );
+}
+
+static void UtcDaliDepthLayoutSetAndGetItemFlickAnimationDuration()
+{
+ ToolkitTestApplication application;
+
+ // Create a depth layout
+ DepthLayoutPtr depthLayout = DepthLayout::New();
+
+ // Set the flick animaiton duration
+ depthLayout->SetItemFlickAnimationDuration(0.35f);
+
+ // Check whether we get the correct flick animaiton duration
+ DALI_TEST_EQUALS( depthLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION );
+}
+
+static void UtcDaliDepthLayoutConstraintLeft()
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ DepthLayoutPtr navigationLayout = DepthLayout::New();
+ navigationLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*navigationLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ navigationLayout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+}
+
+static void UtcDaliDepthLayoutConstraintRight()
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ DepthLayoutPtr navigationLayout = DepthLayout::New();
+ navigationLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*navigationLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ navigationLayout->SetOrientation(ControlOrientation::Right);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+}
+
+static void UtcDaliDepthLayoutConstraintUp()
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ DepthLayoutPtr navigationLayout = DepthLayout::New();
+ navigationLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*navigationLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ navigationLayout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+}
+
+static void UtcDaliDepthLayoutConstraintDown()
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ DepthLayoutPtr navigationLayout = DepthLayout::New();
+ navigationLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*navigationLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ navigationLayout->SetOrientation(ControlOrientation::Down);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+}
+
+static void UtcDaliDepthLayoutGetScrollToPosition()
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ DepthLayoutPtr layout = DepthLayout::New();
+
+ view.SetName("view actor");
+ view.AddLayout(*layout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ layout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view.
+ std::vector indices;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ indices.push_back(i);
+ }
+ }
+
+ try
+ {
+ if (!indices.empty())
+ {
+ const unsigned int firstTargetIndex = indices[indices.size()-1];
+ // scroll to last item
+ view.ScrollToItem(firstTargetIndex, 0.00f);
+ application.Render(16); // 60hz frames
+
+ std::size_t moveCount = 0;
+ for(std::size_t i = 0; i < indices.size(); i++)
+ {
+ float layoutPosBefore = view.GetCurrentLayoutPosition(i);
+ view.ScrollToItem(indices[i], 0.0f);
+
+ application.Render(16); // 60hz frame
+
+ float layoutPosAfter = view.GetCurrentLayoutPosition(i);
+
+ if (fabs(layoutPosBefore-layoutPosAfter) <= FLT_EPSILON)
+ {
+ ++moveCount;
+ }
+ }
+
+ DALI_TEST_CHECK((moveCount == indices.size()));
+ }
+ }
+ catch(...)
+ {
+ tet_result(TET_FAIL);
+ }
+
+ Stage::GetCurrent().Remove(view);
+}
+
+static void UtcDaliDepthLayoutScrollDirection()
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ DepthLayoutPtr navigationLayout = DepthLayout::New();
+
+ view.SetName("view actor");
+ view.AddLayout(*navigationLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ navigationLayout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ ItemLayoutPtr layout = navigationLayout;
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ navigationLayout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ Degree deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == 180.0f);
+
+ navigationLayout->SetOrientation(ControlOrientation::Down);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK((deg == 0.0f));
+
+ layout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == 270.0f);
+
+ navigationLayout->SetOrientation(ControlOrientation::Right);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == 90.0f);
+
+ Stage::GetCurrent().Remove(view);
+}
diff --git a/automated-tests/dali-test-suite/item-view/utc-Dali-GridLayout.cpp b/automated-tests/dali-test-suite/item-view/utc-Dali-GridLayout.cpp
new file mode 100644
index 0000000..34c2083
--- /dev/null
+++ b/automated-tests/dali-test-suite/item-view/utc-Dali-GridLayout.cpp
@@ -0,0 +1,579 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 // for FLT_MAX
+#include
+
+#include
+#include
+#include
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+const unsigned int TOTAL_ITEM_NUMBER = 200;
+
+Vector3 GridLayoutItemSizeFunction(unsigned int numberOfColumns, float layoutWidth, float sideMargin, float columnSpacing)
+{
+ float width = (layoutWidth - sideMargin * 2.0f - columnSpacing * static_cast(numberOfColumns - 1)) / static_cast(numberOfColumns);
+
+ return Vector3(width, width, width);
+}
+
+} // namespace
+
+static void Startup();
+static void Cleanup();
+
+// Implementation of ItemFactory for providing actors to ItemView
+class TestItemFactory : public ItemFactory
+{
+public:
+
+ /**
+ * Constructor
+ * @param application class, stored as reference
+ */
+ TestItemFactory()
+ {
+ }
+
+public: // From ItemFactory
+
+ /**
+ * Query the number of items available from the factory.
+ * The maximum available item has an ID of GetNumberOfItems() - 1.
+ */
+ virtual unsigned int GetNumberOfItems()
+ {
+ return TOTAL_ITEM_NUMBER;
+ }
+
+ /**
+ * Create an Actor to represent a visible item.
+ * @param itemId
+ * @return the created actor.
+ */
+ virtual Actor NewItem(unsigned int itemId)
+ {
+ // Create an test actor for this item
+ ImageActor actor = CreateSolidColorActor(Color::RED);
+ actor.SetSize(64.0f, 64.0f);
+ return actor;
+ }
+};
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+static void UtcDaliGridLayoutNew();
+static void UtcDaliGridLayoutSetAndGetNumberOfColumns();
+static void UtcDaliGridLayoutSetAndGetRowSpacing();
+static void UtcDaliGridLayoutSetAndGetColumnSpacing();
+static void UtcDaliGridLayoutSetAndGetTopMargin();
+static void UtcDaliGridLayoutSetAndGetBottomMargin();
+static void UtcDaliGridLayoutSetAndGetSideMargin();
+static void UtcDaliGridLayoutSetAndGetZGap();
+static void UtcDaliGridLayoutSetAndGetItemSizeFunction();
+static void UtcDaliGridLayoutSetAndGetScrollSpeedFactor();
+static void UtcDaliGridLayoutSetAndGetMaximumSwipeSpeed();
+static void UtcDaliGridLayoutSetAndGetItemFlickAnimationDuration();
+static void UtcDaliGridLayoutConstraintLeft();
+static void UtcDaliGridLayoutConstraintRight();
+static void UtcDaliGridLayoutConstraintUp();
+static void UtcDaliGridLayoutConstraintDown();
+static void UtcDaliGridLayoutScrollDirection();
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+extern "C" {
+ struct tet_testlist tet_testlist[] = {
+ { UtcDaliGridLayoutNew, POSITIVE_TC_IDX },
+ { UtcDaliGridLayoutSetAndGetNumberOfColumns, POSITIVE_TC_IDX },
+ { UtcDaliGridLayoutSetAndGetRowSpacing, POSITIVE_TC_IDX },
+ { UtcDaliGridLayoutSetAndGetColumnSpacing, POSITIVE_TC_IDX },
+ { UtcDaliGridLayoutSetAndGetTopMargin, POSITIVE_TC_IDX },
+ { UtcDaliGridLayoutSetAndGetBottomMargin, POSITIVE_TC_IDX },
+ { UtcDaliGridLayoutSetAndGetSideMargin, POSITIVE_TC_IDX },
+ { UtcDaliGridLayoutSetAndGetZGap, POSITIVE_TC_IDX },
+ { UtcDaliGridLayoutSetAndGetItemSizeFunction, POSITIVE_TC_IDX },
+ { UtcDaliGridLayoutSetAndGetScrollSpeedFactor, POSITIVE_TC_IDX },
+ { UtcDaliGridLayoutSetAndGetMaximumSwipeSpeed, POSITIVE_TC_IDX },
+ { UtcDaliGridLayoutSetAndGetItemFlickAnimationDuration, POSITIVE_TC_IDX },
+ { UtcDaliGridLayoutConstraintLeft, POSITIVE_TC_IDX },
+ { UtcDaliGridLayoutConstraintRight, POSITIVE_TC_IDX },
+ { UtcDaliGridLayoutConstraintUp, POSITIVE_TC_IDX },
+ { UtcDaliGridLayoutConstraintDown, POSITIVE_TC_IDX },
+ { UtcDaliGridLayoutScrollDirection, POSITIVE_TC_IDX },
+ { NULL, 0 }
+ };
+}
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+static void UtcDaliGridLayoutNew()
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ DALI_TEST_CHECK(gridLayout);
+}
+
+static void UtcDaliGridLayoutSetAndGetNumberOfColumns()
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the number of columns
+ gridLayout->SetNumberOfColumns(6);
+
+ // Check whether we get the correct number of columns
+ DALI_TEST_CHECK(gridLayout->GetNumberOfColumns() == 6);
+}
+
+static void UtcDaliGridLayoutSetAndGetRowSpacing()
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the row spacing
+ gridLayout->SetRowSpacing(10.0f);
+
+ // Check whether we get the correct row spacing
+ DALI_TEST_EQUALS(gridLayout->GetRowSpacing(), 10.0f, TEST_LOCATION );
+}
+
+static void UtcDaliGridLayoutSetAndGetColumnSpacing()
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the column spacing
+ gridLayout->SetColumnSpacing(10.0f);
+
+ // Check whether we get the correct column spacing
+ DALI_TEST_EQUALS(gridLayout->GetColumnSpacing(), 10.0f, TEST_LOCATION );
+}
+
+static void UtcDaliGridLayoutSetAndGetTopMargin()
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the top margin
+ gridLayout->SetTopMargin(30.0f);
+
+ // Check whether we get the correct top margin
+ DALI_TEST_EQUALS(gridLayout->GetTopMargin(), 30.0f, TEST_LOCATION );
+}
+
+static void UtcDaliGridLayoutSetAndGetBottomMargin()
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the bottom margin
+ gridLayout->SetBottomMargin(30.0f);
+
+ // Check whether we get the correct bottom margin
+ DALI_TEST_EQUALS(gridLayout->GetBottomMargin(), 30.0f, TEST_LOCATION );
+}
+
+static void UtcDaliGridLayoutSetAndGetSideMargin()
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the side margin
+ gridLayout->SetSideMargin(10.0f);
+
+ // Check whether we get the correct side margin
+ DALI_TEST_EQUALS(gridLayout->GetSideMargin(), 10.0f, TEST_LOCATION );
+}
+
+static void UtcDaliGridLayoutSetAndGetZGap()
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the gap of items in the Z axis in different columns
+ gridLayout->SetZGap(5.0f);
+
+ // Check whether we get the correct Z gap
+ DALI_TEST_EQUALS(gridLayout->GetZGap(), 5.0f, TEST_LOCATION );
+}
+
+static void UtcDaliGridLayoutSetAndGetItemSizeFunction()
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the item size function
+ gridLayout->SetItemSizeFunction(GridLayoutItemSizeFunction);
+
+ // Check whether we get the correct item size function
+ DALI_TEST_CHECK(gridLayout->GetItemSizeFunction() == GridLayoutItemSizeFunction);
+}
+
+static void UtcDaliGridLayoutSetAndGetScrollSpeedFactor()
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the scroll speed factor
+ gridLayout->SetScrollSpeedFactor(0.05f);
+
+ // Check whether we get the correct scroll speed factor
+ DALI_TEST_EQUALS(gridLayout->GetScrollSpeedFactor(), 0.05f, TEST_LOCATION );
+}
+
+static void UtcDaliGridLayoutSetAndGetMaximumSwipeSpeed()
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the maximum swipe speed
+ gridLayout->SetMaximumSwipeSpeed(50.0f);
+
+ // Check whether we get the correct maximum swipe speed
+ DALI_TEST_EQUALS(gridLayout->GetMaximumSwipeSpeed(), 50.0f, TEST_LOCATION );
+}
+
+static void UtcDaliGridLayoutSetAndGetItemFlickAnimationDuration()
+{
+ ToolkitTestApplication application;
+
+ // Create a grid layout
+ GridLayoutPtr gridLayout = GridLayout::New();
+
+ // Set the flick animaiton duration
+ gridLayout->SetItemFlickAnimationDuration(0.35f);
+
+ // Check whether we get the correct flick animaiton duration
+ DALI_TEST_EQUALS( gridLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION );
+}
+
+static void UtcDaliGridLayoutConstraintLeft()
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ GridLayoutPtr gridLayout = GridLayout::New();
+ gridLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*gridLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ gridLayout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+}
+
+static void UtcDaliGridLayoutConstraintRight()
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ GridLayoutPtr gridLayout = GridLayout::New();
+ gridLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*gridLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ gridLayout->SetOrientation(ControlOrientation::Right);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+}
+
+static void UtcDaliGridLayoutConstraintUp()
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ GridLayoutPtr gridLayout = GridLayout::New();
+ gridLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*gridLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ gridLayout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+
+ ItemLayoutPtr layout = gridLayout;
+ layout->GetClosestOnScreenLayoutPosition(0, 0.0f, vec);
+ int nextItem = layout->GetNextFocusItemID(0, 10, Dali::Toolkit::Control::Right, false);
+ DALI_TEST_CHECK(nextItem == 1);
+
+ Stage::GetCurrent().Remove(view);
+}
+
+static void UtcDaliGridLayoutConstraintDown()
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ GridLayoutPtr gridLayout = GridLayout::New();
+ gridLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*gridLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ gridLayout->SetOrientation(ControlOrientation::Down);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ // Confirm: we have actors in the view and they are positioned some distance from the origin.
+ int nonZeroCount = 0;
+ int elementsFound = 0;
+ for(unsigned int i = 0; i < 10; i++)
+ {
+ Actor testActor = view.GetItem(i);
+ if (testActor)
+ {
+ elementsFound++;
+ Vector3 pos = testActor.GetCurrentPosition();
+
+ if (pos.LengthSquared() > 0.0f)
+ {
+ nonZeroCount++;
+ }
+ }
+ }
+
+ DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
+ Stage::GetCurrent().Remove(view);
+}
+
+static void UtcDaliGridLayoutScrollDirection()
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ Vector3 vec(480.0f, 800.0f, 0.0f);
+ GridLayoutPtr gridLayout = GridLayout::New();
+ gridLayout->SetNumberOfColumns(6);
+
+ view.SetName("view actor");
+ view.AddLayout(*gridLayout);
+ view.SetSize(vec);
+
+ Stage::GetCurrent().Add(view);
+ gridLayout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+
+ application.SendNotification();
+ application.Render(0);
+
+ ItemLayoutPtr layout = gridLayout;
+
+ // render 10 frames
+ for(int i = 0; i < 10; ++i)
+ {
+ application.Render(16); // 60hz frames
+ }
+
+ gridLayout->SetOrientation(ControlOrientation::Up);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ Degree deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == 0.0f);
+
+ gridLayout->SetOrientation(ControlOrientation::Down);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK((deg == 180.0f));
+
+ layout->SetOrientation(ControlOrientation::Left);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == 90.f);
+
+ gridLayout->SetOrientation(ControlOrientation::Right);
+ view.ActivateLayout(0, vec, 0.0f);
+ application.SendNotification();
+ application.Render();
+
+ deg = layout->GetScrollDirection();
+ DALI_TEST_CHECK(deg == 270.0f);
+
+ Stage::GetCurrent().Remove(view);
+}
diff --git a/automated-tests/dali-test-suite/item-view/utc-Dali-ItemLayout.cpp b/automated-tests/dali-test-suite/item-view/utc-Dali-ItemLayout.cpp
new file mode 100644
index 0000000..133da1e
--- /dev/null
+++ b/automated-tests/dali-test-suite/item-view/utc-Dali-ItemLayout.cpp
@@ -0,0 +1,171 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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
+
+#include
+
+using namespace Dali;
+using namespace Toolkit;
+
+namespace
+{
+const unsigned int TOTAL_ITEM_NUMBER = 200;
+const char* TEST_IMAGE_FILE_NAME = DALI_IMAGE_DIR "gallery_image_01.jpg";
+} // namespace
+
+static void Startup();
+static void Cleanup();
+
+extern "C" {
+ void (*tet_startup)() = Startup;
+ void (*tet_cleanup)() = Cleanup;
+}
+
+static void UtcDaliItemLayoutSetAndGetOrientation();
+static void UtcDaliItemLayoutGetScrollHints();
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+// Add test functionality for all APIs in the class (Positive and Negative)
+extern "C" {
+ struct tet_testlist tet_testlist[] = {
+ { UtcDaliItemLayoutSetAndGetOrientation, POSITIVE_TC_IDX },
+ { UtcDaliItemLayoutGetScrollHints, POSITIVE_TC_IDX },
+ { NULL, 0 }
+ };
+}
+
+// Called only once before first test is run.
+static void Startup()
+{
+}
+
+// Called only once after last test is run
+static void Cleanup()
+{
+}
+
+// Implementation of ItemFactory for providing actors to ItemView
+class TestItemFactory : public ItemFactory
+{
+public:
+
+ /**
+ * Constructor
+ * @param application class, stored as reference
+ */
+ TestItemFactory()
+ {
+ }
+
+public: // From ItemFactory
+
+ /**
+ * Query the number of items available from the factory.
+ * The maximum available item has an ID of GetNumberOfItems() - 1.
+ */
+ virtual unsigned int GetNumberOfItems()
+ {
+ return TOTAL_ITEM_NUMBER;
+ }
+
+ /**
+ * Create an Actor to represent a visible item.
+ * @param itemId
+ * @return the created actor.
+ */
+ virtual Actor NewItem(unsigned int itemId)
+ {
+ // Create an image actor for this item
+ Image image = Image::New( TEST_IMAGE_FILE_NAME );
+ Actor actor = ImageActor::New(image);
+
+ return actor;
+ }
+};
+
+static void UtcDaliItemLayoutSetAndGetOrientation()
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ GridLayoutPtr gridLayout = GridLayout::New();
+ view.AddLayout(*gridLayout);
+
+ // Set the orientation of the layout to be horizontal from left to right
+ ItemLayoutPtr layout = view.GetLayout(0);
+ layout->SetOrientation(ControlOrientation::Left);
+
+ // Check the orientation of the layout is horizontal from left to right
+ DALI_TEST_CHECK(layout->GetOrientation() == ControlOrientation::Left);
+}
+
+static void UtcDaliItemLayoutGetScrollHints()
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ GridLayoutPtr gridLayout = GridLayout::New();
+ view.AddLayout(*gridLayout);
+
+ // Set the orientation of the layout to be horizontal from left to right
+ ItemLayoutPtr layout = view.GetLayout(0);
+
+ Vector2 axisScrollHint;
+
+ layout->SetOrientation(ControlOrientation::Up);
+ layout->GetXAxisScrollHint(axisScrollHint);
+ DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ layout->GetYAxisScrollHint(axisScrollHint);
+ DALI_TEST_EQUALS(axisScrollHint, Vector2::YAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+ layout->SetOrientation(ControlOrientation::Down);
+ layout->GetXAxisScrollHint(axisScrollHint);
+ DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ layout->GetYAxisScrollHint(axisScrollHint);
+ DALI_TEST_EQUALS(axisScrollHint, Vector2::YAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+ layout->SetOrientation(ControlOrientation::Left);
+ layout->GetXAxisScrollHint(axisScrollHint);
+ DALI_TEST_EQUALS(axisScrollHint, Vector2::XAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ layout->GetYAxisScrollHint(axisScrollHint);
+ DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+ layout->SetOrientation(ControlOrientation::Right);
+ layout->GetXAxisScrollHint(axisScrollHint);
+ DALI_TEST_EQUALS(axisScrollHint, Vector2::XAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ layout->GetYAxisScrollHint(axisScrollHint);
+ DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+}
diff --git a/automated-tests/dali-test-suite/item-view/utc-Dali-ItemView.cpp b/automated-tests/dali-test-suite/item-view/utc-Dali-ItemView.cpp
new file mode 100644
index 0000000..98f2a56
--- /dev/null
+++ b/automated-tests/dali-test-suite/item-view/utc-Dali-ItemView.cpp
@@ -0,0 +1,575 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.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://floralicense.org/license/
+//
+// 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 // for FLT_MAX
+#include