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
--- /dev/null
+/*
+ * 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 <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
+
+// THIS IS THE HEADER WE ARE TESTING
+#define private public // To access private members of class, just in the internal test cases
+#include <dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h>
+#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;
+}
+
END_TEST;
}
-
-
int UtcDaliToolkitTextSelectionPopupIconProperties(void)
{
ToolkitTestApplication application;
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<Vector2>(), popupMaxSize, TEST_LOCATION);
+ DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::OPTION_MAX_SIZE).Get<Vector2>(), optionMaxSize, TEST_LOCATION);
+ DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::OPTION_MIN_SIZE).Get<Vector2>(), optionMinSize, TEST_LOCATION);
+ DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::OPTION_DIVIDER_SIZE).Get<Vector2>(), optionDividerSize, TEST_LOCATION);
+
+ END_TEST;
+}
} // switch
}
-Size TextSelectionPopup::GetDimensionToCustomise( const PopupCustomisations& settingToCustomise )
+Size TextSelectionPopup::GetDimensionToCustomise( const PopupCustomisations& settingToCustomise ) const
{
switch( settingToCustomise )
{
} // switch
}
-std::string TextSelectionPopup::GetButtonImage( Toolkit::TextSelectionPopup::Buttons button )
+const std::string& TextSelectionPopup::GetButtonImage( Toolkit::TextSelectionPopup::Buttons button ) const
{
- std::string buttonImageUrl;
switch ( button )
{
- case Toolkit::TextSelectionPopup::CLIPBOARD :
+ case Toolkit::TextSelectionPopup::CLIPBOARD:
{
- buttonImageUrl = mClipboardIconImage;
+ return mClipboardIconImage;
break;
}
- case Toolkit::TextSelectionPopup::CUT :
+ case Toolkit::TextSelectionPopup::CUT:
{
- buttonImageUrl = mCutIconImage;
+ return mCutIconImage;
break;
}
- case Toolkit::TextSelectionPopup::COPY :
+ case Toolkit::TextSelectionPopup::COPY:
{
- buttonImageUrl = mCopyIconImage;
+ return mCopyIconImage;
break;
}
- case Toolkit::TextSelectionPopup::PASTE :
+ case Toolkit::TextSelectionPopup::PASTE:
{
- buttonImageUrl = mPasteIconImage;
+ return mPasteIconImage;
break;
}
- case Toolkit::TextSelectionPopup::SELECT :
+ case Toolkit::TextSelectionPopup::SELECT:
{
- buttonImageUrl = mSelectIconImage;
+ return mSelectIconImage;
break;
}
- case Toolkit::TextSelectionPopup::SELECT_ALL :
+ case Toolkit::TextSelectionPopup::SELECT_ALL:
{
- buttonImageUrl = mSelectAllIconImage;
+ return mSelectAllIconImage;
break;
}
- default :
+ case Toolkit::TextSelectionPopup::NONE:
{
- DALI_ASSERT_DEBUG( "TextSelectionPopup GetPopupImage Unknown Button" );
+ break;
}
} // switch
- return buttonImageUrl;
+ DALI_ASSERT_DEBUG( "TextSelectionPopup GetPopupImage Unknown Button" );
+ static std::string empty;
+ return empty;
}
void TextSelectionPopup::SetPressedImage( const std::string& filename )
}
}
- std::size_t TextSelectionPopup::GetNumberOfEnabledOptions()
+ std::size_t TextSelectionPopup::GetNumberOfEnabledOptions() const
{
std::size_t numberOfOptions = 0u;
for( std::vector<ButtonRequirement>::const_iterator it = mOrderListOfButtons.begin(), endIt = mOrderListOfButtons.end(); ( it != endIt ); ++it )
*
* @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.
* @param[in] button The button to get the image from
* @return The image used for that button.
*/
- std::string GetButtonImage( Toolkit::TextSelectionPopup::Buttons button );
+ const std::string& GetButtonImage( Toolkit::TextSelectionPopup::Buttons button ) const;
/**
* @brief Sets the image for the pressed state of a popup option.
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 );