/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
#include <dali/integration-api/scene.h>
#include <test-application.h>
#include <toolkit-adaptor-impl.h>
+#include <toolkit-application.h>
#include <toolkit-async-task-manager.h>
#include <toolkit-scene-holder-impl.h>
#include <toolkit-test-application.h>
bool Adaptor::AddIdle(CallbackBase* callback, bool hasReturnValue)
{
- if(hasReturnValue)
+ if(ToolkitApplication::ADD_IDLE_SUCCESS)
{
- mReturnCallbacks.PushBack(callback);
- }
- else
- {
- mCallbacks.PushBack(callback);
+ if(hasReturnValue)
+ {
+ mReturnCallbacks.PushBack(callback);
+ }
+ else
+ {
+ mCallbacks.PushBack(callback);
+ }
}
- return true;
+ return ToolkitApplication::ADD_IDLE_SUCCESS;
}
void Adaptor::RemoveIdle(CallbackBase* callback)
#include "toolkit-application.h"
#include <dali-toolkit/public-api/dali-toolkit-common.h>
-#include <dali/public-api/signals/dali-signal.h>
#include <dali/devel-api/adaptor-framework/orientation.h>
+#include <dali/public-api/signals/dali-signal.h>
namespace Dali
{
-
////////////////////////////////////////////////////////////////////////////////////////////////////
-
/**
* Stub for the Application
*/
class Application
{
public:
-
public:
-
Application(ToolkitApplication& toolkitApplication);
~Application();
public:
-
static std::string GetResourcePath();
//Orientation& GetOrientation();
public: // static methods
-
-public: // Signals
-
+public: // Signals
private:
-
// Undefined
Application(const Application&);
Application& operator=(Application&);
////////////////////////////////////////////////////////////////////////////////////////////////////
bool ToolkitApplication::DECODED_IMAGES_SUPPORTED;
+bool ToolkitApplication::ADD_IDLE_SUCCESS = true;
ToolkitApplication::ToolkitApplication()
: mApplicationStub(new Application(*this))
#define DALI_TOOLKIT_TOOLKIT_APPLICATION_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
namespace Dali
{
-
class Application;
/**
class ToolkitApplication
{
public: // Construction & Destruction
-
ToolkitApplication();
~ToolkitApplication();
public: // Getters
-
Application& GetApplication();
public: // Signal Emissions
-
public: // TEST FUNCTIONS
-
// Enumeration of Application methods
enum TestFuncEnum
{
}
private:
-
struct TestFunctions
{
TestFunctions()
public: // Test static member
static bool DECODED_IMAGES_SUPPORTED;
+ static bool ADD_IDLE_SUCCESS; ///< Default as true.
};
} // namespace Dali
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
END_TEST;
}
+int UtcDaliImageViewSetImageOnResourceReadySignal10WhenAddIdleFailed(void)
+{
+ tet_infoline("Test ResourceReady signal comes more than 2 times, but do not call again if AddIdle failed");
+
+ ToolkitTestApplication application;
+
+ gResourceReadySignalCounter = 0;
+
+ // Clear image view for clear test
+
+ if(gImageView1)
+ {
+ gImageView1.Reset();
+ }
+
+ // Dummy view to cache image.
+ ImageView dummyView = ImageView::New(gImage_34_RGBA);
+ application.GetScene().Add(dummyView);
+
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+ application.SendNotification();
+ application.Render();
+
+ // Make AddIdle failed.
+ ToolkitApplication::ADD_IDLE_SUCCESS = false;
+
+ try
+ {
+ gImageView1 = ImageView::New();
+ gImageView1.SetProperty(Toolkit::ImageView::Property::IMAGE, gImage_34_RGBA);
+ gImageView1.ResourceReadySignal().Connect(&OnResourceReadySignal10);
+ application.GetScene().Add(gImageView1); // It will call resourceReady signal 1 time.
+
+ tet_printf("ResourceReady called %d times\n", gResourceReadySignalCounter);
+
+ DALI_TEST_GREATER(gResourceReadySignal10MaxCounter, gResourceReadySignalCounter, TEST_LOCATION); // Check whether resource ready call too much.
+
+ for(int i = 0; i < gResourceReadySignal10MaxCounter; ++i)
+ {
+ tet_printf("RunIdles\n");
+ // Executes the idle callbacks.
+ application.RunIdles();
+ application.SendNotification();
+ application.Render();
+ tet_printf("RunIdles done\n");
+ }
+ tet_printf("ResourceReady called %d times\n", gResourceReadySignalCounter);
+
+ DALI_TEST_GREATER(gResourceReadySignal10MaxCounter, gResourceReadySignalCounter, TEST_LOCATION); // Check whether resource ready not called multiple times.
+
+ DALI_TEST_CHECK(true);
+ }
+ catch(...)
+ {
+ // Exception should not happened
+ DALI_TEST_CHECK(false);
+ }
+
+ ToolkitApplication::ADD_IDLE_SUCCESS = true;
+
+ // Clear cache.
+ application.SendNotification();
+ application.Render();
+
+ gResourceReadySignalCounter = 0;
+
+ gResourceReadySignalCounter = 0;
+
+ // Clear image view for clear test
+
+ if(gImageView1)
+ {
+ gImageView1.Reset();
+ }
+
+ END_TEST;
+}
+
int UtcDaliImageViewSetImageOnResourceReadySignal11(void)
{
tet_infoline("Test ResourceReady Add AnimatedImageVisual and then Remove immediately.");
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
#include <dali-toolkit/devel-api/text/rendering-backend.h>
#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
-#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
#include <dali/devel-api/actors/actor-devel.h>
#include <dali/devel-api/adaptor-framework/clipboard.h>
#include <dali/devel-api/adaptor-framework/key-devel.h>
-#include <dali/devel-api/text-abstraction/font-client.h>
#include <dali/devel-api/events/pan-gesture-devel.h>
+#include <dali/devel-api/text-abstraction/font-client.h>
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/public-api/rendering/renderer.h>
bool& mFinishedCalled;
};
-
// Stores data that is populated in the callback and will be read by the test cases
struct SignalData
{
SignalData& signalData;
};
-
} // namespace
int UtcDaliToolkitTextEditorConstructorP(void)
END_TEST;
}
+int utcDaliTextEditorInputStyleChanged03(void)
+{
+ // Test InputStyleCahnged signal emitted even if AddIdle failed.
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorInputStyleChanged03");
+
+ // Load some fonts.
+
+ char* pathNamePtr = get_current_dir_name();
+ const std::string pathName(pathNamePtr);
+ free(pathNamePtr);
+
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ fontClient.SetDpi(93u, 93u);
+
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE);
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE);
+
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK(editor);
+
+ editor.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
+ editor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ editor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+
+ editor.SetProperty(TextEditor::Property::ENABLE_MARKUP, true);
+ editor.SetProperty(TextEditor::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='green'>llo</color> <font weight='bold'>world</font> demo</font>");
+
+ // connect to the text changed signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ editor.InputStyleChangedSignal().Connect(&TestInputStyleChangedCallback);
+ bool inputStyleChangedSignal = false;
+ editor.ConnectSignal(testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal));
+
+ application.GetScene().Add(editor);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text editor.
+ TestGenerateTap(application, 18.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
+ if(gInputStyleChangedCallbackCalled)
+ {
+ DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::FONT_FAMILY | TextEditor::InputStyle::POINT_SIZE), TEST_LOCATION);
+
+ const std::string fontFamily = editor.GetProperty(TextEditor::Property::INPUT_FONT_FAMILY).Get<std::string>();
+ DALI_TEST_EQUALS(fontFamily, "DejaVuSerif", TEST_LOCATION);
+
+ const float pointSize = editor.GetProperty(TextEditor::Property::INPUT_POINT_SIZE).Get<float>();
+ DALI_TEST_EQUALS(pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+ }
+ DALI_TEST_CHECK(inputStyleChangedSignal);
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text editor.
+ TestGenerateTap(application, 30.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
+ DALI_TEST_CHECK(!inputStyleChangedSignal);
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text editor.
+ TestGenerateTap(application, 43.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
+ if(gInputStyleChangedCallbackCalled)
+ {
+ DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::COLOR), TEST_LOCATION);
+
+ const Vector4 color = editor.GetProperty(TextEditor::Property::INPUT_COLOR).Get<Vector4>();
+ DALI_TEST_EQUALS(color, Color::GREEN, TEST_LOCATION);
+ }
+ DALI_TEST_CHECK(inputStyleChangedSignal);
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Make AddIdle return false.
+ ToolkitApplication::ADD_IDLE_SUCCESS = false;
+
+ // Create a tap event to touch the text editor.
+ TestGenerateTap(application, 88.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Execute the idle callbacks.
+ // And check whether we didn't change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
+ DALI_TEST_CHECK(!inputStyleChangedSignal);
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text editor.
+ TestGenerateTap(application, 115.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Execute the idle callbacks.
+ // And check whether we didn't change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
+ DALI_TEST_CHECK(!inputStyleChangedSignal);
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Revert AddIdle return true.
+ ToolkitApplication::ADD_IDLE_SUCCESS = true;
+
+ // Create a tap event to touch the text editor.
+ TestGenerateTap(application, 164.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
+ if(gInputStyleChangedCallbackCalled)
+ {
+ DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextEditor::InputStyle::FONT_STYLE), TEST_LOCATION);
+
+ Property::Map fontStyleMapSet;
+ Property::Map fontStyleMapGet;
+
+ fontStyleMapGet = editor.GetProperty<Property::Map>(TextEditor::Property::INPUT_FONT_STYLE);
+ DALI_TEST_EQUALS(fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(DaliTestCheckMaps(fontStyleMapGet, fontStyleMapSet), true, TEST_LOCATION);
+ }
+ DALI_TEST_CHECK(inputStyleChangedSignal);
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text editor.
+ TestGenerateTap(application, 191.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
+ DALI_TEST_CHECK(!inputStyleChangedSignal);
+
+ END_TEST;
+}
+
int utcDaliTextEditorEvent01(void)
{
ToolkitTestApplication application;
END_TEST;
}
-
int utcDaliTextEditorSelectionClearedSignal(void)
{
ToolkitTestApplication application;
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
-
END_TEST;
}
application.SendNotification();
application.Render();
- unsigned int startIndex = 0;
- unsigned int endIndex = 15;
+ unsigned int startIndex = 0;
+ unsigned int endIndex = 15;
- Rect<> textBoundingRectangle = DevelTextEditor::GetTextBoundingRectangle(editor, startIndex, endIndex);
+ Rect<> textBoundingRectangle = DevelTextEditor::GetTextBoundingRectangle(editor, startIndex, endIndex);
Rect<> expectedTextBoundingRectangle = {0, 0, 100, 50};
TestTextGeometryUtils::CheckRectGeometryResult(textBoundingRectangle, expectedTextBoundingRectangle);
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
#include <unistd.h>
#include <iostream>
-
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-field-devel.h>
return true;
}
-
// Stores data that is populated in the callback and will be read by the test cases
struct SignalData
{
// input text
gInputFilteredAcceptedCallbackCalled = false;
- imfEvent = InputMethodContext::EventData(InputMethodContext::COMMIT, "Hello1234", 0, 9);
+ imfEvent = InputMethodContext::EventData(InputMethodContext::COMMIT, "Hello1234", 0, 9);
inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
application.SendNotification();
application.Render();
DALI_TEST_CHECK(gInputFilteredAcceptedCallbackCalled);
DALI_TEST_EQUALS(field.GetProperty<std::string>(TextField::Property::TEXT), std::string("1234"), TEST_LOCATION);
- inputFilteredSignal = false;
+ inputFilteredSignal = false;
gInputFilteredRejectedCallbackCalled = false;
- imfEvent = InputMethodContext::EventData(InputMethodContext::COMMIT, "1234567", 0, 7);
+ imfEvent = InputMethodContext::EventData(InputMethodContext::COMMIT, "1234567", 0, 7);
inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent);
application.SendNotification();
application.Render();
END_TEST;
}
+int utcDaliTextFieldInputStyleChanged03(void)
+{
+ // Test InputStyleCahnged signal emitted even if AddIdle failed.
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldInputStyleChanged03");
+
+ // Load some fonts.
+
+ char* pathNamePtr = get_current_dir_name();
+ const std::string pathName(pathNamePtr);
+ free(pathNamePtr);
+
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ fontClient.SetDpi(93u, 93u);
+
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE);
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE);
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK(field);
+
+ field.SetProperty(Actor::Property::SIZE, Vector2(300.f, 50.f));
+ field.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ field.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+
+ field.SetProperty(TextField::Property::ENABLE_MARKUP, true);
+ field.SetProperty(TextField::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='green'>llo</color> <font weight='bold'>world</font> demo</font>");
+
+ // connect to the text changed signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ field.InputStyleChangedSignal().Connect(&TestInputStyleChangedCallback);
+ bool inputStyleChangedSignal = false;
+ field.ConnectSignal(testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal));
+
+ application.GetScene().Add(field);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 18.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
+ if(gInputStyleChangedCallbackCalled)
+ {
+ DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextField::InputStyle::FONT_FAMILY | TextField::InputStyle::POINT_SIZE), TEST_LOCATION);
+
+ const std::string fontFamily = field.GetProperty(TextField::Property::INPUT_FONT_FAMILY).Get<std::string>();
+ DALI_TEST_EQUALS(fontFamily, "DejaVuSerif", TEST_LOCATION);
+
+ const float pointSize = field.GetProperty(TextField::Property::INPUT_POINT_SIZE).Get<float>();
+ DALI_TEST_EQUALS(pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+ }
+ DALI_TEST_CHECK(inputStyleChangedSignal);
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 30.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
+ DALI_TEST_CHECK(!inputStyleChangedSignal);
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 43.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
+ if(gInputStyleChangedCallbackCalled)
+ {
+ DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextField::InputStyle::COLOR), TEST_LOCATION);
+
+ const Vector4 color = field.GetProperty(TextField::Property::INPUT_COLOR).Get<Vector4>();
+ DALI_TEST_EQUALS(color, Color::GREEN, TEST_LOCATION);
+ }
+ DALI_TEST_CHECK(inputStyleChangedSignal);
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Make AddIdle return false.
+ ToolkitApplication::ADD_IDLE_SUCCESS = false;
+
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 88.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Execute the idle callbacks.
+ // And check whether we didn't change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
+ DALI_TEST_CHECK(!inputStyleChangedSignal);
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 115.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Execute the idle callbacks.
+ // And check whether we didn't change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
+ DALI_TEST_CHECK(!inputStyleChangedSignal);
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Revert AddIdle return true.
+ ToolkitApplication::ADD_IDLE_SUCCESS = true;
+
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 164.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(gInputStyleChangedCallbackCalled);
+ if(gInputStyleChangedCallbackCalled)
+ {
+ DALI_TEST_EQUALS(static_cast<unsigned int>(gInputStyleMask), static_cast<unsigned int>(TextField::InputStyle::FONT_STYLE), TEST_LOCATION);
+
+ const std::string style = field.GetProperty(TextField::Property::INPUT_FONT_STYLE).Get<std::string>();
+ DALI_TEST_CHECK(style.empty());
+ }
+ DALI_TEST_CHECK(inputStyleChangedSignal);
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text field.
+ TestGenerateTap(application, 191.0f, 25.0f);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK(!gInputStyleChangedCallbackCalled);
+ DALI_TEST_CHECK(!inputStyleChangedSignal);
+
+ END_TEST;
+}
+
int utcDaliTextFieldEvent01(void)
{
ToolkitTestApplication application;
ToolkitTestApplication application;
tet_infoline(" utcDaliTextFieldEvent08");
- Dali::Clipboard clipboard = Clipboard::Get();
+ Dali::Clipboard clipboard = Clipboard::Get();
Dali::Clipboard::ClipData data("text/plain;charset=utf-8", "testTextFieldEvent");
clipboard.SetData(data);
END_TEST;
}
-
int utcDaliTextFieldGeometryNullPtr(void)
{
ToolkitTestApplication application;
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
-
END_TEST;
}
application.SendNotification();
application.Render();
- unsigned int startIndex = 0;
- unsigned int endIndex = 15;
+ unsigned int startIndex = 0;
+ unsigned int endIndex = 15;
- Rect<> textBoundingRectangle = DevelTextField::GetTextBoundingRectangle(field, startIndex, endIndex);
+ Rect<> textBoundingRectangle = DevelTextField::GetTextBoundingRectangle(field, startIndex, endIndex);
Rect<> expectedTextBoundingRectangle = {0, 0, 100, 25};
TestTextGeometryUtils::CheckRectGeometryResult(textBoundingRectangle, expectedTextBoundingRectangle);
END_TEST;
}
-
int utcDaliTextFieldDecoratorColor(void)
{
ToolkitTestApplication application;
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
{
// The callback manager takes the ownership of the callback object.
mIdleCallback = MakeCallback(this, &Control::Impl::OnIdleCallback);
- Adaptor::Get().AddIdle(mIdleCallback, true);
+ if(DALI_UNLIKELY(!Adaptor::Get().AddIdle(mIdleCallback, true)))
+ {
+ DALI_LOG_ERROR("Fail to add idle callback for control resource ready. Skip this callback.\n");
+ mIdleCallback = nullptr;
+ mIdleCallbackRegistered = false;
+ }
}
}
}
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
{
// @note: The callback manager takes the ownership of the callback object.
mIdleCallback = MakeCallback(this, &TextEditor::OnIdleSignal);
- adaptor.AddIdle(mIdleCallback, false);
+ if(DALI_UNLIKELY(!adaptor.AddIdle(mIdleCallback, false)))
+ {
+ DALI_LOG_ERROR("Fail to add idle callback for text editor queue. Skip these callbacks\n");
+
+ // Set the pointer to null as the callback manager deletes the callback even AddIdle failed.
+ mIdleCallback = NULL;
+ }
}
}
}
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
{
// @note: The callback manager takes the ownership of the callback object.
mIdleCallback = MakeCallback(this, &TextField::OnIdleSignal);
- adaptor.AddIdle(mIdleCallback, false);
+ if(DALI_UNLIKELY(!adaptor.AddIdle(mIdleCallback, false)))
+ {
+ DALI_LOG_ERROR("Fail to add idle callback for text field queue. Skip these callbacks\n");
+
+ // Set the pointer to null as the callback manager deletes the callback even AddIdle failed.
+ mIdleCallback = NULL;
+ }
}
}
}
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
#include <dali-toolkit/devel-api/asset-manager/asset-manager.h>
#include <dali-toolkit/devel-api/styling/style-manager-devel.h>
#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+#include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
#include <dali-toolkit/internal/visuals/animated-gradient/animated-gradient-visual.h>
#include <dali-toolkit/internal/visuals/animated-image/animated-image-visual.h>
#include <dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.h>
#include <dali-toolkit/internal/visuals/npatch/npatch-visual.h>
#include <dali-toolkit/internal/visuals/primitive/primitive-visual.h>
#include <dali-toolkit/internal/visuals/svg/svg-visual.h>
-#include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
#include <dali-toolkit/internal/visuals/text-visual-shader-factory.h>
#include <dali-toolkit/internal/visuals/text/text-visual.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/public-api/visuals/text-visual-properties.h>
#include <dali-toolkit/public-api/visuals/visual-properties.h>
-
namespace Dali
{
namespace Toolkit
DALI_TYPE_REGISTRATION_END()
const char* const BROKEN_IMAGE_FILE_NAME = "broken.png"; ///< The file name of the broken image.
-static constexpr auto SHADER_TYPE_COUNT = 2u;
-const std::string_view VertexPredefines[SHADER_TYPE_COUNT]
-{
- "", //VisualFactoryCache::COLOR_SHADER
+static constexpr auto SHADER_TYPE_COUNT = 2u;
+const std::string_view VertexPredefines[SHADER_TYPE_COUNT]{
+ "", //VisualFactoryCache::COLOR_SHADER
"#define IS_REQUIRED_ROUNDED_CORNER\n", //VisualFactoryCache::COLOR_SHADER_ROUNDED_CORNER
};
-const std::string_view FragmentPredefines[SHADER_TYPE_COUNT]
-{
- "", //VisualFactoryCache::COLOR_SHADER
+const std::string_view FragmentPredefines[SHADER_TYPE_COUNT]{
+ "", //VisualFactoryCache::COLOR_SHADER
"#define IS_REQUIRED_ROUNDED_CORNER\n", //VisualFactoryCache::COLOR_SHADER_ROUNDED_CORNER
};
// Get image shader
std::vector<RawShaderData> rawShaderList;
- RawShaderData imageShaderData;
+ RawShaderData imageShaderData;
GetImageVisualShaderFactory().GetPreCompiledShader(imageShaderData);
rawShaderList.push_back(imageShaderData);
GetPreCompiledShader(colorShaderData);
rawShaderList.push_back(colorShaderData);
-
// Save all shader
ShaderPreCompiler::Get().SavePreCompileShaderList(rawShaderList);
}
{
std::vector<std::string_view> vertexPrefix;
std::vector<std::string_view> fragmentPrefix;
- int shaderCount = 0;
- shaders.shaderCount = 0;
- for(uint32_t i=0u; i< SHADER_TYPE_COUNT; ++i)
+ int shaderCount = 0;
+ shaders.shaderCount = 0;
+ for(uint32_t i = 0u; i < SHADER_TYPE_COUNT; ++i)
{
vertexPrefix.push_back(VertexPredefines[i]);
fragmentPrefix.push_back(FragmentPredefines[i]);
shaderCount++;
}
- shaders.vertexPrefix = vertexPrefix;
+ shaders.vertexPrefix = vertexPrefix;
shaders.fragmentPrefix = fragmentPrefix;
- shaders.vertexShader = SHADER_COLOR_VISUAL_SHADER_VERT;
+ shaders.vertexShader = SHADER_COLOR_VISUAL_SHADER_VERT;
shaders.fragmentShader = SHADER_COLOR_VISUAL_SHADER_FRAG;
- shaders.shaderCount = shaderCount;
+ shaders.shaderCount = shaderCount;
}
Internal::VisualFactoryCache& VisualFactory::GetFactoryCache()
Adaptor& adaptor = Adaptor::Get();
- if(!adaptor.AddIdle(mIdleCallback, false))
+ if(DALI_UNLIKELY(!adaptor.AddIdle(mIdleCallback, false)))
{
- // Fail to add idle. (Maybe adaptor is paused.)
- mIdleCallback = nullptr;
+ DALI_LOG_ERROR("Fail to add idle callback for visual factory. Call it synchronously.\n");
+ OnDiscardCallback();
}
}
}