From: Adeel Kazmi Date: Thu, 18 Jun 2020 14:55:54 +0000 (+0100) Subject: Make some methods consts TextSelectionPopupImpl X-Git-Tag: dali_1.5.17~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5445229af6789b68b0e2146be55d6c79abb3e274;p=platform%2Fcore%2Fuifw%2Fdali-toolkit-legacy.git Make some methods consts TextSelectionPopupImpl Change-Id: I9b924ba321f0f493f76563bacb6d9e84fb42a825 --- diff --git a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt index 98172fb..0b58b91 100755 --- a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt @@ -27,6 +27,7 @@ SET(TC_SOURCES utc-Dali-Text-Typesetter.cpp utc-Dali-Text-ViewModel.cpp utc-Dali-TextField-internal.cpp + utc-Dali-TextSelectionPopup-internal.cpp utc-Dali-TextureManager.cpp utc-Dali-Visuals-internal.cpp utc-Dali-VisualModel.cpp diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextSelectionPopup-internal.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextSelectionPopup-internal.cpp new file mode 100644 index 0000000..13c7ca8 --- /dev/null +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextSelectionPopup-internal.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include + +// THIS IS THE HEADER WE ARE TESTING +#define private public // To access private members of class, just in the internal test cases +#include +#undef private + +using namespace Dali; +using namespace Toolkit; + +void dali_textselectionpopupinternal_startup(void) +{ + test_return_value = TET_UNDEF; +} + +void dali_textselectionpopupinternal_cleanup(void) +{ + test_return_value = TET_PASS; +} + +int UtcDaliToolkitTextSelectionPopupIconPropertiesN(void) +{ + ToolkitTestApplication application; + TextSelectionPopup popup = TextSelectionPopup::New(nullptr); + + Toolkit::Internal::TextSelectionPopup& popupImpl = GetImpl(popup); + DALI_TEST_EQUALS(std::string(), popupImpl.GetButtonImage(Toolkit::TextSelectionPopup::NONE), TEST_LOCATION); + DALI_TEST_EQUALS(std::string(), popupImpl.GetButtonImage(Toolkit::TextSelectionPopup::Buttons(-1)), TEST_LOCATION); + + END_TEST; +} + diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp index 4e17c01..e86f836 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp @@ -230,3 +230,25 @@ int UtcDaliToolkitTextSelectionToolBarScrollView(void) END_TEST; } +int UtcDaliToolkitTextSelectionPopupSizeProperties(void) +{ + ToolkitTestApplication application; + TextSelectionPopup popup = TextSelectionPopup::New(nullptr); + + const Vector2 popupMaxSize(200.0f, 300.0f); + const Vector2 optionMaxSize(50.0f, 100.0f); + const Vector2 optionMinSize(10.0f, 10.0f); + const Vector2 optionDividerSize(5.0f, 5.0f); + popup.SetProperty(TextSelectionPopup::Property::POPUP_MAX_SIZE, popupMaxSize); + popup.SetProperty(TextSelectionPopup::Property::OPTION_MAX_SIZE, optionMaxSize); + popup.SetProperty(TextSelectionPopup::Property::OPTION_MIN_SIZE, optionMinSize); + popup.SetProperty(TextSelectionPopup::Property::OPTION_DIVIDER_SIZE, optionDividerSize); + + DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::POPUP_MAX_SIZE).Get(), popupMaxSize, TEST_LOCATION); + DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::OPTION_MAX_SIZE).Get(), optionMaxSize, TEST_LOCATION); + DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::OPTION_MIN_SIZE).Get(), optionMinSize, TEST_LOCATION); + DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::OPTION_DIVIDER_SIZE).Get(), optionDividerSize, TEST_LOCATION); + + END_TEST; +} + diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp index c9bc2b3..8aa3438 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp @@ -526,7 +526,7 @@ void TextSelectionPopup::SetDimensionToCustomise( const PopupCustomisations& set } // switch } -Size TextSelectionPopup::GetDimensionToCustomise( const PopupCustomisations& settingToCustomise ) +Size TextSelectionPopup::GetDimensionToCustomise( const PopupCustomisations& settingToCustomise ) const { switch( settingToCustomise ) { @@ -772,7 +772,7 @@ std::string TextSelectionPopup::GetPressedImage() const } } - std::size_t TextSelectionPopup::GetNumberOfEnabledOptions() + std::size_t TextSelectionPopup::GetNumberOfEnabledOptions() const { std::size_t numberOfOptions = 0u; for( std::vector::const_iterator it = mOrderListOfButtons.begin(), endIt = mOrderListOfButtons.end(); ( it != endIt ); ++it ) diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h index a79a925..9ec2dc5 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h @@ -203,7 +203,7 @@ private: // Implementation * * @param[in] setting The setting from the PopupCustomisations enum */ - Size GetDimensionToCustomise( const PopupCustomisations& setting ); + Size GetDimensionToCustomise( const PopupCustomisations& setting ) const; /** * @brief Sets the image for the given button of the Popup. @@ -239,7 +239,7 @@ private: // Implementation void AddOption( const ButtonRequirement& button, bool showDivider, bool showIcons, bool showCaption ); - std::size_t GetNumberOfEnabledOptions(); + std::size_t GetNumberOfEnabledOptions() const; void AddPopupOptionsToToolbar( bool showIcons, bool showCaptions );