[dali_2.2.21] Merge branch 'devel/master' 38/291038/1
authorDavid Steele <david.steele@samsung.com>
Thu, 6 Apr 2023 13:48:46 +0000 (14:48 +0100)
committerDavid Steele <david.steele@samsung.com>
Thu, 6 Apr 2023 13:48:46 +0000 (14:48 +0100)
Change-Id: I05000d2b1eba23d298b9bda7f7f94736b8ac783e

automated-tests/src/dali-scene3d-internal/CMakeLists.txt
automated-tests/src/dali-scene3d-internal/utc-Dali-EnvironmentMapTask.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-TextSpannable.cpp
dali-scene3d/internal/common/environment-map-load-task.cpp
dali-scene3d/internal/common/environment-map-load-task.h
dali-scene3d/internal/controls/scene-view/scene-view-impl.cpp
dali-scene3d/public-api/loader/environment-map-loader.cpp
dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec

index a7a419e..06da0de 100755 (executable)
@@ -8,6 +8,7 @@ SET(CAPI_LIB "dali-scene3d")
 # List of test case sources (Only these get parsed for test cases)
 SET(TC_SOURCES
   utc-Dali-DliLoaderImpl.cpp
+  utc-Dali-EnvironmentMapTask.cpp
   utc-Dali-GlbLoaderImpl.cpp
   utc-Dali-Gltf2Asset.cpp
   utc-Dali-Gltf2LoaderImpl.cpp
diff --git a/automated-tests/src/dali-scene3d-internal/utc-Dali-EnvironmentMapTask.cpp b/automated-tests/src/dali-scene3d-internal/utc-Dali-EnvironmentMapTask.cpp
new file mode 100644 (file)
index 0000000..55b28d0
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+// Enable debug log for test coverage
+#define DEBUG_ENABLED 1
+
+#include <toolkit-event-thread-callback.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <string_view>
+#include <dali-scene3d/internal/common/environment-map-load-task.h>
+
+using namespace Dali;
+using namespace Dali::Scene3D::Internal;
+
+typedef IntrusivePtr<EnvironmentMapLoadTask> EnvironmentMapLoadTaskPtr;
+
+bool called = false;
+void LoadComplete()
+{
+  called = true;
+}
+
+int UtcDaliEnvironmentMapTaskSuccess01(void)
+{
+  ToolkitTestApplication    application;
+  EnvironmentMapLoadTaskPtr environmentMapLoadTask;
+
+  auto path              = TEST_RESOURCE_DIR "/forest_radiance.ktx";
+  environmentMapLoadTask = new EnvironmentMapLoadTask(path, Dali::Scene3D::EnvironmentMapType::AUTO, Dali::MakeCallback(LoadComplete));
+  Dali::AsyncTaskManager::Get().AddTask(environmentMapLoadTask);
+
+  DALI_TEST_CHECK(!called);
+  application.SendNotification();
+  application.Render(16);
+
+  DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+  DALI_TEST_CHECK(called);
+  DALI_TEST_CHECK(environmentMapLoadTask->HasSucceeded());
+  DALI_TEST_CHECK(environmentMapLoadTask->GetLoadedTexture());
+  DALI_TEST_EQUALS(Dali::Scene3D::EnvironmentMapType::CUBEMAP, environmentMapLoadTask->GetEnvironmentMapType(), TEST_LOCATION);
+
+  environmentMapLoadTask.Reset();
+  END_TEST;
+}
index 40f51de..36125c5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -292,7 +292,7 @@ int UtcDaliToolkitTextLabelSetSpannedText_FontSpan(void)
 
   const Vector<Dali::Toolkit::Text::FontDescriptionRun>& validFontDescriptionRuns = labelImpl.GetTextController()->GetTextModel()->GetFontDescriptionRuns();
   DALI_TEST_EQUALS(validFontDescriptionRuns.Count(), 1u, TEST_LOCATION);
-  std::string familyName = validFontDescriptionRuns[0].familyName;
+  std::string familyName = std::string(validFontDescriptionRuns[0].familyName, validFontDescriptionRuns[0].familyLength);
 
   DALI_TEST_EQUALS(familyName, "TizenSans", TEST_LOCATION);
   DALI_TEST_EQUALS(validFontDescriptionRuns[0].size, expectedPointSize, TEST_LOCATION);
index 6b5f5fb..8bc8239 100644 (file)
@@ -30,10 +30,10 @@ namespace Internal
 EnvironmentMapLoadTask::EnvironmentMapLoadTask(const std::string& environmentMapUrl, Dali::Scene3D::EnvironmentMapType environmentMapType, CallbackBase* callback)
 : AsyncTask(callback),
   mEnvironmentMapUrl(environmentMapUrl),
-  mEnvironmentMapType(environmentMapType),
   mIsReady(true),
   mHasSucceeded(false)
 {
+  mEnvironmentMapData.SetEnvironmentMapType(environmentMapType);
 }
 
 EnvironmentMapLoadTask::~EnvironmentMapLoadTask()
@@ -42,7 +42,6 @@ EnvironmentMapLoadTask::~EnvironmentMapLoadTask()
 
 void EnvironmentMapLoadTask::Process()
 {
-  mEnvironmentMapData.SetEnvironmentMapType(mEnvironmentMapType);
   mHasSucceeded = Scene3D::Loader::LoadEnvironmentMap(mEnvironmentMapUrl, mEnvironmentMapData);
 }
 
@@ -66,6 +65,11 @@ uint32_t EnvironmentMapLoadTask::GetMipmapLevels()
   return (HasSucceeded()) ? mEnvironmentMapData.GetMipmapLevels() : 1u;
 }
 
