2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali/public-api/dali-core.h>
19 #include <dali-test-suite-utils.h>
23 #include <mesh-builder.h>
27 void TestConstraintNoBlue( Vector4& current, const PropertyInputContainer& inputs )
34 void material_test_startup(void)
36 test_return_value = TET_UNDEF;
39 void material_test_cleanup(void)
41 test_return_value = TET_PASS;
44 int UtcDaliMaterialNew01(void)
46 TestApplication application;
48 Shader shader = Shader::New("vertexSrc", "fragmentSrc");
49 Material material = Material::New(shader);
51 DALI_TEST_CHECK( material );
55 int UtcDaliMaterialNew02(void)
57 TestApplication application;
59 DALI_TEST_CHECK( !material );
63 int UtcDaliMaterialCopyConstructor(void)
65 TestApplication application;
67 Shader shader = Shader::New("vertexSrc", "fragmentSrc");
68 Image image = BufferImage::New(32, 32, Pixel::RGBA8888);
69 Material material = Material::New(shader);
70 material.AddTexture( image, "sTexture" );
72 Material materialCopy(material);
74 DALI_TEST_CHECK( materialCopy );
79 int UtcDaliMaterialAssignmentOperator(void)
81 TestApplication application;
83 Shader shader = Shader::New("vertexSrc", "fragmentSrc");
84 Image image = BufferImage::New(32, 32, Pixel::RGBA8888);
85 Material material = Material::New(shader);
88 DALI_TEST_CHECK( !material2 );
91 DALI_TEST_CHECK( material2 );
96 int UtcDaliMaterialDownCast01(void)
98 TestApplication application;
99 Shader shader = Shader::New("vertexSrc", "fragmentSrc");
100 Material material = Material::New(shader);
102 BaseHandle handle(material);
103 Material material2 = Material::DownCast(handle);
104 DALI_TEST_CHECK( material2 );
109 int UtcDaliMaterialDownCast02(void)
111 TestApplication application;
113 Handle handle = Handle::New(); // Create a custom object
114 Material material = Material::DownCast(handle);
115 DALI_TEST_CHECK( !material );
119 int UtcDaliMaterialSetShader(void)
121 TestApplication application;
123 tet_infoline("Test SetShader(shader) ");
125 Shader shader1 = Shader::New( "vertexSrc1", "fragmentSrc1" );
126 shader1.RegisterProperty( "uFadeColor", Color::CYAN );
128 Shader shader2 = Shader::New( "vertexSrc1", "fragmentSrc1" );
129 shader2.RegisterProperty( "uFadeColor", Color::MAGENTA );
132 Material material = Material::New(shader1);
134 Geometry geometry = CreateQuadGeometry();
135 Renderer renderer = Renderer::New( geometry, material );
137 Actor actor = Actor::New();
138 actor.AddRenderer(renderer);
139 actor.SetSize(400, 400);
140 Stage::GetCurrent().Add(actor);
142 TestGlAbstraction& gl = application.GetGlAbstraction();
143 application.SendNotification();
144 application.Render(0);
145 Vector4 actualValue(Vector4::ZERO);
146 DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
147 DALI_TEST_EQUALS( actualValue, Color::CYAN, TEST_LOCATION );
150 material.SetShader( shader2 );
152 application.SendNotification();
153 application.Render(0);
154 DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
155 DALI_TEST_EQUALS( actualValue, Color::MAGENTA, TEST_LOCATION );
158 material.SetShader( shader1 );
160 application.SendNotification();
161 application.Render(0);
162 DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
163 DALI_TEST_EQUALS( actualValue, Color::CYAN, TEST_LOCATION );
168 int UtcDaliMaterialGetShader(void)
170 TestApplication application;
172 tet_infoline("Test GetShader() ");
174 Shader shader1 = Shader::New( "vertexSrc1", "fragmentSrc1" );
175 Shader shader2 = Shader::New( "vertexSrc1", "fragmentSrc1" );
178 Material material = Material::New(shader1);
179 DALI_TEST_EQUALS( shader1, material.GetShader(), TEST_LOCATION );
182 material.SetShader( shader2 );
183 DALI_TEST_EQUALS( shader2, material.GetShader(), TEST_LOCATION );
186 material.SetShader( shader1 );
187 DALI_TEST_EQUALS( shader1, material.GetShader(), TEST_LOCATION );
192 int UtcDaliMaterialGetNumberOfTextures(void)
194 TestApplication application;
196 tet_infoline("Test GetNumberOfTextures()");
198 Image image = BufferImage::New(32, 32, Pixel::RGBA8888);
199 Material material = CreateMaterial();
201 Geometry geometry = CreateQuadGeometry();
202 Renderer renderer = Renderer::New( geometry, material );
203 Actor actor = Actor::New();
204 actor.AddRenderer(renderer);
205 actor.SetParentOrigin( ParentOrigin::CENTER );
206 actor.SetSize(400, 400);
207 Stage::GetCurrent().Add( actor );
209 material.AddTexture( image, "sTexture0" );
210 material.AddTexture( image, "sTexture1" );
211 DALI_TEST_EQUALS( material.GetNumberOfTextures(), 2u, TEST_LOCATION );
213 material.AddTexture( image, "sTexture2" );
214 material.AddTexture( image, "sTexture3" );
215 material.AddTexture( image, "sTexture4" );
216 DALI_TEST_EQUALS( material.GetNumberOfTextures(), 5u, TEST_LOCATION );
218 material.RemoveTexture(3);
219 DALI_TEST_EQUALS( material.GetNumberOfTextures(), 4u, TEST_LOCATION );
221 material.RemoveTexture(3);
222 material.RemoveTexture(0);
223 DALI_TEST_EQUALS( material.GetNumberOfTextures(), 2u, TEST_LOCATION );
228 int UtcDaliMaterialSetFaceCullingMode(void)
230 TestApplication application;
232 tet_infoline("Test SetFaceCullingMode(cullingMode)");
233 Geometry geometry = CreateQuadGeometry();
234 Material material = CreateMaterial();
235 Renderer renderer = Renderer::New( geometry, material );
237 Actor actor = Actor::New();
238 actor.AddRenderer(renderer);
239 actor.SetSize(400, 400);
240 Stage::GetCurrent().Add(actor);
242 TestGlAbstraction& gl = application.GetGlAbstraction();
243 TraceCallStack& cullFaceStack = gl.GetCullFaceTrace();
244 gl.EnableCullFaceCallTrace(true);
247 cullFaceStack.Reset();
248 material.SetFaceCullingMode( Material::CULL_BACK_AND_FRONT );
249 application.SendNotification();
250 application.Render();
252 DALI_TEST_EQUALS( cullFaceStack.CountMethod( "CullFace" ), 1, TEST_LOCATION );
254 std::ostringstream cullModeString;
255 cullModeString << GL_FRONT_AND_BACK;
257 DALI_TEST_CHECK( cullFaceStack.FindMethodAndParams( "CullFace", cullModeString.str() ) );
261 cullFaceStack.Reset();
262 material.SetFaceCullingMode( Material::CULL_BACK );
263 application.SendNotification();
264 application.Render();
266 DALI_TEST_EQUALS( cullFaceStack.CountMethod( "CullFace" ), 1, TEST_LOCATION );
268 std::ostringstream cullModeString;
269 cullModeString << GL_BACK;
271 DALI_TEST_CHECK( cullFaceStack.FindMethodAndParams( "CullFace", cullModeString.str() ) );
275 cullFaceStack.Reset();
276 material.SetFaceCullingMode( Material::CULL_FRONT );
277 application.SendNotification();
278 application.Render();
280 DALI_TEST_EQUALS( cullFaceStack.CountMethod( "CullFace" ), 1, TEST_LOCATION );
282 std::ostringstream cullModeString;
283 cullModeString << GL_FRONT;
285 DALI_TEST_CHECK( cullFaceStack.FindMethodAndParams( "CullFace", cullModeString.str() ) );
289 cullFaceStack.Reset();
290 material.SetFaceCullingMode( Material::NONE );
291 application.SendNotification();
292 application.Render();
294 DALI_TEST_EQUALS( cullFaceStack.CountMethod( "CullFace" ), 0, TEST_LOCATION );
300 int UtcDaliMaterialBlendingOptions01(void)
302 TestApplication application;
304 tet_infoline("Test SetBlendFunc(src, dest) ");
306 Geometry geometry = CreateQuadGeometry();
307 Material material = CreateMaterial();
308 Renderer renderer = Renderer::New( geometry, material );
310 Actor actor = Actor::New();
311 // set a transparent actor color so that blending is enabled
312 actor.SetOpacity( 0.5f );
313 actor.AddRenderer(renderer);
314 actor.SetSize(400, 400);
315 Stage::GetCurrent().Add(actor);
317 material.SetBlendFunc(BlendingFactor::ONE_MINUS_SRC_COLOR, BlendingFactor::SRC_ALPHA_SATURATE);
319 // Test that Set was successful:
320 BlendingFactor::Type srcFactorRgb( BlendingFactor::ZERO );
321 BlendingFactor::Type destFactorRgb( BlendingFactor::ZERO );
322 BlendingFactor::Type srcFactorAlpha( BlendingFactor::ZERO );
323 BlendingFactor::Type destFactorAlpha( BlendingFactor::ZERO );
324 material.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
326 DALI_TEST_EQUALS( BlendingFactor::ONE_MINUS_SRC_COLOR, srcFactorRgb, TEST_LOCATION );
327 DALI_TEST_EQUALS( BlendingFactor::SRC_ALPHA_SATURATE, destFactorRgb, TEST_LOCATION );
328 DALI_TEST_EQUALS( BlendingFactor::ONE_MINUS_SRC_COLOR, srcFactorAlpha, TEST_LOCATION );
329 DALI_TEST_EQUALS( BlendingFactor::SRC_ALPHA_SATURATE, destFactorAlpha, TEST_LOCATION );
331 application.SendNotification();
332 application.Render();
334 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
336 DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_COLOR, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION );
337 DALI_TEST_EQUALS( (GLenum)GL_SRC_ALPHA_SATURATE, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION );
338 DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_COLOR, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION );
339 DALI_TEST_EQUALS( (GLenum)GL_SRC_ALPHA_SATURATE, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION );
344 int UtcDaliMaterialBlendingOptions02(void)
346 TestApplication application;
348 tet_infoline("Test SetBlendFunc(srcRgb, destRgb, srcAlpha, destAlpha) ");
350 Geometry geometry = CreateQuadGeometry();
351 Material material = CreateMaterial();
352 Renderer renderer = Renderer::New( geometry, material );
354 Actor actor = Actor::New();
355 actor.SetOpacity( 0.5f ); // enable blending
356 actor.AddRenderer(renderer);
357 actor.SetSize(400, 400);
358 Stage::GetCurrent().Add(actor);
360 material.SetBlendFunc( BlendingFactor::CONSTANT_COLOR, BlendingFactor::ONE_MINUS_CONSTANT_COLOR,
361 BlendingFactor::CONSTANT_ALPHA, BlendingFactor::ONE_MINUS_CONSTANT_ALPHA );
363 // Test that Set was successful:
365 BlendingFactor::Type srcFactorRgb( BlendingFactor::ZERO );
366 BlendingFactor::Type destFactorRgb( BlendingFactor::ZERO );
367 BlendingFactor::Type srcFactorAlpha( BlendingFactor::ZERO );
368 BlendingFactor::Type destFactorAlpha( BlendingFactor::ZERO );
369 material.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
371 DALI_TEST_EQUALS( BlendingFactor::CONSTANT_COLOR, srcFactorRgb, TEST_LOCATION );
372 DALI_TEST_EQUALS( BlendingFactor::ONE_MINUS_CONSTANT_COLOR, destFactorRgb, TEST_LOCATION );
373 DALI_TEST_EQUALS( BlendingFactor::CONSTANT_ALPHA, srcFactorAlpha, TEST_LOCATION );
374 DALI_TEST_EQUALS( BlendingFactor::ONE_MINUS_CONSTANT_ALPHA, destFactorAlpha, TEST_LOCATION );
377 application.SendNotification();
378 application.Render();
380 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
381 DALI_TEST_EQUALS( (GLenum)GL_CONSTANT_COLOR, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION );
382 DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_CONSTANT_COLOR, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION );
383 DALI_TEST_EQUALS( (GLenum)GL_CONSTANT_ALPHA, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION );
384 DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_CONSTANT_ALPHA, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION );
391 int UtcDaliMaterialBlendingOptions03(void)
393 TestApplication application;
395 tet_infoline("Test GetBlendEquation() defaults ");
397 Geometry geometry = CreateQuadGeometry();
398 Material material = CreateMaterial();
399 Renderer renderer = Renderer::New( geometry, material );
401 Actor actor = Actor::New();
402 actor.AddRenderer(renderer);
403 actor.SetSize(400, 400);
404 Stage::GetCurrent().Add(actor);
406 // Test the defaults as documented in blending.h
407 BlendingEquation::Type equationRgb( BlendingEquation::SUBTRACT );
408 BlendingEquation::Type equationAlpha( BlendingEquation::SUBTRACT );
409 material.GetBlendEquation( equationRgb, equationAlpha );
410 DALI_TEST_EQUALS( BlendingEquation::ADD, equationRgb, TEST_LOCATION );
411 DALI_TEST_EQUALS( BlendingEquation::ADD, equationAlpha, TEST_LOCATION );
417 int UtcDaliMaterialBlendingOptions04(void)
419 TestApplication application;
421 tet_infoline("Test SetBlendEquation() ");
423 Geometry geometry = CreateQuadGeometry();
424 Material material = CreateMaterial();
425 Renderer renderer = Renderer::New( geometry, material );
427 Actor actor = Actor::New();
428 actor.SetOpacity( 0.1f );
429 actor.AddRenderer(renderer);
430 actor.SetSize(400, 400);
431 Stage::GetCurrent().Add(actor);
433 // Test the single blending equation setting
435 material.SetBlendEquation( BlendingEquation::REVERSE_SUBTRACT );
436 BlendingEquation::Type equationRgba( BlendingEquation::SUBTRACT );
437 material.GetBlendEquation( equationRgba, equationRgba );
438 DALI_TEST_EQUALS( BlendingEquation::REVERSE_SUBTRACT, equationRgba, TEST_LOCATION );
441 material.SetBlendEquation( BlendingEquation::REVERSE_SUBTRACT, BlendingEquation::REVERSE_SUBTRACT );
443 // Test that Set was successful
445 BlendingEquation::Type equationRgb( BlendingEquation::SUBTRACT );
446 BlendingEquation::Type equationAlpha( BlendingEquation::SUBTRACT );
447 material.GetBlendEquation( equationRgb, equationAlpha );
448 DALI_TEST_EQUALS( BlendingEquation::REVERSE_SUBTRACT, equationRgb, TEST_LOCATION );
449 DALI_TEST_EQUALS( BlendingEquation::REVERSE_SUBTRACT, equationAlpha, TEST_LOCATION );
452 // Render & check GL commands
453 application.SendNotification();
454 application.Render();
456 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
457 DALI_TEST_EQUALS( (GLenum)GL_FUNC_REVERSE_SUBTRACT, glAbstraction.GetLastBlendEquationRgb(), TEST_LOCATION );
458 DALI_TEST_EQUALS( (GLenum)GL_FUNC_REVERSE_SUBTRACT, glAbstraction.GetLastBlendEquationAlpha(), TEST_LOCATION );
463 int UtcDaliMaterialSetBlendMode01(void)
465 TestApplication application;
467 tet_infoline("Test setting the blend mode to on with an opaque color renders with blending enabled");
469 Geometry geometry = CreateQuadGeometry();
470 Material material = CreateMaterial();
471 Renderer renderer = Renderer::New( geometry, material );
473 Actor actor = Actor::New();
474 actor.SetOpacity( 0.98f );
475 actor.AddRenderer(renderer);
476 actor.SetSize(400, 400);
477 Stage::GetCurrent().Add(actor);
479 material.SetBlendMode(BlendingMode::ON);
481 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
482 glAbstraction.EnableEnableDisableCallTrace(true);
484 application.SendNotification();
485 application.Render();
487 TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
488 std::ostringstream blendStr;
489 blendStr << GL_BLEND;
490 DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
496 int UtcDaliMaterialSetBlendMode02(void)
498 TestApplication application;
500 tet_infoline("Test setting the blend mode to off with a transparent color renders with blending disabled (and not enabled)");
502 Geometry geometry = CreateQuadGeometry();
503 Material material = CreateMaterial();
504 Renderer renderer = Renderer::New( geometry, material );
506 Actor actor = Actor::New();
507 actor.SetOpacity( 0.15f );
508 actor.AddRenderer(renderer);
509 actor.SetSize(400, 400);
510 Stage::GetCurrent().Add(actor);
512 material.SetBlendMode(BlendingMode::OFF);
514 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
515 glAbstraction.EnableEnableDisableCallTrace(true);
517 application.SendNotification();
518 application.Render();
520 TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
521 std::ostringstream blendStr;
522 blendStr << GL_BLEND;
523 DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
528 int UtcDaliMaterialSetBlendMode03(void)
530 TestApplication application;
532 tet_infoline("Test setting the blend mode to auto with a transparent material color renders with blending enabled");
534 Geometry geometry = CreateQuadGeometry();
535 Material material = CreateMaterial();
536 Renderer renderer = Renderer::New( geometry, material );
538 Actor actor = Actor::New();
539 actor.SetOpacity( 0.75f );
540 actor.AddRenderer(renderer);
541 actor.SetSize(400, 400);
542 Stage::GetCurrent().Add(actor);
544 material.SetBlendMode(BlendingMode::AUTO);
546 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
547 glAbstraction.EnableEnableDisableCallTrace(true);
549 application.SendNotification();
550 application.Render();
552 TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
553 std::ostringstream blendStr;
554 blendStr << GL_BLEND;
555 DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
560 int UtcDaliMaterialSetBlendMode04(void)
562 TestApplication application;
564 tet_infoline("Test setting the blend mode to auto with an opaque color renders with blending disabled");
566 Geometry geometry = CreateQuadGeometry();
567 Material material = CreateMaterial();
568 Renderer renderer = Renderer::New( geometry, material );
570 Actor actor = Actor::New();
571 actor.AddRenderer(renderer);
572 actor.SetSize(400, 400);
573 Stage::GetCurrent().Add(actor);
575 material.SetBlendMode(BlendingMode::AUTO);
577 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
578 glAbstraction.EnableEnableDisableCallTrace(true);
580 application.SendNotification();
581 application.Render();
583 TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
584 std::ostringstream blendStr;
585 blendStr << GL_BLEND;
586 DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
591 int UtcDaliMaterialSetBlendMode04b(void)
593 TestApplication application;
595 tet_infoline("Test setting the blend mode to auto with an opaque material color and a transparent actor color renders with blending enabled");
597 Geometry geometry = CreateQuadGeometry();
598 Material material = CreateMaterial();
599 Renderer renderer = Renderer::New( geometry, material );
601 Actor actor = Actor::New();
602 actor.AddRenderer(renderer);
603 actor.SetSize(400, 400);
604 actor.SetColor( Vector4(1.0f, 0.0f, 1.0f, 0.5f) );
605 Stage::GetCurrent().Add(actor);
607 material.SetBlendMode(BlendingMode::AUTO);
609 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
610 glAbstraction.EnableEnableDisableCallTrace(true);
612 application.SendNotification();
613 application.Render();
615 TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
616 std::ostringstream blendStr;
617 blendStr << GL_BLEND;
618 DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
623 int UtcDaliMaterialSetBlendMode04c(void)
625 TestApplication application;
627 tet_infoline("Test setting the blend mode to auto with an opaque material color and an opaque actor color renders with blending disabled");
629 Geometry geometry = CreateQuadGeometry();
630 Material material = CreateMaterial();
631 Renderer renderer = Renderer::New( geometry, material );
633 Actor actor = Actor::New();
634 actor.AddRenderer(renderer);
635 actor.SetSize(400, 400);
636 actor.SetColor( Color::MAGENTA );
637 Stage::GetCurrent().Add(actor);
639 material.SetBlendMode(BlendingMode::AUTO);
641 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
642 glAbstraction.EnableEnableDisableCallTrace(true);
644 application.SendNotification();
645 application.Render();
647 TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
648 std::ostringstream blendStr;
649 blendStr << GL_BLEND;
650 DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
655 int UtcDaliMaterialSetBlendMode05(void)
657 TestApplication application;
659 tet_infoline("Test setting the blend mode to auto with an opaque color and an image with an alpha channel renders with blending enabled");
661 Geometry geometry = CreateQuadGeometry();
662 BufferImage image = BufferImage::New( 40, 40, Pixel::RGBA8888 );
663 Material material = CreateMaterial( image );
664 Renderer renderer = Renderer::New( geometry, material );
666 Actor actor = Actor::New();
667 actor.AddRenderer(renderer);
668 actor.SetSize(400, 400);
669 Stage::GetCurrent().Add(actor);
671 material.SetBlendMode(BlendingMode::AUTO);
673 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
674 glAbstraction.EnableEnableDisableCallTrace(true);
676 application.SendNotification();
677 application.Render();
679 TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
680 std::ostringstream blendStr;
681 blendStr << GL_BLEND;
682 DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
687 int UtcDaliMaterialSetBlendMode06(void)
689 TestApplication application;
690 tet_infoline("Test setting the blend mode to auto with an opaque color and an image without an alpha channel and a shader with the hint OUTPUT_IS_TRANSPARENT renders with blending enabled");
692 Geometry geometry = CreateQuadGeometry();
693 Shader shader = Shader::New( "vertexSrc", "fragmentSrc", Shader::HINT_OUTPUT_IS_TRANSPARENT );
694 Material material = Material::New(shader);
696 Renderer renderer = Renderer::New( geometry, material );
698 Actor actor = Actor::New();
699 actor.AddRenderer(renderer);
700 actor.SetSize(400, 400);
701 Stage::GetCurrent().Add(actor);
703 material.SetBlendMode(BlendingMode::AUTO);
705 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
706 glAbstraction.EnableEnableDisableCallTrace(true);
708 application.SendNotification();
709 application.Render();
711 TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
712 std::ostringstream blendStr;
713 blendStr << GL_BLEND;
714 DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
720 //Todo: test the Shader::HINT_OUTPUT_IS_OPAQUE would disable the blending, the test cannot pass with current implementation
721 /*int UtcDaliMaterialSetBlendMode07(void)
723 TestApplication application;
724 tet_infoline("Test setting the blend mode to auto with a transparent color and an image without an alpha channel and a shader with the hint OUTPUT_IS_OPAQUE renders with blending disabled");
725 Geometry geometry = CreateQuadGeometry();
726 Shader shader = Shader::New( "vertexSrc", "fragmentSrc", Shader::HINT_OUTPUT_IS_OPAQUE );
727 Material material = Material::New(shader);
729 Renderer renderer = Renderer::New( geometry, material );
731 Actor actor = Actor::New();
732 actor.AddRenderer(renderer);
733 actor.SetSize(400, 400);
734 Stage::GetCurrent().Add(actor);
736 material.SetBlendMode(BlendingMode::AUTO);
738 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
739 glAbstraction.EnableEnableDisableCallTrace(true);
741 application.SendNotification();
742 application.Render();
744 TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
745 std::ostringstream blendStr;
746 blendStr << GL_BLEND;
747 DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
752 int UtcDaliMaterialSetBlendMode08(void)
754 TestApplication application;
755 tet_infoline("Test setting the blend mode to auto with an opaque color and an image without an alpha channel and a shader with the hint OUTPUT_IS_OPAQUE renders with blending disabled");
757 Geometry geometry = CreateQuadGeometry();
758 Shader shader = Shader::New( "vertexSrc", "fragmentSrc", Shader::HINT_OUTPUT_IS_OPAQUE );
759 Material material = Material::New(shader);
760 BufferImage image = BufferImage::New( 50, 50, Pixel::RGB888 );
761 material.AddTexture( image, "sTexture" );
762 Renderer renderer = Renderer::New( geometry, material );
764 Actor actor = Actor::New();
765 actor.AddRenderer(renderer);
766 actor.SetSize(400, 400);
767 Stage::GetCurrent().Add(actor);
769 material.SetBlendMode(BlendingMode::AUTO);
771 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
772 glAbstraction.EnableEnableDisableCallTrace(true);
774 application.SendNotification();
775 application.Render();
777 TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
778 DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", "GL_BLEND" ) );
783 int UtcDaliMaterialGetBlendMode(void)
785 TestApplication application;
787 tet_infoline("Test GetBlendMode()");
789 Shader shader = Shader::New( "vertexSrc", "fragmentSrc", Shader::HINT_OUTPUT_IS_OPAQUE );
790 Material material = Material::New(shader);
793 DALI_TEST_EQUALS( material.GetBlendMode(), BlendingMode::AUTO, TEST_LOCATION );
796 material.SetBlendMode(BlendingMode::ON);
797 DALI_TEST_EQUALS( material.GetBlendMode(), BlendingMode::ON, TEST_LOCATION );
800 material.SetBlendMode(BlendingMode::OFF);
801 DALI_TEST_EQUALS( material.GetBlendMode(), BlendingMode::OFF, TEST_LOCATION );
806 int UtcDaliMaterialSetBlendColor(void)
808 TestApplication application;
810 tet_infoline("Test SetBlendColor(color)");
812 Geometry geometry = CreateQuadGeometry();
813 Shader shader = Shader::New( "vertexSrc", "fragmentSrc", Shader::HINT_OUTPUT_IS_OPAQUE );
814 Material material = Material::New(shader);
815 BufferImage image = BufferImage::New( 50, 50, Pixel::RGBA8888 );
816 material.AddTexture( image, "sTexture" );
817 Renderer renderer = Renderer::New( geometry, material );
819 Actor actor = Actor::New();
820 actor.AddRenderer(renderer);
821 actor.SetSize(400, 400);
822 Stage::GetCurrent().Add(actor);
824 TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
826 material.SetBlendColor( Color::TRANSPARENT );
827 application.SendNotification();
828 application.Render();
829 DALI_TEST_EQUALS( glAbstraction.GetLastBlendColor(), Color::TRANSPARENT, TEST_LOCATION );
831 material.SetBlendColor( Color::MAGENTA );
832 application.SendNotification();
833 application.Render();
834 DALI_TEST_EQUALS( glAbstraction.GetLastBlendColor(), Color::MAGENTA, TEST_LOCATION );
836 Vector4 color( 0.1f, 0.2f, 0.3f, 0.4f );
837 material.SetBlendColor( color );
838 application.SendNotification();
839 application.Render();
840 DALI_TEST_EQUALS( glAbstraction.GetLastBlendColor(), color, TEST_LOCATION );
845 int UtcDaliMaterialGetBlendColor(void)
847 TestApplication application;
849 tet_infoline("Test GetBlendColor()");
851 Shader shader = Shader::New( "vertexSrc", "fragmentSrc", Shader::HINT_OUTPUT_IS_OPAQUE );
852 Material material = Material::New(shader);
854 DALI_TEST_EQUALS( material.GetBlendColor(), Color::TRANSPARENT, TEST_LOCATION );
856 material.SetBlendColor( Color::MAGENTA );
857 application.SendNotification();
858 application.Render();
859 DALI_TEST_EQUALS( material.GetBlendColor(), Color::MAGENTA, TEST_LOCATION );
861 Vector4 color( 0.1f, 0.2f, 0.3f, 0.4f );
862 material.SetBlendColor( color );
863 application.SendNotification();
864 application.Render();
865 DALI_TEST_EQUALS( material.GetBlendColor(), color, TEST_LOCATION );
870 int UtcDaliMaterialConstraint(void)
872 TestApplication application;
874 tet_infoline("Test that a custom material property can be constrained");
876 Shader shader = Shader::New( "VertexSource", "FragmentSource");
877 Material material = Material::New( shader );
879 Geometry geometry = CreateQuadGeometry();
880 Renderer renderer = Renderer::New( geometry, material );
882 Actor actor = Actor::New();
883 actor.AddRenderer(renderer);
884 actor.SetSize(400, 400);
885 Stage::GetCurrent().Add(actor);
887 Vector4 initialColor = Color::WHITE;
888 Property::Index colorIndex = material.RegisterProperty( "uFadeColor", initialColor );
890 application.SendNotification();
891 application.Render(0);
892 DALI_TEST_EQUALS( material.GetProperty<Vector4>(colorIndex), initialColor, TEST_LOCATION );
895 Constraint constraint = Constraint::New<Vector4>( material, colorIndex, TestConstraintNoBlue );
897 application.SendNotification();
898 application.Render(0);
900 // Expect no blue component in either buffer - yellow
901 DALI_TEST_EQUALS( material.GetProperty<Vector4>(colorIndex), Color::YELLOW, TEST_LOCATION );
902 application.Render(0);
903 DALI_TEST_EQUALS( material.GetProperty<Vector4>(colorIndex), Color::YELLOW, TEST_LOCATION );
905 material.RemoveConstraints();
906 material.SetProperty(colorIndex, Color::WHITE );
907 application.SendNotification();
908 application.Render(0);
909 DALI_TEST_EQUALS( material.GetProperty<Vector4>(colorIndex), Color::WHITE, TEST_LOCATION );
914 int UtcDaliMaterialConstraint02(void)
916 TestApplication application;
918 tet_infoline("Test that a uniform map material property can be constrained");
920 Shader shader = Shader::New( "VertexSource", "FragmentSource");
921 Material material = Material::New( shader );
923 Geometry geometry = CreateQuadGeometry();
924 Renderer renderer = Renderer::New( geometry, material );
926 Actor actor = Actor::New();
927 actor.AddRenderer(renderer);
928 actor.SetSize(400, 400);
929 Stage::GetCurrent().Add(actor);
930 application.SendNotification();
931 application.Render(0);
933 Vector4 initialColor = Color::WHITE;
934 Property::Index colorIndex = material.RegisterProperty( "uFadeColor", initialColor );
936 TestGlAbstraction& gl = application.GetGlAbstraction();
938 application.SendNotification();
939 application.Render(0);
941 Vector4 actualValue(Vector4::ZERO);
942 DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
943 DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION );
946 Constraint constraint = Constraint::New<Vector4>( material, colorIndex, TestConstraintNoBlue );
948 application.SendNotification();
949 application.Render(0);
951 // Expect no blue component in either buffer - yellow
952 DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
953 DALI_TEST_EQUALS( actualValue, Color::YELLOW, TEST_LOCATION );
955 application.Render(0);
956 DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
957 DALI_TEST_EQUALS( actualValue, Color::YELLOW, TEST_LOCATION );
959 material.RemoveConstraints();
960 material.SetProperty(colorIndex, Color::WHITE );
961 application.SendNotification();
962 application.Render(0);
964 DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
965 DALI_TEST_EQUALS( actualValue, Color::WHITE, TEST_LOCATION );
970 int UtcDaliMaterialAnimatedProperty01(void)
972 TestApplication application;
974 tet_infoline("Test that a non-uniform material property can be animated");
976 Shader shader = Shader::New( "VertexSource", "FragmentSource");
977 Material material = Material::New( shader );
979 Geometry geometry = CreateQuadGeometry();
980 Renderer renderer = Renderer::New( geometry, material );
982 Actor actor = Actor::New();
983 actor.AddRenderer(renderer);
984 actor.SetSize(400, 400);
985 Stage::GetCurrent().Add(actor);
987 Vector4 initialColor = Color::WHITE;
988 Property::Index colorIndex = material.RegisterProperty( "uFadeColor", initialColor );
990 application.SendNotification();
991 application.Render(0);
992 DALI_TEST_EQUALS( material.GetProperty<Vector4>(colorIndex), initialColor, TEST_LOCATION );
994 Animation animation = Animation::New(1.0f);
995 KeyFrames keyFrames = KeyFrames::New();
996 keyFrames.Add(0.0f, initialColor);
997 keyFrames.Add(1.0f, Color::TRANSPARENT);
998 animation.AnimateBetween( Property( material, colorIndex ), keyFrames );
1001 application.SendNotification();
1002 application.Render(500);
1004 DALI_TEST_EQUALS( material.GetProperty<Vector4>(colorIndex), Color::WHITE * 0.5f, TEST_LOCATION );
1006 application.Render(500);
1008 DALI_TEST_EQUALS( material.GetProperty<Vector4>(colorIndex), Color::TRANSPARENT, TEST_LOCATION );
1013 int UtcDaliMaterialAnimatedProperty02(void)
1015 TestApplication application;
1017 tet_infoline("Test that a uniform map material property can be animated");
1019 Shader shader = Shader::New( "VertexSource", "FragmentSource");
1020 Material material = Material::New( shader );
1022 Geometry geometry = CreateQuadGeometry();
1023 Renderer renderer = Renderer::New( geometry, material );
1025 Actor actor = Actor::New();
1026 actor.AddRenderer(renderer);
1027 actor.SetSize(400, 400);
1028 Stage::GetCurrent().Add(actor);
1029 application.SendNotification();
1030 application.Render(0);
1032 Vector4 initialColor = Color::WHITE;
1033 Property::Index colorIndex = material.RegisterProperty( "uFadeColor", initialColor );
1035 TestGlAbstraction& gl = application.GetGlAbstraction();
1037 application.SendNotification();
1038 application.Render(0);
1040 Vector4 actualValue(Vector4::ZERO);
1041 DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
1042 DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION );
1044 Animation animation = Animation::New(1.0f);
1045 KeyFrames keyFrames = KeyFrames::New();
1046 keyFrames.Add(0.0f, initialColor);
1047 keyFrames.Add(1.0f, Color::TRANSPARENT);
1048 animation.AnimateBetween( Property( material, colorIndex ), keyFrames );
1051 application.SendNotification();
1052 application.Render(500);
1054 DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
1055 DALI_TEST_EQUALS( actualValue, Color::WHITE * 0.5f, TEST_LOCATION );
1057 application.Render(500);
1058 DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
1059 DALI_TEST_EQUALS( actualValue, Color::TRANSPARENT, TEST_LOCATION );
1065 int UtcDaliMaterialSetTextureUniformName01(void)
1067 TestApplication application;
1069 Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
1071 Material material = CreateMaterial();
1072 material.AddTexture( image, "sTexture" );
1074 int textureIndex = material.GetTextureIndex( "sTexture" );
1075 DALI_TEST_EQUALS( textureIndex, 0, TEST_LOCATION );
1077 material.SetTextureUniformName( 0, "sEffectTexture" );
1078 textureIndex = material.GetTextureIndex( "sEffectTexture" );
1079 DALI_TEST_EQUALS( textureIndex, 0, TEST_LOCATION );
1081 Geometry geometry = CreateQuadGeometry();
1082 Renderer renderer = Renderer::New( geometry, material );
1083 Actor actor = Actor::New();
1084 actor.AddRenderer(renderer);
1085 actor.SetParentOrigin( ParentOrigin::CENTER );
1086 actor.SetSize(400, 400);
1088 Stage::GetCurrent().Add( actor );
1090 TestGlAbstraction& gl = application.GetGlAbstraction();
1092 application.SendNotification();
1093 application.Render();
1096 DALI_TEST_CHECK( gl.GetUniformValue<int>( "sEffectTexture", textureUnit ) );
1097 DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
1102 int UtcDaliMaterialSetTextureUniformName02(void)
1104 TestApplication application;
1106 Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
1107 Image image2 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
1109 Material material = CreateMaterial();
1110 material.AddTexture( image, "sTexture");
1111 material.SetTextureUniformName( 0, "sEffectTexture" );
1112 material.AddTexture( image2, "sTexture2");
1114 int textureIndex = material.GetTextureIndex( "sEffectTexture" );
1115 DALI_TEST_EQUALS( textureIndex, 0, TEST_LOCATION );
1117 textureIndex = material.GetTextureIndex( "sTexture2" );
1118 DALI_TEST_EQUALS( textureIndex, 1, TEST_LOCATION );
1120 Geometry geometry = CreateQuadGeometry();
1121 Renderer renderer = Renderer::New( geometry, material );
1122 Actor actor = Actor::New();
1123 actor.AddRenderer(renderer);
1124 actor.SetParentOrigin( ParentOrigin::CENTER );
1125 actor.SetSize(400, 400);
1127 Stage::GetCurrent().Add( actor );
1129 TestGlAbstraction& gl = application.GetGlAbstraction();
1131 application.SendNotification();
1132 application.Render();
1135 DALI_TEST_CHECK( gl.GetUniformValue<int>( "sEffectTexture", textureUnit ) );
1136 DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
1138 DALI_TEST_CHECK( gl.GetUniformValue<int>( "sTexture2", textureUnit ) );
1139 DALI_TEST_EQUALS( textureUnit, 1, TEST_LOCATION );
1144 int UtcDaliMaterialAddTexture01(void)
1146 TestApplication application;
1148 Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
1150 Material material = CreateMaterial();
1151 material.AddTexture( image, "sTexture");
1153 Geometry geometry = CreateQuadGeometry();
1154 Renderer renderer = Renderer::New( geometry, material );
1155 Actor actor = Actor::New();
1156 actor.AddRenderer(renderer);
1157 actor.SetParentOrigin( ParentOrigin::CENTER );
1158 actor.SetSize(400, 400);
1160 Stage::GetCurrent().Add( actor );
1162 TestGlAbstraction& gl = application.GetGlAbstraction();
1164 TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
1165 texParameterTrace.Reset();
1166 texParameterTrace.Enable( true );
1167 application.SendNotification();
1168 application.Render();
1171 DALI_TEST_CHECK( gl.GetUniformValue<int>( "sTexture", textureUnit ) );
1172 DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
1174 texParameterTrace.Enable( false );
1177 // There are three calls to TexParameteri when the texture is first created
1178 // as the texture is using default sampling parametrers there shouldn't be any more calls to TexParameteri
1179 DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 3, TEST_LOCATION);
1184 int UtcDaliMaterialAddTexture02(void)
1186 TestApplication application;
1188 Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
1190 Material material = CreateMaterial();
1192 Sampler sampler = Sampler::New();
1193 sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST );
1194 material.AddTexture( image, "sTexture", sampler );
1196 Geometry geometry = CreateQuadGeometry();
1197 Renderer renderer = Renderer::New( geometry, material );
1198 Actor actor = Actor::New();
1199 actor.AddRenderer(renderer);
1200 actor.SetParentOrigin( ParentOrigin::CENTER );
1201 actor.SetSize(400, 400);
1203 Stage::GetCurrent().Add( actor );
1205 TestGlAbstraction& gl = application.GetGlAbstraction();
1207 TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
1208 texParameterTrace.Reset();
1209 texParameterTrace.Enable( true );
1210 application.SendNotification();
1211 application.Render();
1214 DALI_TEST_CHECK( gl.GetUniformValue<int>( "sTexture", textureUnit ) );
1215 DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
1217 texParameterTrace.Enable( false );
1220 // There are three calls to TexParameteri when the texture is first created
1221 // Texture minification and magnification filters are now different than default so
1222 //there should have been two extra TexParameteri calls to set the new filter mode
1223 DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 4, TEST_LOCATION);
1228 int UtcDaliMaterialRemoveTexture(void)
1230 TestApplication application;
1232 Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
1234 Material material = CreateMaterial();
1235 material.RemoveTexture(0);
1236 DALI_TEST_EQUALS( material.GetNumberOfTextures(), 0, TEST_LOCATION );
1238 material.RemoveTexture(1);
1239 DALI_TEST_EQUALS( material.GetNumberOfTextures(), 0, TEST_LOCATION );
1241 Sampler sampler = Sampler::New();
1242 sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST );
1243 material.AddTexture( image, "sTexture", sampler );
1244 DALI_TEST_EQUALS( material.GetNumberOfTextures(), 1, TEST_LOCATION );
1246 material.RemoveTexture(1);
1247 DALI_TEST_EQUALS( material.GetNumberOfTextures(), 1, TEST_LOCATION );
1249 material.RemoveTexture(0);
1250 DALI_TEST_EQUALS( material.GetNumberOfTextures(), 0, TEST_LOCATION );
1255 int UtcDaliMaterialSetSampler(void)
1257 TestApplication application;
1259 Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
1261 Material material = CreateMaterial();
1262 material.AddTexture( image, "sTexture");
1264 Geometry geometry = CreateQuadGeometry();
1265 Renderer renderer = Renderer::New( geometry, material );
1266 Actor actor = Actor::New();
1267 actor.AddRenderer(renderer);
1268 actor.SetParentOrigin( ParentOrigin::CENTER );
1269 actor.SetSize(400, 400);
1271 Stage::GetCurrent().Add( actor );
1273 TestGlAbstraction& gl = application.GetGlAbstraction();
1275 TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
1276 texParameterTrace.Reset();
1277 texParameterTrace.Enable( true );
1278 application.SendNotification();
1279 application.Render();
1282 DALI_TEST_CHECK( gl.GetUniformValue<int>( "sTexture", textureUnit ) );
1283 DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
1285 texParameterTrace.Enable( false );
1288 // There are three calls to TexParameteri when the texture is first created
1289 // as the texture is using default sampling parametrers there shouldn't be any more calls to TexParameteri
1290 DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 3, TEST_LOCATION);
1292 texParameterTrace.Reset();
1293 texParameterTrace.Enable( true );
1295 Sampler sampler = Sampler::New();
1296 sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST );
1297 material.SetTextureSampler(0, sampler );
1300 application.SendNotification();
1301 application.Render();
1303 texParameterTrace.Enable( false );
1306 //There should have been two calls to TexParameteri to set the new filtering mode
1307 DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 2, TEST_LOCATION);
1313 int UtcDaliMaterialGetTextureIndex(void)
1315 TestApplication application;
1317 Image image0 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
1318 Image image1 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
1319 Image image2 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
1320 Image image3 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
1323 Material material = CreateMaterial();
1324 material.AddTexture( image0, "sTexture0");
1325 material.AddTexture( image1, "sTexture1");
1326 material.AddTexture( image2, "sTexture2");
1327 material.AddTexture( image3, "sTexture3");
1329 int textureIndex = material.GetTextureIndex( "sTexture0" );
1330 DALI_TEST_EQUALS( textureIndex, 0, TEST_LOCATION );
1332 textureIndex = material.GetTextureIndex( "sTexture1" );
1333 DALI_TEST_EQUALS( textureIndex, 1, TEST_LOCATION );
1335 textureIndex = material.GetTextureIndex( "sTexture2" );
1336 DALI_TEST_EQUALS( textureIndex, 2, TEST_LOCATION );
1338 textureIndex = material.GetTextureIndex( "sTexture3" );
1339 DALI_TEST_EQUALS( textureIndex, 3, TEST_LOCATION );
1341 material.RemoveTexture(1);
1343 textureIndex = material.GetTextureIndex( "sTexture0" );
1344 DALI_TEST_EQUALS( textureIndex, 0, TEST_LOCATION );
1346 textureIndex = material.GetTextureIndex( "sTexture2" );
1347 DALI_TEST_EQUALS( textureIndex, 1, TEST_LOCATION );
1349 textureIndex = material.GetTextureIndex( "sTexture3" );
1350 DALI_TEST_EQUALS( textureIndex, 2, TEST_LOCATION );