- LinearConstraint : min value could be zero. We should branch out that case.
- Render::Geometry : The number of indecies could be zero.
- BaseSignal : Callback might be nullptr (even if we don't allow this cases)
- Program : we might fail to find '[' keyword.
Change-Id: I45c3fe567e98973d2a215b975f8094b7222995a8
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
/*
- * Copyright (c) 2020 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.
linearConstrainer.SetProperty(Dali::LinearConstrainer::Property::PROGRESS, points);
}
+static void SetupLinearConstrainerNonUniformProgressNonStartWithZero(Dali::LinearConstrainer& linearConstrainer)
+{
+ Dali::Property::Array points;
+ points.Resize(3);
+ points[0] = 0.0f;
+ points[1] = 1.0f;
+ points[2] = 0.0f;
+ linearConstrainer.SetProperty(Dali::LinearConstrainer::Property::VALUE, points);
+
+ points[0] = 0.5f;
+ points[1] = 0.75f;
+ points[2] = 1.0f;
+ linearConstrainer.SetProperty(Dali::LinearConstrainer::Property::PROGRESS, points);
+}
+
} // anonymous namespace
//PathConstrainer test cases
END_TEST;
}
-int UtcLinearConstrainerApply(void)
+int UtcLinearConstrainerApply01(void)
{
TestApplication application;
application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* beyond the animation duration*/);
DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION);
+ //Setup a LinearConstrainer specifying the progress for each value which is not start with 0.0f
+ linearConstrainer.Remove(actor);
+ SetupLinearConstrainerNonUniformProgressNonStartWithZero(linearConstrainer);
+ linearConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION_X), Property(actor, index), range);
+
+ actor.SetProperty(index, 0.0f);
+ animation.Play();
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
+
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 0.0f, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 1.0f, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% progress */);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* beyond the animation duration*/);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION);
+
END_TEST;
}
#define DALI_INTERNAL_LINEAR_CONSTRAINER_H
/*
- * Copyright (c) 2021 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.
min++;
}
- min--;
- max = min + 1;
+ max = min;
- if(min >= valueCount - 1)
+ if(min >= valueCount)
{
min = max = valueCount - 1;
tLocal = 0.0f;
}
+ else if(min == 0u)
+ {
+ min = max = 0u;
+ tLocal = 0.0f;
+ }
else
{
+ min--;
tLocal = (t - mProgress[min]) / (mProgress[max] - mProgress[min]);
}
}
/*
- * 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.
if(elementBufferOffset != 0u)
{
- elementBufferOffset = (elementBufferOffset >= numIndices) ? numIndices - 1 : elementBufferOffset;
+ elementBufferOffset = (elementBufferOffset >= numIndices) ? numIndices : elementBufferOffset;
firstIndexOffset = intptr_t(elementBufferOffset * sizeOfIndex);
numIndices -= elementBufferOffset;
}
//Draw call
if(mIndexBuffer && mGeometryType != Dali::Geometry::POINTS)
{
- //Indexed draw call
- const Graphics::Buffer* ibo = mIndexBuffer->GetGraphicsObject();
- if(ibo)
+ // Issue draw call only if there's non-zero numIndices
+ if(numIndices)
{
- commandBuffer.BindIndexBuffer(*ibo, 0, mIndexType);
- }
+ //Indexed draw call
+ const Graphics::Buffer* ibo = mIndexBuffer->GetGraphicsObject();
+ if(ibo)
+ {
+ commandBuffer.BindIndexBuffer(*ibo, 0, mIndexType);
+ }
- commandBuffer.DrawIndexed(numIndices, instanceCount, firstIndexOffset, 0, 0);
+ commandBuffer.DrawIndexed(numIndices, instanceCount, firstIndexOffset, 0, 0);
+ }
}
else
{
if(!name.empty() && name.back() == ']')
{
- hash = hashedNameNoArray;
- auto pos = name.rfind("[");
- match = name.substr(0, pos); // Remove subscript
- arrayIndex = atoi(&name[pos + 1]);
+ auto pos = name.rfind("[");
+ if(pos != std::string::npos)
+ {
+ hash = hashedNameNoArray;
+ match = name.substr(0, pos); // Remove subscript
+ arrayIndex = atoi(&name[pos + 1]);
+ }
}
for(const ReflectionUniformInfo& item : mReflection)
/*
- * 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.
{
const auto& iter = convertorIter->second; // std::list<SignalConnection>::iterator
- if(*iter) // the value of iterator can be null.
+ if(*iter && iter->GetCallback()) // the value of iterator can be null.
{
if(*(iter->GetCallback()) == *callback)
{