+Dali::Scene3D::EnvironmentMapType EnvironmentMapLoadTask::GetEnvironmentMapType()
+{
+  return mEnvironmentMapData.GetEnvironmentMapType();
+}
+
 } // namespace Internal
 
 } // namespace Scene3D
index 0bb134f..0517cbd 100644 (file)
  */
 
 // EXTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/async-task-manager.h>
 #include <dali/public-api/common/intrusive-ptr.h>
 #include <dali/public-api/images/pixel-data.h>
-#include <dali/public-api/adaptor-framework/async-task-manager.h>
 #include <memory>
 
 // INTERNAL INCLUDES
-#include <dali-scene3d/public-api/loader/load-result.h>
-#include <dali-scene3d/public-api/loader/scene-definition.h>
 #include <dali-scene3d/public-api/common/environment-map.h>
 #include <dali-scene3d/public-api/loader/environment-map-data.h>
+#include <dali-scene3d/public-api/loader/load-result.h>
+#include <dali-scene3d/public-api/loader/scene-definition.h>
 
 namespace Dali
 {
@@ -83,6 +83,12 @@ public:
    */
   uint32_t GetMipmapLevels();
 
+  /**
+   * Retrieves EnvironmentMap type of the loaded texture
+   * @return EnvironmentMap type of the loaded texture
+   */
+  Dali::Scene3D::EnvironmentMapType GetEnvironmentMapType();
+
 private:
   // Undefined
   EnvironmentMapLoadTask(const EnvironmentMapLoadTask& task) = delete;
@@ -93,7 +99,6 @@ private:
 private:
   std::string                               mEnvironmentMapUrl;
   Dali::Scene3D::Loader::EnvironmentMapData mEnvironmentMapData;
-  Dali::Scene3D::EnvironmentMapType         mEnvironmentMapType{Dali::Scene3D::EnvironmentMapType::AUTO};
 
   bool mIsReady;
   bool mHasSucceeded;
index e2e6912..c606f8f 100644 (file)
@@ -783,7 +783,7 @@ void SceneView::OnSkyboxLoadComplete()
 
   mSkyboxTexture = mSkyboxLoadTask->GetLoadedTexture();
   Shader skyboxShader;
-  if(mSkyboxEnvironmentMapType == Scene3D::EnvironmentMapType::CUBEMAP)
+  if(mSkyboxLoadTask->GetEnvironmentMapType() == Scene3D::EnvironmentMapType::CUBEMAP)
   {
     skyboxShader = Shader::New(SHADER_SKYBOX_SHADER_VERT.data(), SHADER_SKYBOX_SHADER_FRAG.data());
   }
index bbfe829..43f3653 100644 (file)
@@ -27,6 +27,8 @@
 // INTERNAL INCLUDES
 #include <dali-scene3d/public-api/loader/ktx-loader.h>
 
+#include <dali/integration-api/debug.h>
+
 namespace Dali
 {
 namespace
@@ -207,7 +209,6 @@ bool LoadEnvironmentMap(const std::string& environmentMapUrl, EnvironmentMapData
   std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
 
   bool successed = (extension == KTX_EXTENSION) ? Dali::Scene3D::Loader::LoadKtxData(environmentMapUrl, environmentMapData) : LoadEnvironmentMapData(environmentMapUrl, environmentMapData);
-
   return successed;
 }
 
index 404df2d..5b658c2 100644 (file)
@@ -29,7 +29,7 @@ namespace Toolkit
 {
 const unsigned int TOOLKIT_MAJOR_VERSION = 2;
 const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 20;
+const unsigned int TOOLKIT_MICRO_VERSION = 21;
 const char* const  TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 97f9f3f..878cca4 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali2-toolkit
 Summary:    Dali 3D engine Toolkit
-Version:    2.2.20
+Version:    2.2.21
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT