/*
- * 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.
#include <dali-toolkit/devel-api/focus-manager/keyboard-focus-manager-devel.h>
#include <dali/integration-api/events/touch-event-integ.h>
+#include <toolkit-event-thread-callback.h>
#include <dali-scene3d/public-api/controls/model/model.h>
+#include <dali/devel-api/actors/camera-actor-devel.h>
+
using namespace Dali;
using namespace Dali::Toolkit;
* Donated by Norbert Nopper for glTF testing.
* Take from https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/AnimatedCube
*/
-const char* TEST_GLTF_FILE_NAME = TEST_RESOURCE_DIR "/AnimatedCube.gltf";
-const char* TEST_GLTF_ANIMATION_TEST_FILE_NAME = TEST_RESOURCE_DIR "/animationTest.gltf";
-const char* TEST_DLI_FILE_NAME = TEST_RESOURCE_DIR "/arc.dli";
+const char* TEST_GLTF_FILE_NAME = TEST_RESOURCE_DIR "/AnimatedCube.gltf";
+const char* TEST_GLTF_ANIMATION_TEST_FILE_NAME = TEST_RESOURCE_DIR "/animationTest.gltf";
+const char* TEST_GLTF_MULTIPLE_PRIMITIVE_FILE_NAME = TEST_RESOURCE_DIR "/simpleMultiplePrimitiveTest.gltf";
+const char* TEST_DLI_FILE_NAME = TEST_RESOURCE_DIR "/arc.dli";
+const char* TEST_DLI_EXERCISE_FILE_NAME = TEST_RESOURCE_DIR "/exercise.dli";
/**
* For the diffuse and specular cube map texture.
* These textures are based off version of Wave engine sample
* Take from https://github.com/WaveEngine/Samples
*
- * Copyright (c) 2022 Wave Coorporation
+ * Copyright (c) 2023 Wave Coorporation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
gFocusChangedCallBackCalled = true;
}
+// For ResourceReady
+static bool gOnRelayoutCallBackCalled = false;
+void OnRelayoutCallback(Actor actor)
+{
+ gOnRelayoutCallBackCalled = true;
+}
+
+static bool gResourceReadyCalled = false;
+void OnResourceReady(Control control)
+{
+ gResourceReadyCalled = true;
+}
+
} // namespace
// Negative test case for a method
ToolkitTestApplication application;
Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
-
application.GetScene().Add(model);
+ gResourceReadyCalled = false;
+ model.ResourceReadySignal().Connect(&OnResourceReady);
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);
+
uint32_t modelCount = model.GetModelRoot().GetChildCount();
DALI_TEST_EQUALS(1, modelCount, TEST_LOCATION);
-
END_TEST;
}
ToolkitTestApplication application;
Scene3D::Model model = Scene3D::Model::New(TEST_DLI_FILE_NAME);
-
application.GetScene().Add(model);
+ gResourceReadyCalled = false;
+ model.ResourceReadySignal().Connect(&OnResourceReady);
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);
+
uint32_t modelCount = model.GetModelRoot().GetChildCount();
DALI_TEST_EQUALS(1, modelCount, TEST_LOCATION);
Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
Vector3 naturalSize = model.GetNaturalSize();
+ DALI_TEST_EQUALS(Vector3::ZERO, naturalSize, TEST_LOCATION);
+
+ application.GetScene().Add(model);
+
+ gResourceReadyCalled = false;
+ model.ResourceReadySignal().Connect(&OnResourceReady);
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+ application.SendNotification();
+ DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);
+
+ naturalSize = model.GetNaturalSize();
DALI_TEST_EQUALS(Vector3(2, 2, 2), naturalSize, TEST_LOCATION);
Actor root = model.GetModelRoot();
ToolkitTestApplication application;
Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
-
application.GetScene().Add(model);
+ gResourceReadyCalled = false;
+ model.ResourceReadySignal().Connect(&OnResourceReady);
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
+
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);
+
Actor meshActor = model.FindChildByName("AnimatedCube");
DALI_TEST_CHECK(meshActor);
DALI_TEST_CHECK(renderer);
TextureSet textureSet = renderer.GetTextures();
- DALI_TEST_EQUALS(textureSet.GetTextureCount(), 7u, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetTextureCount(), 9u, TEST_LOCATION);
- Texture diffuseTexture = textureSet.GetTexture(5u);
- Texture specularTexture = textureSet.GetTexture(6u);
+ Texture diffuseTexture = textureSet.GetTexture(7u);
+ Texture specularTexture = textureSet.GetTexture(8u);
+ gResourceReadyCalled = false;
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
model.SetImageBasedLightSource(TEST_DIFFUSE_TEXTURE, TEST_SPECULAR_TEXTURE);
- Texture newDiffuseTexture = textureSet.GetTexture(5u);
- Texture newSpecularTexture = textureSet.GetTexture(6u);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);
+
+ Texture newDiffuseTexture = textureSet.GetTexture(7u);
+ Texture newSpecularTexture = textureSet.GetTexture(8u);
DALI_TEST_NOT_EQUALS(diffuseTexture, newDiffuseTexture, 0.0f, TEST_LOCATION);
DALI_TEST_NOT_EQUALS(specularTexture, newSpecularTexture, 0.0f, TEST_LOCATION);
+ model.Unparent();
+ model.Reset();
END_TEST;
}
ToolkitTestApplication application;
Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
-
application.GetScene().Add(model);
+ gResourceReadyCalled = false;
+ model.ResourceReadySignal().Connect(&OnResourceReady);
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
+
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);
+
Actor meshActor = model.FindChildByName("AnimatedCube");
DALI_TEST_CHECK(meshActor);
DALI_TEST_CHECK(renderer);
TextureSet textureSet = renderer.GetTextures();
- DALI_TEST_EQUALS(textureSet.GetTextureCount(), 7u, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetTextureCount(), 9u, TEST_LOCATION);
- Texture diffuseTexture = textureSet.GetTexture(5u);
- Texture specularTexture = textureSet.GetTexture(6u);
+ Texture diffuseTexture = textureSet.GetTexture(7u);
+ Texture specularTexture = textureSet.GetTexture(8u);
+ // if url is empty, loading is not requested.
model.SetImageBasedLightSource("", "");
- Texture newDiffuseTexture = textureSet.GetTexture(5u);
- Texture newSpecularTexture = textureSet.GetTexture(6u);
+ Texture newDiffuseTexture = textureSet.GetTexture(7u);
+ Texture newSpecularTexture = textureSet.GetTexture(8u);
DALI_TEST_EQUALS(diffuseTexture, newDiffuseTexture, TEST_LOCATION);
DALI_TEST_EQUALS(specularTexture, newSpecularTexture, TEST_LOCATION);
ToolkitTestApplication application;
Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
-
application.GetScene().Add(model);
+ gResourceReadyCalled = false;
+ model.ResourceReadySignal().Connect(&OnResourceReady);
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
+
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);
+
Actor meshActor = model.FindChildByName("AnimatedCube");
DALI_TEST_CHECK(meshActor);
DALI_TEST_CHECK(renderer);
TextureSet textureSet = renderer.GetTextures();
- DALI_TEST_EQUALS(textureSet.GetTextureCount(), 7u, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetTextureCount(), 9u, TEST_LOCATION);
- Texture diffuseTexture = textureSet.GetTexture(5u);
- Texture specularTexture = textureSet.GetTexture(6u);
+ Texture diffuseTexture = textureSet.GetTexture(7u);
+ Texture specularTexture = textureSet.GetTexture(8u);
+ gResourceReadyCalled = false;
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
model.SetImageBasedLightSource("dummy.ktx", "dummy.ktx");
- Texture newDiffuseTexture = textureSet.GetTexture(5u);
- Texture newSpecularTexture = textureSet.GetTexture(6u);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);
+
+ Texture newDiffuseTexture = textureSet.GetTexture(7u);
+ Texture newSpecularTexture = textureSet.GetTexture(8u);
DALI_TEST_EQUALS(diffuseTexture, newDiffuseTexture, TEST_LOCATION);
DALI_TEST_EQUALS(specularTexture, newSpecularTexture, TEST_LOCATION);
END_TEST;
}
+int UtcDaliModelSetImageBasedLightSource04(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
+ model.SetImageBasedLightSource(TEST_DIFFUSE_TEXTURE, TEST_SPECULAR_TEXTURE);
+ application.GetScene().Add(model);
+
+ gResourceReadyCalled = false;
+ model.ResourceReadySignal().Connect(&OnResourceReady);
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(3), true, TEST_LOCATION);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);
+ END_TEST;
+}
+
int UtcDaliModelImageBasedFactor(void)
{
ToolkitTestApplication application;
// Allow children actor's event before on scene.
view.SetChildrenSensitive(true);
DALI_TEST_EQUALS(view.GetChildrenSensitive(), true, TEST_LOCATION);
-
application.GetScene().Add(view);
+ gResourceReadyCalled = false;
+ view.ResourceReadySignal().Connect(&OnResourceReady);
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);
+
Actor meshActor = view.FindChildByName("AnimatedCube");
DALI_TEST_CHECK(meshActor);
// Block children actor's event before on scene.
view.SetChildrenSensitive(false);
DALI_TEST_EQUALS(view.GetChildrenSensitive(), false, TEST_LOCATION);
-
application.GetScene().Add(view);
+ gResourceReadyCalled = false;
+ view.ResourceReadySignal().Connect(&OnResourceReady);
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
+
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);
+
Actor meshActor = view.FindChildByName("AnimatedCube");
DALI_TEST_CHECK(meshActor);
// Allow children actor's focus before on scene.
view.SetChildrenFocusable(true);
DALI_TEST_EQUALS(view.GetChildrenFocusable(), true, TEST_LOCATION);
-
application.GetScene().Add(view);
+ gResourceReadyCalled = false;
+ view.ResourceReadySignal().Connect(&OnResourceReady);
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);
+
Actor meshActor = view.FindChildByName("AnimatedCube");
DALI_TEST_CHECK(meshActor);
// Block children actor's focus before on scene.
view.SetChildrenFocusable(false);
DALI_TEST_EQUALS(view.GetChildrenFocusable(), false, TEST_LOCATION);
-
application.GetScene().Add(view);
+ gResourceReadyCalled = false;
+ view.ResourceReadySignal().Connect(&OnResourceReady);
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);
+
Actor meshActor = view.FindChildByName("AnimatedCube");
DALI_TEST_CHECK(meshActor);
Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
model.SetProperty(Dali::Actor::Property::SIZE, Vector2(50, 50));
-
application.GetScene().Add(model);
+ gResourceReadyCalled = false;
+ model.ResourceReadySignal().Connect(&OnResourceReady);
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);
+
uint32_t animationCount = model.GetAnimationCount();
DALI_TEST_EQUALS(1, animationCount, TEST_LOCATION);
Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_ANIMATION_TEST_FILE_NAME);
model.SetProperty(Dali::Actor::Property::SIZE, Vector2(50, 50));
-
application.GetScene().Add(model);
+ gResourceReadyCalled = false;
+ model.ResourceReadySignal().Connect(&OnResourceReady);
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
application.SendNotification();
application.Render();
END_TEST;
}
-// For ResourceReady
-namespace
+int UtcDaliModelAnimation03(void)
{
-static bool gOnRelayoutCallBackCalled = false;
-void OnRelayoutCallback(Actor actor)
+ ToolkitTestApplication application;
+
+ Scene3D::Model model = Scene3D::Model::New(TEST_DLI_EXERCISE_FILE_NAME);
+ model.SetProperty(Dali::Actor::Property::SIZE, Vector2(50, 50));
+ application.GetScene().Add(model);
+
+ gResourceReadyCalled = false;
+ model.ResourceReadySignal().Connect(&OnResourceReady);
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);
+
+ uint32_t animationCount = model.GetAnimationCount();
+ DALI_TEST_EQUALS(18, animationCount, TEST_LOCATION);
+
+ Animation animationByIndex = model.GetAnimation(0u);
+ DALI_TEST_CHECK(animationByIndex);
+
+ Animation animationByName = model.GetAnimation("idleClip");
+ DALI_TEST_CHECK(animationByName);
+ DALI_TEST_EQUALS(animationByIndex, animationByName, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliModelCameraGenerate01(void)
{
- gOnRelayoutCallBackCalled = true;
+ ToolkitTestApplication application;
+
+ Scene3D::Model model = Scene3D::Model::New(TEST_DLI_EXERCISE_FILE_NAME);
+ model.SetProperty(Dali::Actor::Property::SIZE, Vector2(50, 50));
+ application.GetScene().Add(model);
+
+ gResourceReadyCalled = false;
+ model.ResourceReadySignal().Connect(&OnResourceReady);
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);
+
+ uint32_t cameraCount = model.GetCameraCount();
+ DALI_TEST_EQUALS(1, cameraCount, TEST_LOCATION);
+
+ CameraActor generatedCamera = model.GenerateCamera(0u);
+ DALI_TEST_CHECK(generatedCamera);
+
+ generatedCamera = model.GenerateCamera(1u); // Fail to generate camera
+ DALI_TEST_CHECK(!generatedCamera);
+
+ END_TEST;
}
-static bool gResourceReadyCalled = false;
-void OnResourceReady(Control control)
+int UtcDaliModelCameraGenerate02(void)
{
- gResourceReadyCalled = true;
+ ToolkitTestApplication application;
+
+ Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
+ model.SetProperty(Dali::Actor::Property::SIZE, Vector2(50, 50));
+ application.GetScene().Add(model);
+
+ gResourceReadyCalled = false;
+ model.ResourceReadySignal().Connect(&OnResourceReady);
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);
+
+ uint32_t cameraCount = model.GetCameraCount();
+ DALI_TEST_EQUALS(6, cameraCount, TEST_LOCATION);
+
+ CameraActor generatedCamera0 = model.GenerateCamera(0u);
+ DALI_TEST_CHECK(generatedCamera0);
+ CameraActor generatedCamera1 = model.GenerateCamera(1u);
+ DALI_TEST_CHECK(generatedCamera1);
+ CameraActor generatedCamera2 = model.GenerateCamera(2u);
+ DALI_TEST_CHECK(generatedCamera2);
+ CameraActor generatedCamera3 = model.GenerateCamera(3u); // Infinity far camera
+ DALI_TEST_CHECK(generatedCamera3);
+ CameraActor generatedCamera4 = model.GenerateCamera(4u); // Broken camera 1
+ DALI_TEST_CHECK(!generatedCamera4);
+ CameraActor generatedCamera5 = model.GenerateCamera(5u); // Broken camera 2
+ DALI_TEST_CHECK(!generatedCamera5);
+ CameraActor generatedCamera6 = model.GenerateCamera(6u); // Out of bound
+ DALI_TEST_CHECK(!generatedCamera6);
+
+ CameraActor appliedCamera;
+ DALI_TEST_EQUALS(model.ApplyCamera(0u, appliedCamera), false, TEST_LOCATION); // Cannot apply into empty camera.
+
+ auto CompareCameraProperties = [](CameraActor lhs, CameraActor rhs, const char* location) {
+ DALI_TEST_EQUALS(lhs.GetProperty<int>(Dali::CameraActor::Property::PROJECTION_MODE), rhs.GetProperty<int>(Dali::CameraActor::Property::PROJECTION_MODE), TEST_LOCATION);
+ DALI_TEST_EQUALS(lhs.GetProperty<float>(Dali::CameraActor::Property::NEAR_PLANE_DISTANCE), rhs.GetProperty<float>(Dali::CameraActor::Property::NEAR_PLANE_DISTANCE), TEST_LOCATION);
+
+ if(lhs.GetProperty<int>(Dali::CameraActor::Property::PROJECTION_MODE) == static_cast<int>(Dali::Camera::ProjectionMode::PERSPECTIVE_PROJECTION))
+ {
+ DALI_TEST_EQUALS(lhs.GetProperty<float>(Dali::CameraActor::Property::FIELD_OF_VIEW), rhs.GetProperty<float>(Dali::CameraActor::Property::FIELD_OF_VIEW), TEST_LOCATION);
+ // TODO : Open this test when infinity far projection implement.
+ //DALI_TEST_EQUALS(lhs.GetProperty<float>(Dali::CameraActor::Property::FAR_PLANE_DISTANCE), rhs.GetProperty<float>(Dali::CameraActor::Property::FAR_PLANE_DISTANCE), TEST_LOCATION);
+ }
+ else
+ {
+ DALI_TEST_EQUALS(lhs.GetProperty<float>(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE), rhs.GetProperty<float>(Dali::DevelCameraActor::Property::ORTHOGRAPHIC_SIZE), TEST_LOCATION);
+ DALI_TEST_EQUALS(lhs.GetProperty<float>(Dali::CameraActor::Property::FAR_PLANE_DISTANCE), rhs.GetProperty<float>(Dali::CameraActor::Property::FAR_PLANE_DISTANCE), TEST_LOCATION);
+ }
+ };
+
+ appliedCamera = CameraActor::New();
+ DALI_TEST_EQUALS(model.ApplyCamera(0u, appliedCamera), true, TEST_LOCATION);
+ CompareCameraProperties(generatedCamera0, appliedCamera, TEST_LOCATION);
+ DALI_TEST_EQUALS(model.ApplyCamera(1u, appliedCamera), true, TEST_LOCATION);
+ CompareCameraProperties(generatedCamera1, appliedCamera, TEST_LOCATION);
+ DALI_TEST_EQUALS(model.ApplyCamera(2u, appliedCamera), true, TEST_LOCATION);
+ CompareCameraProperties(generatedCamera2, appliedCamera, TEST_LOCATION);
+ DALI_TEST_EQUALS(model.ApplyCamera(3u, appliedCamera), true, TEST_LOCATION);
+ CompareCameraProperties(generatedCamera3, appliedCamera, TEST_LOCATION);
+ DALI_TEST_EQUALS(model.ApplyCamera(4u, appliedCamera), false, TEST_LOCATION); // Broken camera 1
+ DALI_TEST_EQUALS(model.ApplyCamera(5u, appliedCamera), false, TEST_LOCATION); // Broken camera 2
+ DALI_TEST_EQUALS(model.ApplyCamera(6u, appliedCamera), false, TEST_LOCATION); // Cannot apply over the index.
+
+ END_TEST;
}
-} // namespace
+int UtcDaliModelMultiplePrimitives(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_MULTIPLE_PRIMITIVE_FILE_NAME);
+ model.SetProperty(Dali::Actor::Property::SIZE, Vector2(50, 50));
+ application.GetScene().Add(model);
+
+ gResourceReadyCalled = false;
+ model.ResourceReadySignal().Connect(&OnResourceReady);
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+ application.SendNotification();
+ application.Render();
+
+ Actor actor = model.FindChildByName("rootNode");
+
+ DALI_TEST_EQUALS(0, actor.GetChildCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(2, actor.GetRendererCount(), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliModelColorMode(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::Model model = Scene3D::Model::New(TEST_GLTF_FILE_NAME);
+ model.SetProperty(Dali::Actor::Property::SIZE, Vector2(50, 50));
+ model.SetProperty(Dali::Actor::Property::COLOR, Color::RED);
+ application.GetScene().Add(model);
+
+ gResourceReadyCalled = false;
+ model.ResourceReadySignal().Connect(&OnResourceReady);
+ DALI_TEST_EQUALS(gResourceReadyCalled, false, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+ application.SendNotification();
+ application.Render();
+
+ Actor actor = model.FindChildByName("AnimatedCube");
+ Vector4 childColor = actor[Dali::Actor::Property::COLOR];
+ Vector4 childWorldColor = actor[Dali::Actor::Property::WORLD_COLOR];
+
+ DALI_TEST_EQUALS(childColor, Color::WHITE, TEST_LOCATION);
+ DALI_TEST_EQUALS(childWorldColor, Color::RED, TEST_LOCATION);
+
+ END_TEST;
+}
int UtcDaliModelResourceReady(void)
{
ToolkitTestApplication application;
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+ application.SendNotification();
+ application.Render();
+
DALI_TEST_EQUALS(gOnRelayoutCallBackCalled, false, TEST_LOCATION);
DALI_TEST_EQUALS(model.IsResourceReady(), true, TEST_LOCATION);
DALI_TEST_EQUALS(gResourceReadyCalled, true, TEST_LOCATION);