2 * Copyright (c) 2016 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.
19 #include <dali-toolkit-test-suite-utils.h>
20 #include <toolkit-event-thread-callback.h>
21 #include <dali/public-api/rendering/renderer.h>
22 #include <dali/public-api/rendering/texture-set.h>
23 #include <dali/public-api/rendering/shader.h>
24 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
25 #include <dali-toolkit/dali-toolkit.h>
28 using namespace Dali::Toolkit;
32 typedef NinePatchImage::StretchRanges StretchRanges;
34 const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg";
35 const char* TEST_NPATCH_FILE_NAME = "gallery_image_01.9.png";
37 const char* TEST_SVG_FILE_NAME = TEST_RESOURCE_DIR "/svg1.svg";
38 const char* TEST_OBJ_FILE_NAME = TEST_RESOURCE_DIR "/Cube.obj";
39 const char* TEST_MTL_FILE_NAME = TEST_RESOURCE_DIR "/ToyRobot-Metal.mtl";
40 const char* TEST_SIMPLE_OBJ_FILE_NAME = TEST_RESOURCE_DIR "/Cube-Points-Only.obj";
41 const char* TEST_SIMPLE_MTL_FILE_NAME = TEST_RESOURCE_DIR "/ToyRobot-Metal-Simple.mtl";
43 Integration::Bitmap* CreateBitmap( unsigned int imageWidth, unsigned int imageHeight, unsigned int initialColor, Pixel::Format pixelFormat )
45 Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
46 Integration::PixelBuffer* pixbuffer = bitmap->GetPackedPixelsProfile()->ReserveBuffer( pixelFormat, imageWidth, imageHeight, imageWidth, imageHeight );
47 unsigned int bytesPerPixel = GetBytesPerPixel( pixelFormat );
49 memset( pixbuffer, initialColor, imageHeight * imageWidth * bytesPerPixel );
54 void InitialiseRegionsToZeroAlpha( Integration::Bitmap* image, unsigned int imageWidth, unsigned int imageHeight, Pixel::Format pixelFormat )
56 PixelBuffer* pixbuffer = image->GetBuffer();
57 unsigned int bytesPerPixel = GetBytesPerPixel( pixelFormat );
59 for( unsigned int row = 0; row < imageWidth; ++row )
61 unsigned int pixelOffset = row * bytesPerPixel;
62 pixbuffer[ pixelOffset + 3 ] = 0x00;
63 pixelOffset += ( imageHeight - 1 ) * imageWidth * bytesPerPixel;
64 pixbuffer[ pixelOffset + 3 ] = 0x00;
67 for ( unsigned int column = 0; column < imageHeight; ++column )
69 unsigned int pixelOffset = column * imageWidth * bytesPerPixel;
70 pixbuffer[ pixelOffset + 3 ] = 0x00;
71 pixelOffset += ( imageWidth -1 ) * bytesPerPixel;
72 pixbuffer[ pixelOffset + 3 ] = 0x00;
76 void AddStretchRegionsToImage( Integration::Bitmap* image, unsigned int imageWidth, unsigned int imageHeight, const StretchRanges& stretchRangesX, const StretchRanges& stretchRangesY, Pixel::Format pixelFormat )
78 PixelBuffer* pixbuffer = image->GetBuffer();
79 unsigned int bytesPerPixel = GetBytesPerPixel( pixelFormat );
81 for(StretchRanges::ConstIterator it = stretchRangesX.Begin(); it != stretchRangesX.End(); ++it)
83 const Uint16Pair& range = *it;
84 //since the stretch range is in the cropped image space, we need to offset by 1 to get it to the uncropped image space
85 for( unsigned int column = range.GetX() + 1u; column < range.GetY() + 1u; ++column )
87 unsigned int pixelOffset = column * bytesPerPixel;
88 pixbuffer[ pixelOffset ] = 0x00;
89 pixbuffer[ pixelOffset + 1 ] = 0x00;
90 pixbuffer[ pixelOffset + 2 ] = 0x00;
91 pixbuffer[ pixelOffset + 3 ] = 0xFF;
96 for(StretchRanges::ConstIterator it = stretchRangesY.Begin(); it != stretchRangesY.End(); ++it)
98 const Uint16Pair& range = *it;
99 //since the stretch range is in the cropped image space, we need to offset by 1 to get it to the uncropped image space
100 for( unsigned int row = range.GetX() + 1u; row < range.GetY() + 1u; ++row )
102 unsigned int pixelOffset = row * imageWidth * bytesPerPixel;
103 pixbuffer[ pixelOffset ] = 0x00;
104 pixbuffer[ pixelOffset + 1 ] = 0x00;
105 pixbuffer[ pixelOffset + 2 ] = 0x00;
106 pixbuffer[ pixelOffset + 3 ] = 0xFF;
111 void AddChildRegionsToImage( Integration::Bitmap* image, unsigned int imageWidth, unsigned int imageHeight, const Vector4& requiredChildRegion, Pixel::Format pixelFormat )
113 PixelBuffer* pixbuffer = image->GetBuffer();
114 unsigned int bytesPerPixel = GetBytesPerPixel( pixelFormat );
116 Integration::Bitmap::PackedPixelsProfile* srcProfile = image->GetPackedPixelsProfile();
117 unsigned int bufferStride = srcProfile->GetBufferStride();
119 // Add bottom child region
120 for( unsigned int column = requiredChildRegion.x; column < imageWidth - requiredChildRegion.z; ++column )
122 unsigned int pixelOffset = column * bytesPerPixel;
123 pixelOffset += ( imageHeight - 1 ) * bufferStride;
124 pixbuffer[ pixelOffset ] = 0x00;
125 pixbuffer[ pixelOffset + 1 ] = 0x00;
126 pixbuffer[ pixelOffset + 2 ] = 0x00;
127 pixbuffer[ pixelOffset + 3 ] = 0xFF;
130 // Add right child region
131 for ( unsigned int row = requiredChildRegion.y; row < imageHeight - requiredChildRegion.w; ++row )
133 unsigned int pixelOffset = row * bufferStride + ( imageWidth - 1 ) * bytesPerPixel;
134 pixbuffer[ pixelOffset ] = 0x00;
135 pixbuffer[ pixelOffset + 1 ] = 0x00;
136 pixbuffer[ pixelOffset + 2 ] = 0x00;
137 pixbuffer[ pixelOffset + 3 ] = 0xFF;
141 Integration::ResourcePointer CustomizeNinePatch( TestApplication& application,
142 unsigned int ninePatchImageWidth,
143 unsigned int ninePatchImageHeight,
144 const StretchRanges& stretchRangesX,
145 const StretchRanges& stretchRangesY,
146 bool addChildRegion = false,
147 Vector4 requiredChildRegion = Vector4::ZERO )
149 TestPlatformAbstraction& platform = application.GetPlatform();
151 Pixel::Format pixelFormat = Pixel::RGBA8888;
153 tet_infoline("Create Bitmap");
154 platform.SetClosestImageSize(Vector2( ninePatchImageWidth, ninePatchImageHeight));
155 Integration::Bitmap* bitmap = CreateBitmap( ninePatchImageWidth, ninePatchImageHeight, 0xFF, pixelFormat );
157 tet_infoline("Clear border regions");
158 InitialiseRegionsToZeroAlpha( bitmap, ninePatchImageWidth, ninePatchImageHeight, pixelFormat );
160 tet_infoline("Add Stretch regions to Bitmap");
161 AddStretchRegionsToImage( bitmap, ninePatchImageWidth, ninePatchImageHeight, stretchRangesX, stretchRangesY, pixelFormat );
165 tet_infoline("Add Child regions to Bitmap");
166 AddChildRegionsToImage( bitmap, ninePatchImageWidth, ninePatchImageHeight, requiredChildRegion, pixelFormat );
169 tet_infoline("Getting resource");
170 Integration::ResourcePointer resourcePtr(bitmap);
171 //platform.SetResourceLoaded( 0, Dali::Integration::ResourceBitmap, resourcePtr );
172 platform.SetSynchronouslyLoadedResource( resourcePtr);
177 void TestVisualRender( ToolkitTestApplication& application,
179 Visual::Base& visual,
180 std::size_t expectedSamplers = 0,
181 ImageDimensions imageDimensions = ImageDimensions(),
182 Integration::ResourcePointer resourcePtr = Integration::ResourcePointer())
186 // set the image size, for test case, this needs to be set before loading started
187 application.GetPlatform().SetClosestImageSize( Vector2(imageDimensions.GetWidth(), imageDimensions.GetHeight()) );
190 actor.SetSize( 200.f, 200.f );
191 Stage::GetCurrent().Add( actor );
192 visual.SetSize( Vector2(200.f, 200.f) );
193 visual.SetOnStage( actor );
195 DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
197 application.SendNotification();
198 application.Render();
202 Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
205 application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resourcePtr );
209 application.Render();
210 application.SendNotification();
214 DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) ||
215 application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceSynchronouslyFunc ));
218 DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
225 void dali_visual_factory_startup(void)
227 test_return_value = TET_UNDEF;
230 void dali_visual_factory_cleanup(void)
232 test_return_value = TET_PASS;
235 int UtcDaliVisualFactoryGet(void)
237 ToolkitTestApplication application;
238 tet_infoline( "UtcDaliVisualFactory" );
242 type = TypeRegistry::Get().GetTypeInfo( "VisualFactory" );
243 DALI_TEST_CHECK( type );
244 BaseHandle handle = type.CreateInstance();
245 DALI_TEST_CHECK( handle );
247 VisualFactory factory;
248 factory = VisualFactory::Get();
249 DALI_TEST_CHECK( factory );
251 VisualFactory newFactory = VisualFactory::Get();
252 DALI_TEST_CHECK( newFactory );
254 // Check that renderer factory is a singleton
255 DALI_TEST_CHECK(factory == newFactory);
260 int UtcDaliVisualFactoryCopyAndAssignment(void)
262 ToolkitTestApplication application;
263 tet_infoline( "UtcDaliVisualFactoryCopyAndAssignment" );
264 VisualFactory factory = VisualFactory::Get();
266 VisualFactory factoryCopy( factory );
267 DALI_TEST_CHECK(factory == factoryCopy);
269 VisualFactory emptyFactory;
270 VisualFactory emptyFactoryCopy( emptyFactory );
271 DALI_TEST_CHECK(emptyFactory == emptyFactoryCopy);
273 VisualFactory factoryEquals;
274 factoryEquals = factory;
275 DALI_TEST_CHECK(factory == factoryEquals);
277 VisualFactory emptyFactoryEquals;
278 emptyFactoryEquals = emptyFactory;
279 DALI_TEST_CHECK( emptyFactory == emptyFactoryEquals );
283 DALI_TEST_CHECK( factory = factoryCopy );
288 int UtcDaliVisualFactoryGetColorVisual1(void)
290 ToolkitTestApplication application;
291 tet_infoline( "UtcDaliVisualFactoryGetColorVisual1: Request color visual with a Property::Map" );
293 VisualFactory factory = VisualFactory::Get();
294 DALI_TEST_CHECK( factory );
296 Property::Map propertyMap;
297 Vector4 testColor( 1.f, 0.5f, 0.3f, 0.2f );
298 propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
299 propertyMap.Insert(ColorVisual::Property::MIX_COLOR, testColor);
301 Visual::Base visual = factory.CreateVisual(propertyMap);
302 DALI_TEST_CHECK( visual );
304 Actor actor = Actor::New();
305 TestVisualRender( application, actor, visual );
307 Vector4 actualValue(Vector4::ZERO);
308 TestGlAbstraction& gl = application.GetGlAbstraction();
309 DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "mixColor", actualValue ) );
310 DALI_TEST_EQUALS( actualValue, testColor, TEST_LOCATION );
315 int UtcDaliVisualFactoryGetColorVisual2(void)
317 ToolkitTestApplication application;
318 tet_infoline( "UtcDaliVisualFactoryGetColorVisual2: Request color visual with a Vector4" );
320 VisualFactory factory = VisualFactory::Get();
321 DALI_TEST_CHECK( factory );
323 Vector4 testColor( 1.f, 0.5f, 0.3f, 0.2f );
324 Dali::Property::Map map;
325 map[ Visual::Property::TYPE ] = Visual::COLOR;
326 map[ ColorVisual::Property::MIX_COLOR ] = testColor;
327 Visual::Base visual = factory.CreateVisual( map );
328 DALI_TEST_CHECK( visual );
330 Actor actor = Actor::New();
331 TestVisualRender( application, actor, visual );
333 Vector4 actualValue(Vector4::ZERO);
334 TestGlAbstraction& gl = application.GetGlAbstraction();
335 DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "mixColor", actualValue ) );
336 DALI_TEST_EQUALS( actualValue, testColor, TEST_LOCATION );
338 visual.SetOffStage( actor );
339 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
344 int UtcDaliVisualFactoryGetBorderVisual1(void)
346 ToolkitTestApplication application;
347 tet_infoline( "UtcDaliVisualFactoryGetBorderVisual1: Request border visual with a Property::Map" );
349 VisualFactory factory = VisualFactory::Get();
350 DALI_TEST_CHECK( factory );
352 Property::Map propertyMap;
353 Vector4 testColor( 1.f, 0.5f, 0.3f, 0.2f );
354 float testSize = 5.f;
355 propertyMap.Insert(Visual::Property::TYPE, Visual::BORDER);
356 propertyMap.Insert(BorderVisual::Property::COLOR, testColor);
357 propertyMap.Insert(BorderVisual::Property::SIZE, testSize);
359 Visual::Base visual = factory.CreateVisual(propertyMap);
360 DALI_TEST_CHECK( visual );
362 Actor actor = Actor::New();
363 actor.SetSize(200.f, 200.f);
364 Stage::GetCurrent().Add( actor );
365 visual.SetSize(Vector2(200.f, 200.f));
366 visual.SetOnStage( actor );
368 DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
369 int blendMode = actor.GetRendererAt(0u).GetProperty<int>( Renderer::Property::BLEND_MODE );
370 DALI_TEST_EQUALS( static_cast<BlendingMode::Type>(blendMode), BlendingMode::ON, TEST_LOCATION );
372 TestGlAbstraction& gl = application.GetGlAbstraction();
374 application.SendNotification();
375 application.Render(0);
377 Vector4 actualColor(Vector4::ZERO);
378 DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "borderColor", actualColor ) );
379 DALI_TEST_EQUALS( actualColor, testColor, TEST_LOCATION );
381 float actualSize = 0.f;
382 DALI_TEST_CHECK( gl.GetUniformValue<float>( "borderSize", actualSize ) );
383 DALI_TEST_EQUALS( actualSize, testSize, TEST_LOCATION );
385 visual.SetOffStage( actor );
386 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
391 int UtcDaliVisualFactoryGetBorderVisual2(void)
393 ToolkitTestApplication application;
394 tet_infoline( "UtcDaliVisualFactoryGetBorderVisual2: Request border visual with a borderSize and a borderColor" );
396 VisualFactory factory = VisualFactory::Get();
397 DALI_TEST_CHECK( factory );
399 Vector4 testColor( 1.f, 0.5f, 0.3f, 1.f );
400 float testSize = 5.f;
402 Dali::Property::Map propertyMap;
403 propertyMap[ Visual::Property::TYPE ] = Visual::BORDER;
404 propertyMap[ BorderVisual::Property::COLOR ] = testColor;
405 propertyMap[ BorderVisual::Property::SIZE ] = testSize;
406 Visual::Base visual = factory.CreateVisual( propertyMap );
407 DALI_TEST_CHECK( visual );
409 Actor actor = Actor::New();
410 actor.SetSize(200.f, 200.f);
411 Stage::GetCurrent().Add( actor );
412 visual.SetSize(Vector2(200.f, 200.f));
413 visual.SetOnStage( actor );
415 DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
417 TestGlAbstraction& gl = application.GetGlAbstraction();
419 application.SendNotification();
420 application.Render(0);
422 int blendMode = actor.GetRendererAt(0u).GetProperty<int>( Renderer::Property::BLEND_MODE );
423 DALI_TEST_EQUALS( static_cast<BlendingMode::Type>(blendMode), BlendingMode::AUTO, TEST_LOCATION );
425 Vector4 actualColor(Vector4::ZERO);
426 DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "borderColor", actualColor ) );
427 DALI_TEST_EQUALS( actualColor, testColor, TEST_LOCATION );
429 float actualSize = 0.f;
430 DALI_TEST_CHECK( gl.GetUniformValue<float>( "borderSize", actualSize ) );
431 DALI_TEST_EQUALS( actualSize, testSize, TEST_LOCATION );
433 visual.SetOffStage( actor );
435 // enable the anti-aliasing
436 Dali::Property::Map map;
437 map[ Visual::Property::TYPE ] = Visual::BORDER;
438 map[ BorderVisual::Property::COLOR ] = testColor;
439 map[ BorderVisual::Property::SIZE ] = testSize;
440 map[ BorderVisual::Property::ANTI_ALIASING ] = true;
441 visual = factory.CreateVisual( map );
442 visual.SetOnStage( actor );
444 application.SendNotification();
445 application.Render(0);
446 blendMode = actor.GetRendererAt(0u).GetProperty<int>( Renderer::Property::BLEND_MODE );
447 DALI_TEST_EQUALS( static_cast<BlendingMode::Type>(blendMode), BlendingMode::ON, TEST_LOCATION );
452 int UtcDaliVisualFactoryGetLinearGradientVisual(void)
454 ToolkitTestApplication application;
455 tet_infoline("UtcDaliVisualFactoryGetRadialGradientVisual");
457 VisualFactory factory = VisualFactory::Get();
458 DALI_TEST_CHECK( factory );
460 Property::Map propertyMap;
461 propertyMap.Insert(Visual::Property::TYPE, Visual::GRADIENT);
463 Vector2 start(-1.f, -1.f);
464 Vector2 end(1.f, 1.f);
465 propertyMap.Insert(GradientVisual::Property::START_POSITION, start);
466 propertyMap.Insert(GradientVisual::Property::END_POSITION, end);
467 propertyMap.Insert(GradientVisual::Property::SPREAD_METHOD, GradientVisual::SpreadMethod::REPEAT);
469 Property::Array stopOffsets;
470 stopOffsets.PushBack( 0.2f );
471 stopOffsets.PushBack( 0.8f );
472 propertyMap.Insert(GradientVisual::Property::STOP_OFFSET, stopOffsets);
474 Property::Array stopColors;
475 stopColors.PushBack( Color::RED );
476 stopColors.PushBack( Color::GREEN );
477 propertyMap.Insert(GradientVisual::Property::STOP_COLOR, stopColors);
479 Visual::Base visual = factory.CreateVisual(propertyMap);
480 DALI_TEST_CHECK( visual );
482 // A lookup texture is generated and pass to shader as sampler
483 Actor actor = Actor::New();
484 TestVisualRender( application, actor, visual, 1u );
486 visual.SetOffStage( actor );
487 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
492 int UtcDaliVisualFactoryGetRadialGradientVisual(void)
494 ToolkitTestApplication application;
495 tet_infoline("UtcDaliVisualFactoryGetRadialGradientVisual");
497 VisualFactory factory = VisualFactory::Get();
498 DALI_TEST_CHECK( factory );
500 Property::Map propertyMap;
501 propertyMap.Insert(Visual::Property::TYPE, Visual::GRADIENT);
503 Vector2 center(100.f, 100.f);
504 float radius = 100.f;
505 propertyMap.Insert(GradientVisual::Property::UNITS, GradientVisual::Units::USER_SPACE);
506 propertyMap.Insert(GradientVisual::Property::CENTER, center);
507 propertyMap.Insert(GradientVisual::Property::RADIUS, radius);
509 Property::Array stopOffsets;
510 stopOffsets.PushBack( 0.0f );
511 stopOffsets.PushBack( 1.f );
512 propertyMap.Insert(GradientVisual::Property::STOP_OFFSET, stopOffsets);
514 Property::Array stopColors;
515 stopColors.PushBack( Color::RED );
516 stopColors.PushBack( Color::GREEN );
517 propertyMap.Insert(GradientVisual::Property::STOP_COLOR, stopColors);
519 Visual::Base visual = factory.CreateVisual(propertyMap);
520 DALI_TEST_CHECK( visual );
522 // A lookup texture is generated and pass to shader as sampler
523 Actor actor = Actor::New();
524 TestVisualRender( application, actor, visual, 1u );
526 Matrix3 alignMatrix( radius, 0.f, 0.f, 0.f, radius, 0.f, center.x, center.y, 1.f );
527 alignMatrix.Invert();
529 Matrix3 actualValue( Matrix3::IDENTITY );
530 TestGlAbstraction& gl = application.GetGlAbstraction();
531 DALI_TEST_CHECK( gl.GetUniformValue<Matrix3>( "uAlignmentMatrix", actualValue ) );
532 DALI_TEST_EQUALS( actualValue, alignMatrix, Math::MACHINE_EPSILON_100, TEST_LOCATION );
537 int UtcDaliVisualFactoryDefaultOffsetsGradientVisual(void)
539 ToolkitTestApplication application;
540 tet_infoline("UtcDaliVisualFactoryGetRadialGradientVisual");
542 VisualFactory factory = VisualFactory::Get();
543 DALI_TEST_CHECK( factory );
545 Property::Map propertyMap;
546 propertyMap.Insert(Visual::Property::TYPE, Visual::GRADIENT);
548 Vector2 start(-1.f, -1.f);
549 Vector2 end(1.f, 1.f);
550 propertyMap.Insert(GradientVisual::Property::START_POSITION, start);
551 propertyMap.Insert(GradientVisual::Property::END_POSITION, end);
552 propertyMap.Insert(GradientVisual::Property::SPREAD_METHOD, GradientVisual::SpreadMethod::REPEAT);
554 Property::Array stopColors;
555 stopColors.PushBack( Color::RED );
556 stopColors.PushBack( Color::GREEN );
557 propertyMap.Insert(GradientVisual::Property::STOP_COLOR, stopColors);
559 Visual::Base visual = factory.CreateVisual(propertyMap);
560 DALI_TEST_CHECK( visual );
562 // A lookup texture is generated and pass to shader as sampler
563 Actor actor = Actor::New();
564 TestVisualRender( application, actor, visual, 1u );
566 visual.SetOffStage( actor );
567 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
572 int UtcDaliVisualFactoryGetImageVisual1(void)
574 ToolkitTestApplication application;
575 tet_infoline( "UtcDaliVisualFactoryGetImageVisual1: Request image renderer with a Property::Map" );
577 VisualFactory factory = VisualFactory::Get();
578 DALI_TEST_CHECK( factory );
580 Property::Map propertyMap;
581 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
582 propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
584 Visual::Base visual = factory.CreateVisual( propertyMap );
585 DALI_TEST_CHECK( visual );
587 Actor actor = Actor::New();
588 // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied.
589 // Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
592 const int height=513;
593 TestGlAbstraction& gl = application.GetGlAbstraction();
594 TraceCallStack& textureTrace = gl.GetTextureTrace();
595 textureTrace.Enable(true);
597 Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
598 bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, width, height,width, height );
600 TestVisualRender( application, actor, visual, 1u,
601 ImageDimensions(width, height),
602 Integration::ResourcePointer( bitmap ) );
604 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
606 visual.SetOffStage( actor );
607 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
612 int UtcDaliVisualFactoryGetImageVisual2(void)
614 ToolkitTestApplication application;
615 tet_infoline( "UtcDaliVisualFactoryGetImageVisual2: Request image renderer with an image handle" );
617 VisualFactory factory = VisualFactory::Get();
618 DALI_TEST_CHECK( factory );
620 Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME);
621 Visual::Base visual = factory.CreateVisual( image );
623 Actor actor = Actor::New();
624 // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied.
625 // Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
628 const int height=513;
630 Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
631 bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, width, height,width, height );
633 TestGlAbstraction& gl = application.GetGlAbstraction();
634 TraceCallStack& textureTrace = gl.GetTextureTrace();
635 textureTrace.Enable(true);
637 TestVisualRender( application, actor, visual, 1u,
638 ImageDimensions(width, height),
639 Integration::ResourcePointer(bitmap) );
641 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
646 int UtcDaliVisualFactoryGetNPatchVisual1(void)
648 ToolkitTestApplication application;
649 tet_infoline( "UtcDaliVisualFactoryGetNPatchVisual1: Request 9-patch renderer with a Property::Map" );
651 VisualFactory factory = VisualFactory::Get();
652 DALI_TEST_CHECK( factory );
654 const unsigned int ninePatchImageHeight = 18;
655 const unsigned int ninePatchImageWidth = 28;
656 StretchRanges stretchRangesX;
657 stretchRangesX.PushBack( Uint16Pair( 2, 3 ) );
658 StretchRanges stretchRangesY;
659 stretchRangesY.PushBack( Uint16Pair( 4, 5 ) );
660 Integration::ResourcePointer ninePatchResource = CustomizeNinePatch( application, ninePatchImageWidth, ninePatchImageHeight, stretchRangesX, stretchRangesY );
662 Property::Map propertyMap;
663 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
664 propertyMap.Insert( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME );
666 tet_infoline( "whole grid" );
667 Visual::Base visual = factory.CreateVisual( propertyMap );
668 DALI_TEST_CHECK( visual );
670 Actor actor = Actor::New();
672 TestGlAbstraction& gl = application.GetGlAbstraction();
673 TraceCallStack& textureTrace = gl.GetTextureTrace();
674 textureTrace.Enable(true);
676 TestVisualRender( application, actor, visual, 1u,
677 ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
680 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
683 propertyMap.Insert( ImageVisual::Property::BORDER_ONLY, true );
685 tet_infoline( "border only" );
686 Visual::Base visual = factory.CreateVisual( propertyMap );
687 DALI_TEST_CHECK( visual );
689 Actor actor = Actor::New();
691 TestGlAbstraction& gl = application.GetGlAbstraction();
692 TraceCallStack& textureTrace = gl.GetTextureTrace();
693 textureTrace.Enable(true);
695 TestVisualRender( application, actor, visual, 1u,
696 ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
699 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
705 int UtcDaliVisualFactoryGetNPatchVisual2(void)
707 ToolkitTestApplication application;
708 tet_infoline( "UtcDaliVisualFactoryGetNPatchVisual2: Request n-patch renderer with a Property::Map" );
710 VisualFactory factory = VisualFactory::Get();
711 DALI_TEST_CHECK( factory );
713 const unsigned int ninePatchImageWidth = 18;
714 const unsigned int ninePatchImageHeight = 28;
715 StretchRanges stretchRangesX;
716 stretchRangesX.PushBack( Uint16Pair( 2, 3 ) );
717 stretchRangesX.PushBack( Uint16Pair( 5, 7 ) );
718 stretchRangesX.PushBack( Uint16Pair( 12, 15 ) );
719 StretchRanges stretchRangesY;
720 stretchRangesY.PushBack( Uint16Pair( 4, 5 ) );
721 stretchRangesY.PushBack( Uint16Pair( 8, 12 ) );
722 stretchRangesY.PushBack( Uint16Pair( 15, 16 ) );
723 stretchRangesY.PushBack( Uint16Pair( 25, 27 ) );
724 Integration::ResourcePointer ninePatchResource = CustomizeNinePatch( application, ninePatchImageWidth, ninePatchImageHeight, stretchRangesX, stretchRangesY );
726 Property::Map propertyMap;
727 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
728 propertyMap.Insert( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME );
730 Visual::Base visual = factory.CreateVisual( propertyMap );
731 DALI_TEST_CHECK( visual );
733 Actor actor = Actor::New();
734 TestGlAbstraction& gl = application.GetGlAbstraction();
735 TraceCallStack& textureTrace = gl.GetTextureTrace();
736 textureTrace.Enable(true);
738 TestVisualRender( application, actor, visual, 1u,
739 ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
743 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
745 visual.SetOffStage( actor );
746 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
749 propertyMap.Insert( ImageVisual::Property::BORDER_ONLY, true );
751 tet_infoline( "border only" );
752 Visual::Base visual = factory.CreateVisual( propertyMap );
753 DALI_TEST_CHECK( visual );
755 TestGlAbstraction& gl = application.GetGlAbstraction();
756 TraceCallStack& textureTrace = gl.GetTextureTrace();
757 textureTrace.Enable(true);
758 Actor actor = Actor::New();
759 TestVisualRender( application, actor, visual, 1u,
760 ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
764 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
766 visual.SetOffStage( actor );
767 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
773 int UtcDaliVisualFactoryGetNPatchVisual3(void)
775 ToolkitTestApplication application;
776 tet_infoline( "UtcDaliVisualFactoryGetNPatchVisual3: Request 9-patch renderer with an image url" );
778 VisualFactory factory = VisualFactory::Get();
779 DALI_TEST_CHECK( factory );
781 const unsigned int ninePatchImageHeight = 18;
782 const unsigned int ninePatchImageWidth = 28;
783 StretchRanges stretchRangesX;
784 stretchRangesX.PushBack( Uint16Pair( 2, 3 ) );
785 StretchRanges stretchRangesY;
786 stretchRangesY.PushBack( Uint16Pair( 4, 5 ) );
787 Integration::ResourcePointer ninePatchResource = CustomizeNinePatch( application, ninePatchImageWidth, ninePatchImageHeight, stretchRangesX, stretchRangesY );
789 Visual::Base visual = factory.CreateVisual( TEST_NPATCH_FILE_NAME, ImageDimensions() );
790 DALI_TEST_CHECK( visual );
792 Actor actor = Actor::New();
794 TestGlAbstraction& gl = application.GetGlAbstraction();
795 TraceCallStack& textureTrace = gl.GetTextureTrace();
796 textureTrace.Enable(true);
798 TestVisualRender( application, actor, visual, 1u,
799 ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
802 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
807 int UtcDaliVisualFactoryGetNPatchVisual4(void)
809 ToolkitTestApplication application;
810 tet_infoline( "UtcDaliVisualFactoryGetNPatchVisual4: Request n-patch visual with an image url" );
812 VisualFactory factory = VisualFactory::Get();
813 DALI_TEST_CHECK( factory );
815 const unsigned int ninePatchImageHeight = 18;
816 const unsigned int ninePatchImageWidth = 28;
817 StretchRanges stretchRangesX;
818 stretchRangesX.PushBack( Uint16Pair( 2, 3 ) );
819 stretchRangesX.PushBack( Uint16Pair( 5, 7 ) );
820 stretchRangesX.PushBack( Uint16Pair( 12, 15 ) );
821 StretchRanges stretchRangesY;
822 stretchRangesY.PushBack( Uint16Pair( 4, 5 ) );
823 stretchRangesY.PushBack( Uint16Pair( 8, 12 ) );
824 stretchRangesY.PushBack( Uint16Pair( 15, 16 ) );
825 stretchRangesY.PushBack( Uint16Pair( 25, 27 ) );
826 Integration::ResourcePointer ninePatchResource = CustomizeNinePatch( application, ninePatchImageWidth, ninePatchImageHeight, stretchRangesX, stretchRangesY );
828 Visual::Base visual = factory.CreateVisual( TEST_NPATCH_FILE_NAME, ImageDimensions() );
829 DALI_TEST_CHECK( visual );
831 Actor actor = Actor::New();
833 TestGlAbstraction& gl = application.GetGlAbstraction();
834 TraceCallStack& textureTrace = gl.GetTextureTrace();
835 textureTrace.Enable(true);
837 TestVisualRender( application, actor, visual, 1u,
838 ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
841 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
846 int UtcDaliVisualFactoryGetNPatchVisualN1(void)
848 //This should still load but display an error image
850 ToolkitTestApplication application;
851 tet_infoline( "UtcDaliVisualFactoryGetNPatchVisualN: Request n-patch visual with an invalid image url" );
853 VisualFactory factory = VisualFactory::Get();
854 DALI_TEST_CHECK( factory );
856 Visual::Base visual = factory.CreateVisual( "ERROR.9.jpg", ImageDimensions() );
857 DALI_TEST_CHECK( visual );
859 Actor actor = Actor::New();
861 //The testkit still has to load a bitmap for the broken renderer image
862 Integration::Bitmap* bitmap = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD);
863 bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 100, 100, 100, 100 );
865 TestGlAbstraction& gl = application.GetGlAbstraction();
866 TraceCallStack& textureTrace = gl.GetTextureTrace();
867 textureTrace.Enable(true);
869 TestVisualRender( application, actor, visual, 1u,
871 Integration::ResourcePointer(bitmap) );
873 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
878 int UtcDaliVisualFactoryGetNPatchVisualN2(void)
880 //This should still load but display an error image
882 ToolkitTestApplication application;
883 tet_infoline( "UtcDaliVisualFactoryGetNPatchVisualN: Request n-patch visual with an invalid URL" );
885 VisualFactory factory = VisualFactory::Get();
886 DALI_TEST_CHECK( factory );
888 Property::Map propertyMap;
889 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
890 propertyMap.Insert( ImageVisual::Property::URL, "ERROR.9.jpg" );
892 Visual::Base visual = factory.CreateVisual( propertyMap );
893 DALI_TEST_CHECK( visual );
895 Actor actor = Actor::New();
897 //The testkit still has to load a bitmap for the broken renderer image
898 Integration::Bitmap* bitmap = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD);
899 bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 100, 100, 100, 100 );
901 TestGlAbstraction& gl = application.GetGlAbstraction();
902 TraceCallStack& textureTrace = gl.GetTextureTrace();
903 textureTrace.Enable(true);
905 TestVisualRender( application, actor, visual, 1u,
907 Integration::ResourcePointer(bitmap) );
909 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
914 int UtcDaliVisualFactoryGetNPatchVisualN3(void)
916 // Passing in an invalid visual type so we should not get a visual
918 ToolkitTestApplication application;
919 tet_infoline( "UtcDaliVisualFactoryGetNPatchVisualN: Request n-patch visual with an invalid visual type" );
921 VisualFactory factory = VisualFactory::Get();
922 DALI_TEST_CHECK( factory );
924 Property::Map propertyMap;
925 propertyMap.Insert( Visual::Property::TYPE, 111 );
926 propertyMap.Insert( ImageVisual::Property::URL, "ERROR.9.jpg" );
928 Visual::Base visual = factory.CreateVisual( propertyMap );
929 DALI_TEST_CHECK( !visual );
934 int UtcDaliVisualFactoryGetSvgVisual(void)
936 ToolkitTestApplication application;
937 tet_infoline( "UtcDaliVisualFactoryGetSvgVisual: Request svg visual with a svg url" );
939 VisualFactory factory = VisualFactory::Get();
940 Visual::Base visual = factory.CreateVisual( TEST_SVG_FILE_NAME, ImageDimensions() );
941 DALI_TEST_CHECK( visual );
943 TestGlAbstraction& gl = application.GetGlAbstraction();
944 TraceCallStack& textureTrace = gl.GetTextureTrace();
945 textureTrace.Enable(true);
947 Actor actor = Actor::New();
948 actor.SetSize( 200.f, 200.f );
949 Stage::GetCurrent().Add( actor );
950 visual.SetSize( Vector2(200.f, 200.f) );
951 visual.SetOnStage( actor );
952 application.SendNotification();
953 application.Render();
955 DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
957 EventThreadCallback* eventTrigger = EventThreadCallback::Get();
958 CallbackBase* callback = eventTrigger->GetCallback();
960 eventTrigger->WaitingForTrigger( 1 );// waiting until the svg image is rasterized.
961 CallbackBase::Execute( *callback );
963 DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
965 // waiting for the resource uploading
966 application.SendNotification();
967 application.Render();
969 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
974 //Creates a mesh renderer from the given propertyMap and tries to load it on stage in the given application.
975 //This is expected to succeed, which will then pass the test.
976 void MeshVisualLoadsCorrectlyTest( Property::Map& propertyMap, ToolkitTestApplication& application )
978 VisualFactory factory = VisualFactory::Get();
979 DALI_TEST_CHECK( factory );
981 //Create a mesh visual.
982 Visual::Base visual = factory.CreateVisual( propertyMap );
983 DALI_TEST_CHECK( visual );
985 //Create an actor on stage to house the visual.
986 Actor actor = Actor::New();
987 actor.SetSize( 200.f, 200.f );
988 Stage::GetCurrent().Add( actor );
989 visual.SetSize( Vector2( 200.f, 200.f ) );
990 visual.SetOnStage( actor );
992 //Ensure set on stage.
993 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
995 //Attempt to render to queue resource load requests.
996 application.SendNotification();
997 application.Render( 0 );
999 //Tell the platform abstraction that the required resources have been loaded.
1000 TestPlatformAbstraction& platform = application.GetPlatform();
1001 platform.SetAllResourceRequestsAsLoaded();
1003 //Render again to upload the now-loaded textures.
1004 application.SendNotification();
1005 application.Render( 0 );
1007 Matrix testScaleMatrix;
1008 testScaleMatrix.SetIdentityAndScale( Vector3( 1.0, -1.0, 1.0 ) );
1009 Matrix actualScaleMatrix;
1011 //Test to see if the object has been successfully loaded.
1012 DALI_TEST_CHECK( application.GetGlAbstraction().GetUniformValue<Matrix>( "uObjectMatrix", actualScaleMatrix ) );
1013 DALI_TEST_EQUALS( actualScaleMatrix, testScaleMatrix, Math::MACHINE_EPSILON_100, TEST_LOCATION );
1015 //Finish by setting off stage, and ensuring this was successful.
1016 visual.SetOffStage( actor );
1017 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
1020 //Creates a mesh visual from the given propertyMap and tries to load it on stage in the given application.
1021 //This is expected to fail, which will then pass the test.
1022 void MeshVisualDoesNotLoadCorrectlyTest( Property::Map& propertyMap, ToolkitTestApplication& application )
1024 VisualFactory factory = VisualFactory::Get();
1025 DALI_TEST_CHECK( factory );
1027 //Create a mesh visual.
1028 Visual::Base visual = factory.CreateVisual( propertyMap );
1029 DALI_TEST_CHECK( visual );
1031 //Create an actor on stage to house the visual.
1032 Actor actor = Actor::New();
1033 actor.SetSize( 200.f, 200.f );
1034 Stage::GetCurrent().Add( actor );
1035 visual.SetSize( Vector2( 200.f, 200.f ) );
1036 visual.SetOnStage( actor );
1038 //Ensure set on stage.
1039 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
1041 //Attempt to render to queue resource load requests.
1042 application.SendNotification();
1043 application.Render( 0 );
1045 //Tell the platform abstraction that the required resources have been loaded.
1046 TestPlatformAbstraction& platform = application.GetPlatform();
1047 platform.SetAllResourceRequestsAsLoaded();
1049 //Render again to upload the now-loaded textures.
1050 application.SendNotification();
1051 application.Render( 0 );
1053 //Test to see if the object has not been loaded, as expected.
1055 DALI_TEST_CHECK( !application.GetGlAbstraction().GetUniformValue<Matrix>( "uObjectMatrix", scaleMatrix ) );
1057 //Finish by setting off stage, and ensuring this was successful.
1058 visual.SetOffStage( actor );
1059 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
1062 //Test if mesh loads correctly when supplied with only the bare minimum requirements, an object file.
1063 int UtcDaliVisualFactoryGetMeshVisual1(void)
1065 //Set up test application first, so everything else can be handled.
1066 ToolkitTestApplication application;
1068 tet_infoline( "UtcDaliVisualFactoryGetMeshVisual1: Request mesh visual with a valid object file only" );
1071 //Set up visual properties.
1072 Property::Map propertyMap;
1073 propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
1074 propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
1076 //Test to see if mesh loads correctly.
1077 MeshVisualLoadsCorrectlyTest( propertyMap, application );
1083 //Test if mesh loads correctly when supplied with an object file as well as a blank material file and images directory.
1084 int UtcDaliVisualFactoryGetMeshVisual2(void)
1086 //Set up test application first, so everything else can be handled.
1087 ToolkitTestApplication application;
1089 tet_infoline( "UtcDaliVisualFactoryGetMeshVisual2: Request mesh visual with blank material file and images directory" );
1091 //Set up visual properties.
1092 Property::Map propertyMap;
1093 propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
1094 propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
1095 propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, "" );
1096 propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, "" );
1098 //Test to see if mesh loads correctly.
1099 MeshVisualLoadsCorrectlyTest( propertyMap, application );
1104 //Test if mesh loads correctly when supplied with all main parameters, an object file, a material file and a directory location.
1105 int UtcDaliVisualFactoryGetMeshVisual3(void)
1107 //Set up test application first, so everything else can be handled.
1108 ToolkitTestApplication application;
1110 tet_infoline( "UtcDaliVisualFactoryGetMeshVisual3: Request mesh visual with all parameters correct" );
1112 //Set up visual properties.
1113 Property::Map propertyMap;
1114 propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
1115 propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
1116 propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
1117 propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
1119 //Test to see if mesh loads correctly.
1120 MeshVisualLoadsCorrectlyTest( propertyMap, application );
1125 //Test if mesh visual can load a correctly supplied mesh without a normal map or gloss map in the material file.
1126 int UtcDaliVisualFactoryGetMeshVisual4(void)
1128 //Set up test application first, so everything else can be handled.
1129 ToolkitTestApplication application;
1131 tet_infoline( "UtcDaliVisualFactoryGetMeshVisual4: Request mesh visual with diffuse texture but not normal or gloss." );
1134 //Set up visual properties.
1135 Property::Map propertyMap;
1136 propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
1137 propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
1138 propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_SIMPLE_MTL_FILE_NAME );
1139 propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
1141 //Test to see if mesh loads correctly.
1142 MeshVisualLoadsCorrectlyTest( propertyMap, application );
1148 //Test if mesh visual can load when made to use diffuse textures only.
1149 int UtcDaliVisualFactoryGetMeshVisual5(void)
1151 //Set up test application first, so everything else can be handled.
1152 ToolkitTestApplication application;
1154 tet_infoline( "UtcDaliVisualFactoryGetMeshVisual5: Request mesh visual and make it only use diffuse textures." );
1156 //Set up visual properties.
1157 Property::Map propertyMap;
1158 propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
1159 propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
1160 propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
1161 propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
1162 propertyMap.Insert( MeshVisual::Property::SHADING_MODE, MeshVisual::ShadingMode::TEXTURED_WITH_SPECULAR_LIGHTING );
1164 //Test to see if mesh loads correctly.
1165 MeshVisualLoadsCorrectlyTest( propertyMap, application );
1171 //Test if mesh visual can load when made to not use the supplied textures.
1172 int UtcDaliVisualFactoryGetMeshVisual6(void)
1174 //Set up test application first, so everything else can be handled.
1175 ToolkitTestApplication application;
1177 tet_infoline( "UtcDaliVisualFactoryGetMeshVisual6: Request mesh visual and make it not use any textures." );
1179 //Set up visual properties.
1180 Property::Map propertyMap;
1181 propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
1182 propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
1183 propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
1184 propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
1185 propertyMap.Insert( MeshVisual::Property::SHADING_MODE, MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING );
1187 //Test to see if mesh loads correctly.
1188 MeshVisualLoadsCorrectlyTest( propertyMap, application );
1192 //Test if mesh visual loads correctly when light position is manually set.
1193 int UtcDaliVisualFactoryGetMeshVisual7(void)
1195 //Set up test application first, so everything else can be handled.
1196 ToolkitTestApplication application;
1199 tet_infoline( "UtcDaliVisualFactoryGetMeshVisual7: Request mesh visual with custom light position." );
1201 //Set up visual properties.
1202 Property::Map propertyMap;
1203 propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
1204 propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
1205 propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
1206 propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
1207 propertyMap.Insert( MeshVisual::Property::LIGHT_POSITION, Vector3( 0.0, 1.0, 2.0 ) );
1209 //Test to see if mesh loads correctly.
1210 MeshVisualLoadsCorrectlyTest( propertyMap, application );
1215 //Test if mesh visual loads correctly when supplied an object file without face normals or texture points.
1216 //Note that this notably tests object loader functionality.
1217 int UtcDaliVisualFactoryGetMeshVisual8(void)
1219 //Set up test application first, so everything else can be handled.
1220 ToolkitTestApplication application;
1222 tet_infoline( "UtcDaliVisualFactoryGetMeshVisual5: Request mesh visual with normal-less object file." );
1224 //Set up visual properties.
1225 Property::Map propertyMap;
1226 propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
1227 propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_SIMPLE_OBJ_FILE_NAME );
1228 propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
1229 propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
1231 //Test to see if mesh loads correctly.
1232 MeshVisualLoadsCorrectlyTest( propertyMap, application );
1237 //Test if mesh visual handles the case of lacking an object file.
1238 int UtcDaliVisualFactoryGetMeshVisualN1(void)
1240 //Set up test application first, so everything else can be handled.
1241 ToolkitTestApplication application;
1243 tet_infoline( "UtcDaliVisualFactoryGetMeshVisualN1: Request mesh visual without object file" );
1245 //Set up visual properties.
1246 Property::Map propertyMap;
1247 propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
1248 propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
1249 propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
1251 //Test to see if mesh doesn't load with these properties, as expected.
1252 MeshVisualDoesNotLoadCorrectlyTest( propertyMap, application );
1258 //Test if mesh visual handles the case of being passed invalid material and images urls.
1259 int UtcDaliVisualFactoryGetMeshVisualN2(void)
1261 //Set up test application first, so everything else can be handled.
1262 ToolkitTestApplication application;
1264 tet_infoline( "UtcDaliVisualFactoryGetMeshVisualN2: Request mesh visual with invalid material and images urls" );
1266 //Set up visual properties.
1267 Property::Map propertyMap;
1268 propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
1269 propertyMap.Insert( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
1270 propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, "invalid" );
1271 propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, "also invalid" );
1273 //Test to see if mesh doesn't load with these properties, as expected.
1274 MeshVisualDoesNotLoadCorrectlyTest( propertyMap, application );
1280 //Test if mesh visual handles the case of being passed an invalid object url
1281 int UtcDaliVisualFactoryGetMeshVisualN3(void)
1283 //Set up test application first, so everything else can be handled.
1284 ToolkitTestApplication application;
1285 tet_infoline( "UtcDaliVisualFactoryGetMeshVisualN3: Request mesh visual with invalid object url" );
1288 //Set up visual properties.
1289 Property::Map propertyMap;
1290 propertyMap.Insert( Visual::Property::TYPE, Visual::MESH );
1291 propertyMap.Insert( MeshVisual::Property::OBJECT_URL, "invalid" );
1292 propertyMap.Insert( MeshVisual::Property::MATERIAL_URL, TEST_MTL_FILE_NAME );
1293 propertyMap.Insert( MeshVisual::Property::TEXTURES_PATH, TEST_RESOURCE_DIR "/" );
1295 //Test to see if mesh doesn't load with these properties, as expected.
1296 MeshVisualDoesNotLoadCorrectlyTest( propertyMap, application );
1301 //Creates a primitive visual with the given property map and tests to see if it correctly loads in the given application.
1302 void TestPrimitiveVisualWithProperties( Property::Map& propertyMap, ToolkitTestApplication& application )
1304 VisualFactory factory = VisualFactory::Get();
1305 DALI_TEST_CHECK( factory );
1307 //Create a primitive visual.
1308 Visual::Base visual = factory.CreateVisual( propertyMap );
1309 DALI_TEST_CHECK( visual );
1311 //Create an actor on stage to house the visual.
1312 Actor actor = Actor::New();
1313 actor.SetSize( 200.f, 200.f );
1314 Stage::GetCurrent().Add( actor );
1315 visual.SetSize( Vector2( 200.f, 200.f ) );
1316 visual.SetOnStage( actor );
1318 //Ensure set on stage.
1319 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
1321 //Tell test application to load the visual.
1322 application.SendNotification();
1323 application.Render(0);
1325 Matrix testScaleMatrix;
1326 testScaleMatrix.SetIdentityAndScale( Vector3( 1.0, -1.0, 1.0 ) );
1327 Matrix actualScaleMatrix;
1329 //Test to see if the object has been successfully loaded.
1330 DALI_TEST_CHECK( application.GetGlAbstraction().GetUniformValue<Matrix>( "uObjectMatrix", actualScaleMatrix ) );
1331 DALI_TEST_EQUALS( actualScaleMatrix, testScaleMatrix, Math::MACHINE_EPSILON_100, TEST_LOCATION );
1333 //Finish by setting off stage, and ensuring this was successful.
1334 visual.SetOffStage( actor );
1335 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
1338 //Test if primitive shape loads correctly when supplied with only the bare minimum requirements, the shape to use.
1339 int UtcDaliVisualFactoryGetPrimitiveVisual1(void)
1341 //Set up test application first, so everything else can be handled.
1342 ToolkitTestApplication application;
1344 tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual1: Request primitive visual with a shape only" );
1346 //Set up visual properties.
1347 Property::Map propertyMap;
1348 propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
1349 propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CUBE );
1351 //Test to see if shape loads correctly.
1352 TestPrimitiveVisualWithProperties( propertyMap, application );
1357 //Test if primitive shape loads correctly when supplied with all possible parameters
1358 int UtcDaliVisualFactoryGetPrimitiveVisual2(void)
1360 //Set up test application first, so everything else can be handled.
1361 ToolkitTestApplication application;
1363 tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual2: Request primitive visual with everything" );
1365 //Set up visual properties.
1366 Property::Map propertyMap;
1367 propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
1368 propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CUBE );
1369 propertyMap.Insert( PrimitiveVisual::Property::MIX_COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
1370 propertyMap.Insert( PrimitiveVisual::Property::SLICES, 10 );
1371 propertyMap.Insert( PrimitiveVisual::Property::STACKS, 20 );
1372 propertyMap.Insert( PrimitiveVisual::Property::SCALE_TOP_RADIUS, 30.0f );
1373 propertyMap.Insert( PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS, 40.0f );
1374 propertyMap.Insert( PrimitiveVisual::Property::SCALE_HEIGHT, 50.0f );
1375 propertyMap.Insert( PrimitiveVisual::Property::SCALE_RADIUS, 60.0f );
1376 propertyMap.Insert( PrimitiveVisual::Property::BEVEL_PERCENTAGE, 0.7f );
1377 propertyMap.Insert( PrimitiveVisual::Property::BEVEL_SMOOTHNESS, 0.8f );
1378 propertyMap.Insert( MeshVisual::Property::LIGHT_POSITION, Vector3( 0.9, 1.0, 1.1 ) );
1380 //Test to see if shape loads correctly.
1381 TestPrimitiveVisualWithProperties( propertyMap, application );
1386 //Test if primitive shape loads a sphere correctly.
1387 int UtcDaliVisualFactoryGetPrimitiveVisual3(void)
1389 //Set up test application first, so everything else can be handled.
1390 ToolkitTestApplication application;
1392 tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual3: Request primitive visual to display a sphere" );
1394 //Set up visual properties.
1395 Property::Map propertyMap;
1396 propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
1397 propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
1398 propertyMap.Insert( PrimitiveVisual::Property::MIX_COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
1399 propertyMap.Insert( PrimitiveVisual::Property::SLICES, 10 );
1400 propertyMap.Insert( PrimitiveVisual::Property::STACKS, 20 );
1402 //Test to see if shape loads correctly.
1403 TestPrimitiveVisualWithProperties( propertyMap, application );
1408 //Test if primitive shape loads a conic section correctly.
1409 int UtcDaliVisualFactoryGetPrimitiveVisual4(void)
1411 //Set up test application first, so everything else can be handled.
1412 ToolkitTestApplication application;
1414 tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual4: Request primitive visual to display a conic section" );
1416 //Set up visual properties.
1417 Property::Map propertyMap;
1418 propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
1419 propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CONICAL_FRUSTRUM );
1420 propertyMap.Insert( PrimitiveVisual::Property::MIX_COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
1421 propertyMap.Insert( PrimitiveVisual::Property::SLICES, 10 );
1422 propertyMap.Insert( PrimitiveVisual::Property::SCALE_TOP_RADIUS, 30.0f );
1423 propertyMap.Insert( PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS, 40.0f );
1424 propertyMap.Insert( PrimitiveVisual::Property::SCALE_HEIGHT, 50.0f );
1426 //Test to see if shape loads correctly.
1427 TestPrimitiveVisualWithProperties( propertyMap, application );
1432 //Test if primitive shape loads a bevelled cube correctly.
1433 int UtcDaliVisualFactoryGetPrimitiveVisual5(void)
1435 //Set up test application first, so everything else can be handled.
1436 ToolkitTestApplication application;
1438 tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual5: Request primitive visual to display a bevelled cube" );
1440 //Set up visual properties.
1441 Property::Map propertyMap;
1442 propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
1443 propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::BEVELLED_CUBE );
1444 propertyMap.Insert( PrimitiveVisual::Property::MIX_COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
1445 propertyMap.Insert( PrimitiveVisual::Property::BEVEL_PERCENTAGE, 0.7f );
1447 //Test to see if shape loads correctly.
1448 TestPrimitiveVisualWithProperties( propertyMap, application );
1453 //Test if primitive shape loads an octahedron correctly.
1454 int UtcDaliVisualFactoryGetPrimitiveVisual6(void)
1456 //Set up test application first, so everything else can be handled.
1457 ToolkitTestApplication application;
1459 tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual6: Request primitive visual to display an octahedron" );
1461 //Set up visual properties.
1462 Property::Map propertyMap;
1463 propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
1464 propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::OCTAHEDRON );
1465 propertyMap.Insert( PrimitiveVisual::Property::MIX_COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
1467 //Test to see if shape loads correctly.
1468 TestPrimitiveVisualWithProperties( propertyMap, application );
1473 //Test if primitive shape loads a cone correctly.
1474 int UtcDaliVisualFactoryGetPrimitiveVisual7(void)
1476 //Set up test application first, so everything else can be handled.
1477 ToolkitTestApplication application;
1479 tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual7: Request primitive visual to display a cone" );
1481 //Set up visual properties.
1482 Property::Map propertyMap;
1483 propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
1484 propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CONE );
1485 propertyMap.Insert( PrimitiveVisual::Property::MIX_COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
1486 propertyMap.Insert( PrimitiveVisual::Property::SLICES, 10 );
1487 propertyMap.Insert( PrimitiveVisual::Property::SCALE_TOP_RADIUS, 30.0f );
1488 propertyMap.Insert( PrimitiveVisual::Property::SCALE_HEIGHT, 50.0f );
1490 //Test to see if shape loads correctly.
1491 TestPrimitiveVisualWithProperties( propertyMap, application );
1496 //Test if primitive shape loads correctly when light position is manually set.
1497 int UtcDaliVisualFactoryGetPrimitiveVisual8(void)
1499 //Set up test application first, so everything else can be handled.
1500 ToolkitTestApplication application;
1502 tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual8: Request primitive visual with set light position" );
1504 //Set up visual properties.
1505 Property::Map propertyMap;
1506 propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
1507 propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
1508 propertyMap.Insert( PrimitiveVisual::Property::MIX_COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
1509 propertyMap.Insert( MeshVisual::Property::LIGHT_POSITION, Vector3( 0.0, 1.0, 2.0 ) );
1511 //Test to see if shape loads correctly.
1512 TestPrimitiveVisualWithProperties( propertyMap, application );
1517 //Test if primitive shape loads correctly when told to use too many slices.
1518 int UtcDaliVisualFactoryGetPrimitiveVisual9(void)
1520 //Set up test application first, so everything else can be handled.
1521 ToolkitTestApplication application;
1523 tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual9: Request primitive visual with above-cap slices." );
1525 //Set up visual properties.
1526 Property::Map propertyMap;
1527 propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
1528 propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
1529 propertyMap.Insert( PrimitiveVisual::Property::SLICES, Property::Value( 1000000 ) );
1531 //Test to see if shape loads correctly.
1532 TestPrimitiveVisualWithProperties( propertyMap, application );
1537 //Test if primitive shape loads correctly when told to use too few slices. (2 slices or less.)
1538 int UtcDaliVisualFactoryGetPrimitiveVisual10(void)
1540 //Set up test application first, so everything else can be handled.
1541 ToolkitTestApplication application;
1543 tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual10: Request primitive visual with too few slices." );
1545 //Set up visual properties.
1546 Property::Map propertyMap;
1547 propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
1548 propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
1549 propertyMap.Insert( PrimitiveVisual::Property::SLICES, Property::Value( 2 ) );
1551 //Test to see if shape loads correctly.
1552 TestPrimitiveVisualWithProperties( propertyMap, application );
1557 //Test if primitive shape loads correctly when told to use too many stacks.
1558 int UtcDaliVisualFactoryGetPrimitiveVisual11(void)
1560 //Set up test application first, so everything else can be handled.
1561 ToolkitTestApplication application;
1563 tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual11: Request primitive visual with too many stacks." );
1565 //Set up visual properties.
1566 Property::Map propertyMap;
1567 propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
1568 propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
1569 propertyMap.Insert( PrimitiveVisual::Property::STACKS, Property::Value( 1000000 ) );
1571 //Test to see if shape loads correctly.
1572 TestPrimitiveVisualWithProperties( propertyMap, application );
1577 //Test if primitive shape loads correctly when told to use too few stacks. (1 stack or less.)
1578 int UtcDaliVisualFactoryGetPrimitiveVisual12(void)
1580 //Set up test application first, so everything else can be handled.
1581 ToolkitTestApplication application;
1583 tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual12: Request primitive visual with too few stacks." );
1585 //Set up visual properties.
1586 Property::Map propertyMap;
1587 propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
1588 propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
1589 propertyMap.Insert( PrimitiveVisual::Property::STACKS, Property::Value( 1 ) );
1591 //Test to see if shape loads correctly.
1592 TestPrimitiveVisualWithProperties( propertyMap, application );
1597 //Test if primitive shape loads correctly when told to use invalid (zero or negative) dimensions.
1598 int UtcDaliVisualFactoryGetPrimitiveVisual13(void)
1600 //Set up test application first, so everything else can be handled.
1601 ToolkitTestApplication application;
1603 tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual13: Request primitive visual with invalid scale dimensions." );
1605 //Set up visual properties.
1606 Property::Map propertyMap;
1607 propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
1608 propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
1609 propertyMap.Insert( PrimitiveVisual::Property::SCALE_DIMENSIONS, Vector3::ZERO );
1611 //Test to see if shape loads correctly.
1612 TestPrimitiveVisualWithProperties( propertyMap, application );
1617 //Test if primitive shape loads correctly when told to use too low a bevel percentage.
1618 int UtcDaliVisualFactoryGetPrimitiveVisual14(void)
1620 //Set up test application first, so everything else can be handled.
1621 ToolkitTestApplication application;
1623 tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual14: Request primitive visual with too low a bevel percentage." );
1625 //Set up visual properties.
1626 Property::Map propertyMap;
1627 propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
1628 propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
1629 propertyMap.Insert( PrimitiveVisual::Property::BEVEL_PERCENTAGE, Property::Value( -1.0f ) );
1631 //Test to see if shape loads correctly.
1632 TestPrimitiveVisualWithProperties( propertyMap, application );
1637 //Test if primitive shape loads correctly when told to use too high a bevel percentage.
1638 int UtcDaliVisualFactoryGetPrimitiveVisual15(void)
1640 //Set up test application first, so everything else can be handled.
1641 ToolkitTestApplication application;
1643 tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual15: Request primitive visual with too high a bevel percentage." );
1645 //Set up visual properties.
1646 Property::Map propertyMap;
1647 propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
1648 propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
1649 propertyMap.Insert( PrimitiveVisual::Property::BEVEL_PERCENTAGE, Property::Value( 2.0f ) );
1651 //Test to see if shape loads correctly.
1652 TestPrimitiveVisualWithProperties( propertyMap, application );
1657 //Test if primitive shape loads correctly when told to use too low a bevel smoothness.
1658 int UtcDaliVisualFactoryGetPrimitiveVisual16(void)
1660 //Set up test application first, so everything else can be handled.
1661 ToolkitTestApplication application;
1663 tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual16: Request primitive visual with too low a bevel smoothness." );
1665 //Set up visual properties.
1666 Property::Map propertyMap;
1667 propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
1668 propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
1669 propertyMap.Insert( PrimitiveVisual::Property::BEVEL_SMOOTHNESS, Property::Value( -1.0f ) );
1671 //Test to see if shape loads correctly.
1672 TestPrimitiveVisualWithProperties( propertyMap, application );
1677 //Test if primitive shape loads correctly when told to use too high a bevel smoothness.
1678 int UtcDaliVisualFactoryGetPrimitiveVisual17(void)
1680 //Set up test application first, so everything else can be handled.
1681 ToolkitTestApplication application;
1683 tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual17: Request primitive visual with too high a bevel smoothness." );
1685 //Set up visual properties.
1686 Property::Map propertyMap;
1687 propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
1688 propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
1689 propertyMap.Insert( PrimitiveVisual::Property::BEVEL_SMOOTHNESS, Property::Value( 2.0f ) );
1691 //Test to see if shape loads correctly.
1692 TestPrimitiveVisualWithProperties( propertyMap, application );
1697 //Test if primitive shape renderer handles the case of not being passed a specific shape to use.
1698 int UtcDaliVisualFactoryGetPrimitiveVisualN1(void)
1700 //Set up test application first, so everything else can be handled.
1701 ToolkitTestApplication application;
1703 tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisualN1: Request primitive visual without shape" );
1705 //Set up visual properties, without supplying shape.
1706 Property::Map propertyMap;
1707 propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
1709 //Test to see if shape loads regardless of missing input.
1710 TestPrimitiveVisualWithProperties( propertyMap, application );