/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
- PropertyBuffer propertyBuffer = PropertyBuffer::New( PropertyBuffer::STATIC,
- texturedQuadVertexFormat, 4 );
+ PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat );
DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION );
END_TEST;
texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
- PropertyBuffer propertyBuffer = PropertyBuffer::New( PropertyBuffer::STATIC,
- texturedQuadVertexFormat, 4 );
+ PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat );
BaseHandle handle(propertyBuffer);
PropertyBuffer propertyBuffer2 = PropertyBuffer::DownCast(handle);
END_TEST;
}
+int UtcDaliPropertyBufferCopyConstructor(void)
+{
+ TestApplication application;
+
+ PropertyBuffer propertyBuffer = CreatePropertyBuffer();
+
+ PropertyBuffer propertyBufferCopy(propertyBuffer);
+
+ DALI_TEST_EQUALS( (bool)propertyBufferCopy, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( propertyBufferCopy.GetSize(), 0u, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliPropertyBufferAssignmentOperator(void)
+{
+ TestApplication application;
+
+ PropertyBuffer propertyBuffer = CreatePropertyBuffer();
+
+ PropertyBuffer propertyBuffer2;
+ DALI_TEST_EQUALS( (bool)propertyBuffer2, false, TEST_LOCATION );
+
+ propertyBuffer2 = propertyBuffer;
+ DALI_TEST_EQUALS( (bool)propertyBuffer2, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( propertyBuffer2.GetSize(), 0u, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliPropertyBufferSetData01(void)
{
TestApplication application;
texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
- PropertyBuffer propertyBuffer = PropertyBuffer::New( PropertyBuffer::STATIC,
- texturedQuadVertexFormat, 4 );
+ PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat );
DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION );
const float halfQuadSize = .5f;
{ Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) },
{ Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } };
- propertyBuffer.SetData( texturedQuadVertexData );
+ propertyBuffer.SetData( texturedQuadVertexData, 4 );
Geometry geometry = Geometry::New();
geometry.AddVertexBuffer( propertyBuffer );
- Material material = CreateMaterial(1.f);
- Renderer renderer = Renderer::New(geometry, material);
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.SetSize(Vector3::ONE * 100.f);
actor.AddRenderer(renderer);
texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
- PropertyBuffer propertyBuffer = PropertyBuffer::New( PropertyBuffer::STATIC,
- texturedQuadVertexFormat, 4 );
+ PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat );
DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION );
const float halfQuadSize = .5f;
{ Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) },
{ Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } };
- propertyBuffer.SetData( texturedQuadVertexData );
+ propertyBuffer.SetData( texturedQuadVertexData, 4 );
Geometry geometry = Geometry::New();
geometry.AddVertexBuffer( propertyBuffer );
- Material material = CreateMaterial(1.f);
- Renderer renderer = Renderer::New(geometry, material);
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.SetSize(Vector3::ONE * 100.f);
actor.AddRenderer(renderer);
}
// Re-upload the data on the propertyBuffer
- propertyBuffer.SetData( texturedQuadVertexData );
+ propertyBuffer.SetData( texturedQuadVertexData, 4 );
application.SendNotification();
application.Render(0);
const TestGlAbstraction::BufferSubDataCalls& bufferSubDataCalls =
application.GetGlAbstraction().GetBufferSubDataCalls();
+ const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
+ application.GetGlAbstraction().GetBufferDataCalls();
+
DALI_TEST_EQUALS( bufferSubDataCalls.size(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
if ( bufferSubDataCalls.size() )
{
END_TEST;
}
-int UtcDaliPropertyBufferSetSize01(void)
+int UtcDaliPropertyBufferInvalidTypeN(void)
{
TestApplication application;
Property::Map texturedQuadVertexFormat;
- texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
- texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
-
- PropertyBuffer propertyBuffer = PropertyBuffer::New( PropertyBuffer::STATIC,
- texturedQuadVertexFormat,
- 4u );
- DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION );
-
- size_t size = propertyBuffer.GetSize();
- DALI_TEST_EQUALS( size, 4u, TEST_LOCATION );
-
- propertyBuffer.SetSize( 10u );
- size = propertyBuffer.GetSize();
- DALI_TEST_EQUALS( size, 10u, TEST_LOCATION );
+ texturedQuadVertexFormat["aPosition"] = Property::MAP;
+ texturedQuadVertexFormat["aVertexCoord"] = Property::STRING;
+ try
+ {
+ PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat );
+ tet_result(TET_FAIL);
+ }
+ catch ( Dali::DaliException& e )
+ {
+ DALI_TEST_ASSERT( e, "Property::Type not supported in PropertyBuffer", TEST_LOCATION );
+ }
END_TEST;
}