本文整理汇总了C++中ToolkitTestApplication::GetPlatform方法的典型用法代码示例。如果您正苦于以下问题:C++ ToolkitTestApplication::GetPlatform方法的具体用法?C++ ToolkitTestApplication::GetPlatform怎么用?C++ ToolkitTestApplication::GetPlatform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToolkitTestApplication
的用法示例。
在下文中一共展示了ToolkitTestApplication::GetPlatform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UtcDaliControlRendererSize
int UtcDaliControlRendererSize(void)
{
ToolkitTestApplication application;
tet_infoline( "UtcDaliControlRendererGetNaturalSize" );
RendererFactory factory = RendererFactory::Get();
Vector2 rendererSize( 20.f, 30.f );
Vector2 naturalSize;
// color renderer
ControlRenderer colorRenderer = factory.GetControlRenderer( Color::MAGENTA );
colorRenderer.SetSize( rendererSize );
DALI_TEST_EQUALS( colorRenderer.GetSize(), rendererSize, TEST_LOCATION );
colorRenderer.GetNaturalSize(naturalSize);
DALI_TEST_EQUALS( naturalSize, Vector2::ZERO, TEST_LOCATION );
// image renderer
Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME, ImageDimensions(100, 200));
ControlRenderer imageRenderer = factory.GetControlRenderer( image );
imageRenderer.SetSize( rendererSize );
DALI_TEST_EQUALS( imageRenderer.GetSize(), rendererSize, TEST_LOCATION );
imageRenderer.GetNaturalSize(naturalSize);
DALI_TEST_EQUALS( naturalSize, Vector2(100.f, 200.f), TEST_LOCATION );
// n patch renderer
TestPlatformAbstraction& platform = application.GetPlatform();
Vector2 testSize(80.f, 160.f);
platform.SetClosestImageSize(testSize);
image = ResourceImage::New(TEST_NPATCH_FILE_NAME);
ControlRenderer nPatchRenderer = factory.GetControlRenderer( image );
nPatchRenderer.SetSize( rendererSize );
DALI_TEST_EQUALS( nPatchRenderer.GetSize(), rendererSize, TEST_LOCATION );
nPatchRenderer.GetNaturalSize(naturalSize);
DALI_TEST_EQUALS( naturalSize, testSize, TEST_LOCATION );
// border renderer
float borderSize = 5.f;
ControlRenderer borderRenderer = factory.GetControlRenderer( borderSize, Color::RED );
borderRenderer.SetSize( rendererSize );
DALI_TEST_EQUALS( borderRenderer.GetSize(), rendererSize, TEST_LOCATION );
borderRenderer.GetNaturalSize(naturalSize);
DALI_TEST_EQUALS( naturalSize, Vector2::ZERO, TEST_LOCATION );
// gradient renderer
Property::Map propertyMap;
propertyMap.Insert("renderer-type", "gradient-renderer");
Vector2 start(-1.f, -1.f);
Vector2 end(1.f, 1.f);
propertyMap.Insert("gradient-start-position", start);
propertyMap.Insert("gradient-end-position", end);
propertyMap.Insert("gradient-stop-offset", Vector2(0.f, 1.f));
Property::Array stopColors;
stopColors.PushBack( Color::RED );
stopColors.PushBack( Color::GREEN );
propertyMap.Insert("gradient-stop-color", stopColors);
ControlRenderer gradientRenderer = factory.GetControlRenderer(propertyMap);
gradientRenderer.SetSize( rendererSize );
DALI_TEST_EQUALS( gradientRenderer.GetSize(), rendererSize, TEST_LOCATION );
gradientRenderer.GetNaturalSize(naturalSize);
DALI_TEST_EQUALS( naturalSize, Vector2::ZERO,TEST_LOCATION );
END_TEST;
}