Dali 3D User Interface Engine
utc-Dali-Material.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17 
19 #include <dali-test-suite-utils.h>
20 
21 using namespace Dali;
22 
23 #include <mesh-builder.h>
24 
25 namespace
26 {
27 void TestConstraintNoBlue( Vector4& current, const PropertyInputContainer& inputs )
28 {
29  current.b = 0.0f;
30 }
31 }
32 
33 
35 {
37 }
38 
40 {
42 }
43 
45 {
46  TestApplication application;
47 
48  Shader shader = Shader::New("vertexSrc", "fragmentSrc");
49  Material material = Material::New(shader);
50 
51  DALI_TEST_CHECK( material );
52  END_TEST;
53 }
54 
56 {
57  TestApplication application;
58  Material material;
59  DALI_TEST_CHECK( !material );
60  END_TEST;
61 }
62 
64 {
65  TestApplication application;
66 
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" );
71 
72  Material materialCopy(material);
73 
74  DALI_TEST_CHECK( materialCopy );
75 
76  END_TEST;
77 }
78 
80 {
81  TestApplication application;
82 
83  Shader shader = Shader::New("vertexSrc", "fragmentSrc");
84  Image image = BufferImage::New(32, 32, Pixel::RGBA8888);
85  Material material = Material::New(shader);
86 
87  Material material2;
88  DALI_TEST_CHECK( !material2 );
89 
90  material2 = material;
91  DALI_TEST_CHECK( material2 );
92 
93  END_TEST;
94 }
95 
97 {
98  TestApplication application;
99  Shader shader = Shader::New("vertexSrc", "fragmentSrc");
100  Material material = Material::New(shader);
101 
102  BaseHandle handle(material);
103  Material material2 = Material::DownCast(handle);
104  DALI_TEST_CHECK( material2 );
105 
106  END_TEST;
107 }
108 
110 {
111  TestApplication application;
112 
113  Handle handle = Handle::New(); // Create a custom object
114  Material material = Material::DownCast(handle);
115  DALI_TEST_CHECK( !material );
116  END_TEST;
117 }
118 
120 {
121  TestApplication application;
122 
123  tet_infoline("Test SetShader(shader) ");
124 
125  Shader shader1 = Shader::New( "vertexSrc1", "fragmentSrc1" );
126  shader1.RegisterProperty( "uFadeColor", Color::CYAN );
127 
128  Shader shader2 = Shader::New( "vertexSrc1", "fragmentSrc1" );
129  shader2.RegisterProperty( "uFadeColor", Color::MAGENTA );
130 
131  // shader1
132  Material material = Material::New(shader1);
133 
134  Geometry geometry = CreateQuadGeometry();
135  Renderer renderer = Renderer::New( geometry, material );
136 
137  Actor actor = Actor::New();
138  actor.AddRenderer(renderer);
139  actor.SetSize(400, 400);
140  Stage::GetCurrent().Add(actor);
141 
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 );
148 
149  // shader2
150  material.SetShader( shader2 );
151 
152  application.SendNotification();
153  application.Render(0);
154  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
156 
157  // shader1
158  material.SetShader( shader1 );
159 
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 );
164 
165  END_TEST;
166 }
167 
169 {
170  TestApplication application;
171 
172  tet_infoline("Test GetShader() ");
173 
174  Shader shader1 = Shader::New( "vertexSrc1", "fragmentSrc1" );
175  Shader shader2 = Shader::New( "vertexSrc1", "fragmentSrc1" );
176 
177  // shader1
178  Material material = Material::New(shader1);
179  DALI_TEST_EQUALS( shader1, material.GetShader(), TEST_LOCATION );
180 
181  // shader2
182  material.SetShader( shader2 );
183  DALI_TEST_EQUALS( shader2, material.GetShader(), TEST_LOCATION );
184 
185  // shader1
186  material.SetShader( shader1 );
187  DALI_TEST_EQUALS( shader1, material.GetShader(), TEST_LOCATION );
188 
189  END_TEST;
190 }
191 
193 {
194  TestApplication application;
195 
196  tet_infoline("Test GetNumberOfTextures()");
197 
198  Image image = BufferImage::New(32, 32, Pixel::RGBA8888);
199  Material material = CreateMaterial();
200 
201  Geometry geometry = CreateQuadGeometry();
202  Renderer renderer = Renderer::New( geometry, material );
203  Actor actor = Actor::New();
204  actor.AddRenderer(renderer);
206  actor.SetSize(400, 400);
207  Stage::GetCurrent().Add( actor );
208 
209  material.AddTexture( image, "sTexture0" );
210  material.AddTexture( image, "sTexture1" );
212 
213  material.AddTexture( image, "sTexture2" );
214  material.AddTexture( image, "sTexture3" );
215  material.AddTexture( image, "sTexture4" );
217 
218  material.RemoveTexture(3);
220 
221  material.RemoveTexture(3);
222  material.RemoveTexture(0);
224 
225  END_TEST;
226 }
227 
229 {
230  TestApplication application;
231 
232  tet_infoline("Test that a custom material property can be constrained");
233 
234  Shader shader = Shader::New( "VertexSource", "FragmentSource");
235  Material material = Material::New( shader );
236 
237  Geometry geometry = CreateQuadGeometry();
238  Renderer renderer = Renderer::New( geometry, material );
239 
240  Actor actor = Actor::New();
241  actor.AddRenderer(renderer);
242  actor.SetSize(400, 400);
243  Stage::GetCurrent().Add(actor);
244 
245  Vector4 initialColor = Color::WHITE;
246  Property::Index colorIndex = material.RegisterProperty( "uFadeColor", initialColor );
247 
248  application.SendNotification();
249  application.Render(0);
250  DALI_TEST_EQUALS( material.GetProperty<Vector4>(colorIndex), initialColor, TEST_LOCATION );
251 
252  // Apply constraint
253  Constraint constraint = Constraint::New<Vector4>( material, colorIndex, TestConstraintNoBlue );
254  constraint.Apply();
255  application.SendNotification();
256  application.Render(0);
257 
258  // Expect no blue component in either buffer - yellow
259  DALI_TEST_EQUALS( material.GetProperty<Vector4>(colorIndex), Color::YELLOW, TEST_LOCATION );
260  application.Render(0);
261  DALI_TEST_EQUALS( material.GetProperty<Vector4>(colorIndex), Color::YELLOW, TEST_LOCATION );
262 
263  material.RemoveConstraints();
264  material.SetProperty(colorIndex, Color::WHITE );
265  application.SendNotification();
266  application.Render(0);
267  DALI_TEST_EQUALS( material.GetProperty<Vector4>(colorIndex), Color::WHITE, TEST_LOCATION );
268 
269  END_TEST;
270 }
271 
273 {
274  TestApplication application;
275 
276  tet_infoline("Test that a uniform map material property can be constrained");
277 
278  Shader shader = Shader::New( "VertexSource", "FragmentSource");
279  Material material = Material::New( shader );
280 
281  Geometry geometry = CreateQuadGeometry();
282  Renderer renderer = Renderer::New( geometry, material );
283 
284  Actor actor = Actor::New();
285  actor.AddRenderer(renderer);
286  actor.SetSize(400, 400);
287  Stage::GetCurrent().Add(actor);
288  application.SendNotification();
289  application.Render(0);
290 
291  Vector4 initialColor = Color::WHITE;
292  Property::Index colorIndex = material.RegisterProperty( "uFadeColor", initialColor );
293 
294  TestGlAbstraction& gl = application.GetGlAbstraction();
295 
296  application.SendNotification();
297  application.Render(0);
298 
299  Vector4 actualValue(Vector4::ZERO);
300  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
301  DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION );
302 
303  // Apply constraint
304  Constraint constraint = Constraint::New<Vector4>( material, colorIndex, TestConstraintNoBlue );
305  constraint.Apply();
306  application.SendNotification();
307  application.Render(0);
308 
309  // Expect no blue component in either buffer - yellow
310  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
312 
313  application.Render(0);
314  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
316 
317  material.RemoveConstraints();
318  material.SetProperty(colorIndex, Color::WHITE );
319  application.SendNotification();
320  application.Render(0);
321 
322  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
324 
325  END_TEST;
326 }
327 
329 {
330  TestApplication application;
331 
332  tet_infoline("Test that a non-uniform material property can be animated");
333 
334  Shader shader = Shader::New( "VertexSource", "FragmentSource");
335  Material material = Material::New( shader );
336 
337  Geometry geometry = CreateQuadGeometry();
338  Renderer renderer = Renderer::New( geometry, material );
339 
340  Actor actor = Actor::New();
341  actor.AddRenderer(renderer);
342  actor.SetSize(400, 400);
343  Stage::GetCurrent().Add(actor);
344 
345  Vector4 initialColor = Color::WHITE;
346  Property::Index colorIndex = material.RegisterProperty( "uFadeColor", initialColor );
347 
348  application.SendNotification();
349  application.Render(0);
350  DALI_TEST_EQUALS( material.GetProperty<Vector4>(colorIndex), initialColor, TEST_LOCATION );
351 
352  Animation animation = Animation::New(1.0f);
353  KeyFrames keyFrames = KeyFrames::New();
354  keyFrames.Add(0.0f, initialColor);
355  keyFrames.Add(1.0f, Color::TRANSPARENT);
356  animation.AnimateBetween( Property( material, colorIndex ), keyFrames );
357  animation.Play();
358 
359  application.SendNotification();
360  application.Render(500);
361 
362  DALI_TEST_EQUALS( material.GetProperty<Vector4>(colorIndex), Color::WHITE * 0.5f, TEST_LOCATION );
363 
364  application.Render(500);
365 
367 
368  END_TEST;
369 }
370 
372 {
373  TestApplication application;
374 
375  tet_infoline("Test that a uniform map material property can be animated");
376 
377  Shader shader = Shader::New( "VertexSource", "FragmentSource");
378  Material material = Material::New( shader );
379 
380  Geometry geometry = CreateQuadGeometry();
381  Renderer renderer = Renderer::New( geometry, material );
382 
383  Actor actor = Actor::New();
384  actor.AddRenderer(renderer);
385  actor.SetSize(400, 400);
386  Stage::GetCurrent().Add(actor);
387  application.SendNotification();
388  application.Render(0);
389 
390  Vector4 initialColor = Color::WHITE;
391  Property::Index colorIndex = material.RegisterProperty( "uFadeColor", initialColor );
392 
393  TestGlAbstraction& gl = application.GetGlAbstraction();
394 
395  application.SendNotification();
396  application.Render(0);
397 
398  Vector4 actualValue(Vector4::ZERO);
399  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
400  DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION );
401 
402  Animation animation = Animation::New(1.0f);
403  KeyFrames keyFrames = KeyFrames::New();
404  keyFrames.Add(0.0f, initialColor);
405  keyFrames.Add(1.0f, Color::TRANSPARENT);
406  animation.AnimateBetween( Property( material, colorIndex ), keyFrames );
407  animation.Play();
408 
409  application.SendNotification();
410  application.Render(500);
411 
412  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
413  DALI_TEST_EQUALS( actualValue, Color::WHITE * 0.5f, TEST_LOCATION );
414 
415  application.Render(500);
416  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
418 
419  END_TEST;
420 }
421 
422 
424 {
425  TestApplication application;
426 
427  Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
428 
429  Material material = CreateMaterial();
430  material.AddTexture( image, "sTexture" );
431 
432  int textureIndex = material.GetTextureIndex( "sTexture" );
433  DALI_TEST_EQUALS( textureIndex, 0, TEST_LOCATION );
434 
435  material.SetTextureUniformName( 0, "sEffectTexture" );
436  textureIndex = material.GetTextureIndex( "sEffectTexture" );
437  DALI_TEST_EQUALS( textureIndex, 0, TEST_LOCATION );
438 
439  Geometry geometry = CreateQuadGeometry();
440  Renderer renderer = Renderer::New( geometry, material );
441  Actor actor = Actor::New();
442  actor.AddRenderer(renderer);
444  actor.SetSize(400, 400);
445 
446  Stage::GetCurrent().Add( actor );
447 
448  TestGlAbstraction& gl = application.GetGlAbstraction();
449 
450  application.SendNotification();
451  application.Render();
452 
453  int textureUnit=-1;
454  DALI_TEST_CHECK( gl.GetUniformValue<int>( "sEffectTexture", textureUnit ) );
455  DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
456 
457  END_TEST;
458 }
459 
461 {
462  TestApplication application;
463 
464  Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
465  Image image2 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
466 
467  Material material = CreateMaterial();
468  material.AddTexture( image, "sTexture");
469  material.SetTextureUniformName( 0, "sEffectTexture" );
470  material.AddTexture( image2, "sTexture2");
471 
472  int textureIndex = material.GetTextureIndex( "sEffectTexture" );
473  DALI_TEST_EQUALS( textureIndex, 0, TEST_LOCATION );
474 
475  textureIndex = material.GetTextureIndex( "sTexture2" );
476  DALI_TEST_EQUALS( textureIndex, 1, TEST_LOCATION );
477 
478  Geometry geometry = CreateQuadGeometry();
479  Renderer renderer = Renderer::New( geometry, material );
480  Actor actor = Actor::New();
481  actor.AddRenderer(renderer);
483  actor.SetSize(400, 400);
484 
485  Stage::GetCurrent().Add( actor );
486 
487  TestGlAbstraction& gl = application.GetGlAbstraction();
488 
489  application.SendNotification();
490  application.Render();
491 
492  int textureUnit=-1;
493  DALI_TEST_CHECK( gl.GetUniformValue<int>( "sEffectTexture", textureUnit ) );
494  DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
495 
496  DALI_TEST_CHECK( gl.GetUniformValue<int>( "sTexture2", textureUnit ) );
497  DALI_TEST_EQUALS( textureUnit, 1, TEST_LOCATION );
498 
499  END_TEST;
500 }
501 
503 {
504  TestApplication application;
505 
506  Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
507 
508  Material material = CreateMaterial();
509  material.AddTexture( image, "sTexture");
510 
511  Geometry geometry = CreateQuadGeometry();
512  Renderer renderer = Renderer::New( geometry, material );
513  Actor actor = Actor::New();
514  actor.AddRenderer(renderer);
516  actor.SetSize(400, 400);
517 
518  Stage::GetCurrent().Add( actor );
519 
520  TestGlAbstraction& gl = application.GetGlAbstraction();
521 
522  TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
523  texParameterTrace.Reset();
524  texParameterTrace.Enable( true );
525  application.SendNotification();
526  application.Render();
527 
528  int textureUnit=-1;
529  DALI_TEST_CHECK( gl.GetUniformValue<int>( "sTexture", textureUnit ) );
530  DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
531 
532  texParameterTrace.Enable( false );
533 
534  // Verify gl state
535  // There are three calls to TexParameteri when the texture is first created
536  // as the texture is using default sampling parametrers there shouldn't be any more calls to TexParameteri
537  DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 3, TEST_LOCATION);
538 
539  END_TEST;
540 }
541 
543 {
544  TestApplication application;
545 
546  Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
547 
548  Material material = CreateMaterial();
549 
550  Sampler sampler = Sampler::New();
552  material.AddTexture( image, "sTexture", sampler );
553 
554  Geometry geometry = CreateQuadGeometry();
555  Renderer renderer = Renderer::New( geometry, material );
556  Actor actor = Actor::New();
557  actor.AddRenderer(renderer);
559  actor.SetSize(400, 400);
560 
561  Stage::GetCurrent().Add( actor );
562 
563  TestGlAbstraction& gl = application.GetGlAbstraction();
564 
565  TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
566  texParameterTrace.Reset();
567  texParameterTrace.Enable( true );
568  application.SendNotification();
569  application.Render();
570 
571  int textureUnit=-1;
572  DALI_TEST_CHECK( gl.GetUniformValue<int>( "sTexture", textureUnit ) );
573  DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
574 
575  texParameterTrace.Enable( false );
576 
577  // Verify gl state
578  // There are three calls to TexParameteri when the texture is first created
579  // Texture minification and magnification filters are now different than default so
580  //there should have been two extra TexParameteri calls to set the new filter mode
581  DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 4, TEST_LOCATION);
582 
583  END_TEST;
584 }
585 
587 {
588  TestApplication application;
589 
590  Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
591 
592  Material material = CreateMaterial();
593  material.RemoveTexture(0);
595 
596  material.RemoveTexture(1);
598 
599  Sampler sampler = Sampler::New();
600  sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST );
601  material.AddTexture( image, "sTexture", sampler );
603 
604  material.RemoveTexture(1);
606 
607  material.RemoveTexture(0);
609 
610  END_TEST;
611 }
612 
614 {
615  TestApplication application;
616 
617  Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
618 
619  Material material = CreateMaterial();
620  material.AddTexture( image, "sTexture");
621 
622  Geometry geometry = CreateQuadGeometry();
623  Renderer renderer = Renderer::New( geometry, material );
624  Actor actor = Actor::New();
625  actor.AddRenderer(renderer);
627  actor.SetSize(400, 400);
628 
629  Stage::GetCurrent().Add( actor );
630 
631  TestGlAbstraction& gl = application.GetGlAbstraction();
632 
633  TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
634  texParameterTrace.Reset();
635  texParameterTrace.Enable( true );
636  application.SendNotification();
637  application.Render();
638 
639  int textureUnit=-1;
640  DALI_TEST_CHECK( gl.GetUniformValue<int>( "sTexture", textureUnit ) );
641  DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
642 
643  texParameterTrace.Enable( false );
644 
645  // Verify gl state
646  // There are three calls to TexParameteri when the texture is first created
647  // as the texture is using default sampling parametrers there shouldn't be any more calls to TexParameteri
648  DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 3, TEST_LOCATION);
649 
650  texParameterTrace.Reset();
651  texParameterTrace.Enable( true );
652 
653  Sampler sampler = Sampler::New();
655  material.SetTextureSampler(0, sampler );
656 
657 
658  application.SendNotification();
659  application.Render();
660 
661  texParameterTrace.Enable( false );
662 
663  // Verify gl state
664  //There should have been two calls to TexParameteri to set the new filtering mode
665  DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 2, TEST_LOCATION);
666 
667 
668  END_TEST;
669 }
670 
672 {
673  TestApplication application;
674 
675  Image image0 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
676  Image image1 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
677  Image image2 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
678  Image image3 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
679 
680 
681  Material material = CreateMaterial();
682  material.AddTexture( image0, "sTexture0");
683  material.AddTexture( image1, "sTexture1");
684  material.AddTexture( image2, "sTexture2");
685  material.AddTexture( image3, "sTexture3");
686 
687  int textureIndex = material.GetTextureIndex( "sTexture0" );
688  DALI_TEST_EQUALS( textureIndex, 0, TEST_LOCATION );
689 
690  textureIndex = material.GetTextureIndex( "sTexture1" );
691  DALI_TEST_EQUALS( textureIndex, 1, TEST_LOCATION );
692 
693  textureIndex = material.GetTextureIndex( "sTexture2" );
694  DALI_TEST_EQUALS( textureIndex, 2, TEST_LOCATION );
695 
696  textureIndex = material.GetTextureIndex( "sTexture3" );
697  DALI_TEST_EQUALS( textureIndex, 3, TEST_LOCATION );
698 
699  material.RemoveTexture(1);
700 
701  textureIndex = material.GetTextureIndex( "sTexture0" );
702  DALI_TEST_EQUALS( textureIndex, 0, TEST_LOCATION );
703 
704  textureIndex = material.GetTextureIndex( "sTexture2" );
705  DALI_TEST_EQUALS( textureIndex, 1, TEST_LOCATION );
706 
707  textureIndex = material.GetTextureIndex( "sTexture3" );
708  DALI_TEST_EQUALS( textureIndex, 2, TEST_LOCATION );
709 
710  END_TEST;
711 }
712 
714 {
715  TestApplication application;
716 
717  Image image0 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
718  Image image1 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
719  Image image2 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
720  Image image3 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
721 
722 
723  Material material = CreateMaterial();
724  material.AddTexture( image0, "sTexture0");
725  material.AddTexture( image1, "sTexture1");
726  material.AddTexture( image2, "sTexture2");
727  material.AddTexture( image3, "sTexture3");
728 
729  Image textureImage0 = material.GetTexture( "sTexture0" );
730  DALI_TEST_EQUALS( textureImage0, image0, TEST_LOCATION );
731 
732  Image textureImage1 = material.GetTexture( "sTexture1" );
733  DALI_TEST_EQUALS( textureImage1, image1, TEST_LOCATION );
734 
735  Image textureImage2 = material.GetTexture( "sTexture2" );
736  DALI_TEST_EQUALS( textureImage2, image2, TEST_LOCATION );
737 
738  Image textureImage3 = material.GetTexture( "sTexture3" );
739  DALI_TEST_EQUALS( textureImage3, image3, TEST_LOCATION );
740 
741  END_TEST;
742 }
743 
745 {
746  TestApplication application;
747 
748  Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
749 
750  Material material = CreateMaterial();
751  material.AddTexture( image, "sTexture");
752 
753  Image textureImage = material.GetTexture( "sTextureTEST" );
754  DALI_TEST_CHECK( !textureImage );
755 
756  END_TEST;
757 }
758 
Dali Docs Home
Read more about Dali