Merge "Changed log message to inform number of textures != than active sampler from...
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Texture.cpp
1 /*
2  * Copyright (c) 2016 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
18 #include <dali/public-api/dali-core.h>
19 #include <dali-test-suite-utils.h>
20 #include <test-native-image.h>
21
22 using namespace Dali;
23
24 #include <mesh-builder.h>
25
26 void texture_set_startup(void)
27 {
28   test_return_value = TET_UNDEF;
29 }
30
31 void texture_set_cleanup(void)
32 {
33   test_return_value = TET_PASS;
34 }
35
36 int UtcDaliTextureNew01(void)
37 {
38   TestApplication application;
39
40   unsigned int width(64);
41   unsigned int height(64);
42   Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
43
44   DALI_TEST_CHECK( texture );
45   END_TEST;
46 }
47
48 int UtcDaliTextureNew02(void)
49 {
50   TestApplication application;
51   Texture texture;
52   DALI_TEST_CHECK( !texture );
53   END_TEST;
54 }
55
56 int UtcDaliTextureNew03(void)
57 {
58   TestApplication application;
59
60   // Create a native image source.
61   TestNativeImageNoExtPointer testNativeImage = TestNativeImageNoExt::New( 64u, 64u );
62
63   // Create a texture from the native image source.
64   Texture nativeTexture = Texture::New( *testNativeImage );
65
66   // Check the texture was created OK.
67   DALI_TEST_CHECK( nativeTexture );
68
69   END_TEST;
70 }
71
72 int UtcDaliTextureCopyConstructor(void)
73 {
74   TestApplication application;
75
76   unsigned int width(64);
77   unsigned int height(64);
78   Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
79
80   Texture textureCopy(texture);
81
82   DALI_TEST_CHECK( textureCopy );
83
84   END_TEST;
85 }
86
87 int UtcDaliTextureAssignmentOperator(void)
88 {
89   TestApplication application;
90   unsigned int width(64);
91   unsigned int height(64);
92   Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
93
94   Texture texture2;
95   DALI_TEST_CHECK( !texture2 );
96
97   texture2 = texture;
98   DALI_TEST_CHECK( texture2 );
99
100   END_TEST;
101 }
102
103 int UtcDaliTextureDownCast01(void)
104 {
105   TestApplication application;
106   unsigned int width(64);
107   unsigned int height(64);
108   Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
109
110   BaseHandle handle(texture);
111   Texture texture2 = Texture::DownCast(handle);
112   DALI_TEST_CHECK( texture2 );
113
114   END_TEST;
115 }
116
117 int UtcDaliTextureDownCast02(void)
118 {
119   TestApplication application;
120
121   Handle handle = Handle::New(); // Create a custom object
122   Texture texture = Texture::DownCast(handle);
123   DALI_TEST_CHECK( !texture );
124   END_TEST;
125 }
126
127 int UtcDaliTextureUpload01(void)
128 {
129   TestApplication application;
130
131   //Create the texture
132   unsigned int width(64);
133   unsigned int height(64);
134   Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
135
136   application.GetGlAbstraction().EnableTextureCallTrace(true);
137
138   application.SendNotification();
139   application.Render();
140
141   TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
142
143   //TexImage2D should be called with a null pointer to reserve storage for the texture in the gpu
144   {
145     std::stringstream out;
146     out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
147     DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
148   }
149
150   //Upload data to the texture
151   callStack.Reset();
152
153   unsigned int bufferSize( width * height * 4 );
154   unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
155   PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE );
156   texture.Upload( pixelData );
157   application.SendNotification();
158   application.Render();
159
160   //TexImage2D should be called to upload the data
161   {
162     std::stringstream out;
163     out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
164     DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
165   }
166
167   //Upload part of the texture
168   callStack.Reset();
169   bufferSize =  width * height * 2;
170   buffer = reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
171   PixelData pixelDataSubImage = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE );
172   texture.Upload( pixelDataSubImage, 0u, 0u, width/2, height/2, width/2, height/2 );
173   application.SendNotification();
174   application.Render();
175
176   //TexSubImage2D should be called to upload the data
177   {
178     std::stringstream out;
179     out << GL_TEXTURE_2D <<", "<< 0u << ", " << width/2 << ", " <<  height/2 << ", " << width/2 << ", " <<  height/2;
180     DALI_TEST_CHECK( callStack.FindMethodAndParams("TexSubImage2D", out.str().c_str() ) );
181   }
182
183
184   END_TEST;
185 }
186
187 int UtcDaliTextureUpload02(void)
188 {
189   TestApplication application;
190
191   //Create the texture
192   unsigned int width(64);
193   unsigned int height(64);
194   Texture texture = Texture::New( TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height );
195
196   application.GetGlAbstraction().EnableTextureCallTrace(true);
197
198   application.SendNotification();
199   application.Render();
200
201   TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
202
203   //TexImage2D should be called six times with a null pointer to reserve storage for the six textures of the cube map
204   for( unsigned int i(0); i<6; ++i )
205   {
206     std::stringstream out;
207     out << GL_TEXTURE_CUBE_MAP_POSITIVE_X + i <<", "<< 0u << ", " << width <<", "<< height;
208     DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
209   }
210
211   unsigned int bufferSize( width * height * 4 );
212   unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
213   PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE );
214
215   //Upload data to the POSITIVE_X face of the texture
216   {
217     callStack.Reset();
218
219     texture.Upload( pixelData, CubeMapLayer::POSITIVE_X, 0u, 0u, 0u, width, height );
220     application.SendNotification();
221     application.Render();
222
223     //TexImage2D should be called to upload the data to the POSITIVE_X face
224     {
225       std::stringstream out;
226       out << GL_TEXTURE_CUBE_MAP_POSITIVE_X <<", "<< 0u << ", " << width <<", "<< height;
227       DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
228     }
229   }
230
231   //Upload data to the NEGATIVE_X face of the texture
232   {
233     callStack.Reset();
234
235     texture.Upload( pixelData, CubeMapLayer::NEGATIVE_X, 0u, 0u, 0u, width, height );
236     application.SendNotification();
237     application.Render();
238
239     //TexImage2D should be called to upload the data to the NEGATIVE_X face
240     {
241       std::stringstream out;
242       out << GL_TEXTURE_CUBE_MAP_NEGATIVE_X <<", "<< 0u << ", " << width <<", "<< height;
243       DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
244     }
245   }
246
247   //Upload data to the POSITIVE_Y face of the texture
248   {
249     callStack.Reset();
250     texture.Upload( pixelData, CubeMapLayer::POSITIVE_Y, 0u, 0u, 0u, width, height );
251     application.SendNotification();
252     application.Render();
253
254     //TexImage2D should be called to upload the data to the POSITIVE_Y face
255     {
256       std::stringstream out;
257       out << GL_TEXTURE_CUBE_MAP_POSITIVE_Y <<", "<< 0u << ", " << width <<", "<< height;
258       DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
259     }
260   }
261
262   //Upload data to the NEGATIVE_Y face of the texture
263   {
264     callStack.Reset();
265     texture.Upload( pixelData, CubeMapLayer::NEGATIVE_Y, 0u, 0u, 0u, width, height );
266     application.SendNotification();
267     application.Render();
268
269     //TexImage2D should be called to upload the data to the NEGATIVE_Y face
270     {
271       std::stringstream out;
272       out << GL_TEXTURE_CUBE_MAP_NEGATIVE_Y <<", "<< 0u << ", " << width <<", "<< height;
273       DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
274     }
275   }
276
277   //Upload data to the POSITIVE_Z face of the texture
278   {
279     callStack.Reset();
280     texture.Upload( pixelData, CubeMapLayer::POSITIVE_Z, 0u, 0u, 0u, width, height );
281     application.SendNotification();
282     application.Render();
283
284     //TexImage2D should be called to upload the data to the POSITIVE_Z face
285     {
286       std::stringstream out;
287       out << GL_TEXTURE_CUBE_MAP_POSITIVE_Z <<", "<< 0u << ", " << width <<", "<< height;
288       DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
289     }
290   }
291
292   //Upload data to the NEGATIVE_Z face of the texture
293   {
294     callStack.Reset();
295     texture.Upload( pixelData, CubeMapLayer::NEGATIVE_Z, 0u, 0u, 0u, width, height );
296     application.SendNotification();
297     application.Render();
298
299     //TexImage2D should be called to upload the data to the NEGATIVE_Z face
300     {
301       std::stringstream out;
302       out << GL_TEXTURE_CUBE_MAP_NEGATIVE_Z <<", "<< 0u << ", " << width <<", "<< height;
303       DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
304     }
305   }
306
307   END_TEST;
308 }
309
310 int UtcDaliTextureUpload03(void)
311 {
312   TestApplication application;
313
314   //Create the texture
315   unsigned int width(64);
316   unsigned int height(64);
317   unsigned int widthMipmap1(32);
318   unsigned int heightMipmap1(32);
319
320   Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
321
322   application.GetGlAbstraction().EnableTextureCallTrace(true);
323
324   application.SendNotification();
325   application.Render();
326
327   TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
328
329   //TexImage2D should be called with a null pointer to reserve storage for the texture in the gpu
330   {
331     std::stringstream out;
332     out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
333     DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
334   }
335
336   //Upload data to the texture mipmap 0 and mipmap 1
337   callStack.Reset();
338
339   unsigned int bufferSize( width * height * 4 );
340   unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc(  bufferSize ) );
341   PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE );
342   texture.Upload( pixelData, 0u, 0u, 0u, 0u, width, height );
343
344   bufferSize = widthMipmap1 * heightMipmap1 * 4;
345   buffer = reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
346   PixelData pixelDataMipmap1 = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE );
347   texture.Upload( pixelDataMipmap1, 0u, 1u, 0u, 0u, widthMipmap1, heightMipmap1 );
348   application.SendNotification();
349   application.Render();
350
351   //TexImage2D should be called to upload the data to mipmaps 0 and 1
352   {
353     std::stringstream out;
354     out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
355     DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
356   }
357   {
358     std::stringstream out;
359     out << GL_TEXTURE_2D <<", "<< 1u << ", " << widthMipmap1 <<", "<< heightMipmap1;
360     DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
361   }
362
363   END_TEST;
364 }
365
366 int UtcDaliTextureUpload04(void)
367 {
368   TestApplication application;
369
370   //Create the texture
371   unsigned int width(64);
372   unsigned int height(64);
373   unsigned int widthMipmap1(32);
374   unsigned int heightMipmap1(32);
375
376   Texture texture = Texture::New( TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height );
377
378   application.GetGlAbstraction().EnableTextureCallTrace(true);
379   TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
380
381   //Upload data to the NEGATIVE_X face mipmap 0 and mipmap 1
382   unsigned int bufferSize( width * height * 4 );
383   unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
384   PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE );
385   texture.Upload( pixelData, CubeMapLayer::NEGATIVE_X, 0u, 0u, 0u, width, height );
386
387   bufferSize = widthMipmap1 * heightMipmap1 * 4;
388   buffer = reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
389   PixelData pixelDataMipmap1 = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE );
390   texture.Upload( pixelDataMipmap1, CubeMapLayer::NEGATIVE_X, 1u, 0u, 0u, widthMipmap1, heightMipmap1 );
391   application.SendNotification();
392   application.Render();
393
394   //TexImage2D should be called to upload the data to mipmaps 0 and 1
395   {
396     std::stringstream out;
397     out << GL_TEXTURE_CUBE_MAP_NEGATIVE_X <<", "<< 0u << ", " << width <<", "<< height;
398     DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
399   }
400   {
401     std::stringstream out;
402     out << GL_TEXTURE_CUBE_MAP_NEGATIVE_X <<", "<< 1u << ", " << widthMipmap1 <<", "<< heightMipmap1;
403     DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
404   }
405
406   END_TEST;
407 }
408
409 int UtcDaliTextureUpload05(void)
410 {
411   TestApplication application;
412
413   //Create a texture with a compressed format
414   unsigned int width(64);
415   unsigned int height(64);
416   Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR, width, height );
417
418   application.GetGlAbstraction().EnableTextureCallTrace(true);
419
420   application.SendNotification();
421   application.Render();
422
423   TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
424
425   //CompressedTexImage2D should be called with a null pointer to reserve storage for the texture in the gpu
426   {
427     std::stringstream out;
428     out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
429     DALI_TEST_CHECK( callStack.FindMethodAndParams("CompressedTexImage2D", out.str().c_str() ) );
430   }
431
432   //Upload data to the texture
433   callStack.Reset();
434
435   unsigned int bufferSize( width * height * 4 );
436   unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
437   PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR, PixelData::FREE );
438   texture.Upload( pixelData );
439   application.SendNotification();
440   application.Render();
441
442   //CompressedTexImage2D should be called to upload the data
443   {
444     std::stringstream out;
445     out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
446     DALI_TEST_CHECK( callStack.FindMethodAndParams("CompressedTexImage2D", out.str().c_str() ) );
447   }
448
449   //Upload part of the texture
450   callStack.Reset();
451   bufferSize =  width * height * 2;
452   buffer = reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
453   PixelData pixelDataSubImage = PixelData::New( buffer, bufferSize, width, height, Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR, PixelData::FREE );
454   texture.Upload( pixelDataSubImage, 0u, 0u, width/2, height/2, width/2, height/2 );
455   application.SendNotification();
456   application.Render();
457
458   //CompressedTexSubImage2D should be called to upload the data
459   {
460     std::stringstream out;
461     out << GL_TEXTURE_2D <<", "<< 0u << ", " << width/2 << ", " <<  height/2 << ", " << width/2 << ", " <<  height/2;
462     DALI_TEST_CHECK( callStack.FindMethodAndParams("CompressedTexSubImage2D", out.str().c_str() ) );
463   }
464
465
466   END_TEST;
467 }
468
469 int UtcDaliTextureUpload06(void)
470 {
471   TestApplication application;
472
473   //Create the texture
474   unsigned int width(64);
475   unsigned int height(64);
476   tet_infoline( "Creating a Texure with an alpha channel" );
477   Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
478
479   application.GetGlAbstraction().EnableTextureCallTrace(true);
480
481   application.SendNotification();
482   application.Render();
483
484   TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
485
486   tet_infoline( "TexImage2D should be called with a null pointer to reserve storage for the texture in the gpu" );
487   {
488     std::stringstream out;
489     out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
490     DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
491   }
492
493   tet_infoline( "Upload data to the texture" );
494   callStack.Reset();
495
496   tet_infoline( "Creating a RGB pixel buffer and adding that to the texture to ensure it is handled correctly" );
497   unsigned int bufferSize( width * height * 3 );
498   unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
499   PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGB888, PixelData::FREE );
500   texture.Upload( pixelData );
501   application.SendNotification();
502   application.Render();
503
504   tet_infoline( "TexImage2D should be called to upload the data" );
505   {
506     std::stringstream out;
507     out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
508     DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
509   }
510
511   END_TEST;
512 }
513
514 int UtcDaliTextureUploadSmallerThanSize(void)
515 {
516   TestApplication application;
517
518   //Create the texture
519   unsigned int width(64);
520   unsigned int height(64);
521   Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
522
523   application.GetGlAbstraction().EnableTextureCallTrace(true);
524
525   application.SendNotification();
526   application.Render();
527
528   TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
529
530   //TexImage2D should be called with a null pointer to reserve storage for the texture in the gpu
531   {
532     std::stringstream out;
533     out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
534     std::string params;
535     DALI_TEST_CHECK( callStack.FindMethodAndGetParameters("TexImage2D", params ) );
536     DALI_TEST_EQUALS( out.str(), params, TEST_LOCATION );
537   }
538
539   //Upload data to the texture
540   callStack.Reset();
541
542   unsigned int bufferSize( width * height * 4 );
543   unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
544   PixelData pixelData = PixelData::New( buffer, bufferSize, width/2, height/2, Pixel::RGBA8888, PixelData::FREE );
545   texture.Upload( pixelData );
546   application.SendNotification();
547   application.Render();
548
549   //TexImage2D should be called to upload the data
550   {
551     std::stringstream out;
552     out << GL_TEXTURE_2D <<", "<< 0u << ", " << 0u << ", " <<  0u << ", " << width/2 << ", " <<  height/2;
553     std::string params;
554     DALI_TEST_CHECK( callStack.FindMethodAndGetParameters("TexSubImage2D", params ) );
555     DALI_TEST_EQUALS( out.str(), params, TEST_LOCATION );
556   }
557
558   END_TEST;
559 }
560
561 int UtcDaliTextureGenerateMipmaps(void)
562 {
563   TestApplication application;
564   unsigned int width(64);
565   unsigned int height(64);
566
567   Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
568   texture.GenerateMipmaps();
569
570   Texture textureCubemap = Texture::New( TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height );
571   textureCubemap.GenerateMipmaps();
572
573   application.GetGlAbstraction().EnableTextureCallTrace(true);
574   TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
575   application.SendNotification();
576   application.Render();
577
578   {
579     std::stringstream out;
580     out << GL_TEXTURE_2D;
581     DALI_TEST_CHECK( callStack.FindMethodAndParams("GenerateMipmap", out.str().c_str() ) );
582   }
583   {
584     std::stringstream out;
585     out << GL_TEXTURE_CUBE_MAP;
586     DALI_TEST_CHECK( callStack.FindMethodAndParams("GenerateMipmap", out.str().c_str() ) );
587   }
588
589   END_TEST;
590 }
591
592 int UtcDaliTextureGetWidth(void)
593 {
594   TestApplication application;
595   unsigned int width(64);
596   unsigned int height(64);
597
598   Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
599   DALI_TEST_EQUALS( texture.GetWidth(), width, TEST_LOCATION );
600   END_TEST;
601 }
602
603 int UtcDaliTextureGetHeight(void)
604 {
605   TestApplication application;
606   unsigned int width(64);
607   unsigned int height(64);
608
609   Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
610   DALI_TEST_EQUALS( texture.GetHeight(), height, TEST_LOCATION );
611
612   END_TEST;
613 }
614
615 int UtcDaliTextureContextLoss(void)
616 {
617   tet_infoline("UtcDaliTextureContextLoss\n");
618   TestApplication application; // Default config: DALI_DISCARDS_ALL_DATA
619
620   //Create the texture
621   unsigned int width(64);
622   unsigned int height(64);
623   Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
624   DALI_TEST_CHECK( texture );
625
626   application.SendNotification();
627   application.Render(16);
628
629   // Lose & regain context (in render 'thread')
630   application.ResetContext();
631   DALI_TEST_CHECK( texture );
632
633   END_TEST;
634 }