本文整理汇总了C++中TestApplication::GetPlatform方法的典型用法代码示例。如果您正苦于以下问题:C++ TestApplication::GetPlatform方法的具体用法?C++ TestApplication::GetPlatform怎么用?C++ TestApplication::GetPlatform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestApplication
的用法示例。
在下文中一共展示了TestApplication::GetPlatform方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UtcDaliImageFactoryReload03
// Test for reloading changed image
int UtcDaliImageFactoryReload03(void)
{
TestApplication application;
tet_infoline( "UtcDaliImageFactoryReload03 - Reload changed image" );
ImageFactory& imageFactory = Internal::ThreadLocalStorage::Get().GetImageFactory();
Vector2 testSize( 80.0f, 80.0f );
application.GetPlatform().SetClosestImageSize( testSize );
RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
application.SendNotification();
application.Render();
// emulate load success
EmulateImageLoaded( application, 80, 80 );
Vector2 newSize( 192.0f, 192.0f );
application.GetPlatform().SetClosestImageSize( newSize );
// Image file changed size, new resource request should be issued
ResourceTicketPtr ticket2 = imageFactory.Reload( *req.Get() );
DALI_TEST_CHECK( ticket != ticket2 );
ResourceTicketPtr ticket3 = imageFactory.Reload( *req.Get() );
DALI_TEST_EQUALS( ticket2, ticket3, TEST_LOCATION );
END_TEST;
}
示例2: UtcDaliImageFactoryUseCachedRequest01
// High-level test for image factory request cache
int UtcDaliImageFactoryUseCachedRequest01(void)
{
TestApplication application;
tet_infoline( "UtcDaliImageFactoryCachedRequest01 - Request same image more than once" );
Image image = ResourceImage::New( gTestImageFilename );
application.SendNotification();
application.Render();
DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
application.GetPlatform().ResetTrace();
Image image2 = ResourceImage::New( gTestImageFilename );
application.SendNotification();
application.Render();
// check resource is not loaded twice
DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
application.GetPlatform().ResetTrace();
Image image3 = ResourceImage::New( gTestImageFilename );
application.SendNotification();
application.Render();
DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
END_TEST;
}
示例3: UtcDaliImageFactoryUseCachedRequest02
// High-level test for image factory request cache
int UtcDaliImageFactoryUseCachedRequest02(void)
{
TestApplication application;
// testing resource deletion when taken off stage
tet_infoline( "UtcDaliImageFactoryCachedRequest02 - Discard previously requested resource" );
Image image = ResourceImage::New( gTestImageFilename, ResourceImage::IMMEDIATE, Image::UNUSED );
ImageActor actor = ImageActor::New( image );
application.SendNotification();
application.Render();
DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
application.GetPlatform().ResetTrace();
// Add actor to stage
Stage::GetCurrent().Add( actor );
application.Render();
application.SendNotification();
application.Render();
application.SendNotification();
// Release the resource, request is still cached
Stage::GetCurrent().Remove( actor );
application.Render();
application.SendNotification();
application.Render();
application.SendNotification();
// Should find stale request in cache, so load image from filesystem
Image image2 = ResourceImage::New( gTestImageFilename );
application.SendNotification();
application.Render();
DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
application.GetPlatform().ResetTrace();
// Resource is reloaded
Image image3 = ResourceImage::New( gTestImageFilename );
application.SendNotification();
application.Render();
application.SendNotification();
application.Render();
DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
END_TEST;
}
示例4: UtcDaliImageActorGetCurrentImageSize03
int UtcDaliImageActorGetCurrentImageSize03(void)
{
TestApplication application;
tet_infoline("Positive test for Dali::ImageActor::GetCurrentImageSize - Test that using an image resource with a requested size sets the actor size with it's nearest size immediately rather than on load");
Vector2 closestImageSize( 80, 45);
application.GetPlatform().SetClosestImageSize(closestImageSize);
ImageAttributes attrs;
attrs.SetSize(40, 30);
Image image = Image::New("image.jpg", attrs);
ImageActor actor = ImageActor::New( image );
Stage::GetCurrent().Add(actor);
application.SendNotification(); // Flush update messages
application.Render(); // Process resource request
application.SendNotification(); // Flush update messages
application.Render(); // Process resource request
DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );
// Now complete the image load
Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );
Integration::ResourcePointer resourcePtr(bitmap); // reference it
application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
application.Render(); // Process LoadComplete
application.SendNotification(); // Process event messages
application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
application.GetPlatform().ClearReadyResources(); //
DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );
// Test that setting a size on the actor can be 'undone' with SetNaturalSize()
Vector2 size(200.0f, 200.0f);
actor.SetSize(size);
// flush the queue and render once
application.SendNotification();
application.Render();
DALI_TEST_EQUALS( actor.GetCurrentImageSize(), size, TEST_LOCATION );
actor.SetToNaturalSize();
application.SendNotification();
application.Render();
DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );
END_TEST;
}
示例5: UtcDaliImageFactoryReload06
// Initally two different requests map to same resource.
// After overwriting the file, they load different image resources.
int UtcDaliImageFactoryReload06(void)
{
TestApplication application;
tet_infoline( "UtcDaliImageFactoryReload06 - Two requests first mapping to same resource, then different resources." );
ImageFactory& imageFactory = Internal::ThreadLocalStorage::Get().GetImageFactory();
Vector2 testSize(2048.0f, 2048.0f);
application.GetPlatform().SetClosestImageSize( testSize );
// request with default attributes ( size is 0,0 )
RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
application.SendNotification();
application.Render();
application.SendNotification();
application.Render();
// emulate load success
EmulateImageLoaded( application, testSize.x, testSize.y );
// Request bigger size than actual image.
// This will load the same resource.
// However if image size changes later on to eg. 512*512 (file is overwritten),
// reissuing these two requests will load different resources.
ImageAttributes attr = ImageAttributes::New();
attr.SetSize( testSize.x + 1, testSize.y + 1 );
RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );
DALI_TEST_CHECK( req != req2 ); // different requests
DALI_TEST_EQUALS( ticket->GetId(), ticket2->GetId(), TEST_LOCATION ); // same resource
Vector2 newSize(512.0f, 512.0f);
application.GetPlatform().SetClosestImageSize(newSize);
// reload fixed size (192,192) request
ticket2 = imageFactory.Reload( *req2.Get() );
// emulate load success
// note: this is the only way to emulate what size is loaded by platform abstraction
EmulateImageLoaded( application, testSize.x + 1, testSize.y + 1 );
// reload default size request
ticket = imageFactory.Reload( *req.Get() );
DALI_TEST_CHECK( ticket->GetId() != ticket2->GetId() ); // different resources
END_TEST;
}
示例6: UtcDaliImageFactoryCompatibleResource02
// Different requests, compatible resource
int UtcDaliImageFactoryCompatibleResource02(void)
{
TestApplication application;
tet_infoline( "UtcDaliImageFactoryCompatibleResource02 - Two requests mapping to same resource." );
ImageFactory& imageFactory = Internal::ThreadLocalStorage::Get().GetImageFactory();
Vector2 testSize( 2048.0f, 2048.0f );
application.GetPlatform().SetClosestImageSize( testSize );
// request with default attributes ( size is 0,0 )
RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
application.SendNotification();
application.Render();
application.SendNotification();
application.Render();
// emulate load success
EmulateImageLoaded( application, testSize.x, testSize.y );
// Request slightly bigger size than actual image.
// This will load the same resource as the ImageFactory cache uses a small fudge factor in matching.
// See UtcDaliImageFactoryReload06
ImageAttributes attr = ImageAttributes::New();
attr.SetSize( testSize.x + 1, testSize.y + 1 );
RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );
DALI_TEST_CHECK( req != req2 ); // different requests
DALI_TEST_EQUALS( ticket->GetId(), ticket2->GetId(), TEST_LOCATION ); // same resource
END_TEST;
}
示例7: UtcDaliImageFactoryCompatibleResource03
// Different requests, compatible resource
int UtcDaliImageFactoryCompatibleResource03(void)
{
TestApplication application;
tet_infoline( "UtcDaliImageFactoryCompatibleResource03 - Two requests mapping to same resource" );
ImageFactory& imageFactory = Internal::ThreadLocalStorage::Get().GetImageFactory();
Vector2 testSize(80.0f, 80.0f);
application.GetPlatform().SetClosestImageSize(testSize);
// this time use defined attributes, nut just NULL
ImageAttributes attr = ImageAttributes::New();
attr.SetSize( 120, 120 );
// request with default attributes ( size is 0,0 )
RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, &attr );
ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
application.SendNotification();
application.Render();
application.SendNotification();
application.Render();
// emulate load success
EmulateImageLoaded( application, 80, 80 );
ImageAttributes attr2 = ImageAttributes::New();
attr2.SetSize( 80, 80 );
RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr2 );
ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );
DALI_TEST_CHECK( req != req2 ); // different requests
DALI_TEST_EQUALS( ticket->GetId(), ticket2->GetId(), TEST_LOCATION ); // same resource
END_TEST;
}
示例8: UtcDaliModelBuildAnimation08
int UtcDaliModelBuildAnimation08(void)
{
TestApplication application;
TestPlatformAbstraction& platform = application.GetPlatform();
tet_infoline("Testing Dali::MeshActor::New()");
Dali::ModelData modelData = BuildTreeModel();
// Raise a request
Model model = Model::New("Tree");
application.SendNotification();
application.Render();
Integration::ResourceRequest* request = platform.GetRequest(); // Return modelData
if(request)
{
platform.SetResourceLoaded(request->GetId(), request->GetType()->id, Integration::ResourcePointer(&(modelData.GetBaseObject())));
}
application.Render();
application.SendNotification();
Actor actor = ModelActorFactory::BuildActorTree(model, ""); // model should be loaded
DALI_TEST_CHECK(model.GetLoadingState() == ResourceLoadingSucceeded);
DALI_TEST_CHECK(actor);
DALI_TEST_CHECK(actor.GetName().compare("root") == 0);
DALI_TEST_EQUALS(model.NumberOfAnimations(), static_cast<size_t>(1), TEST_LOCATION);
Animation twigAnim = ModelActorFactory::BuildAnimation(model, actor, 10);
DALI_TEST_CHECK(!twigAnim);
END_TEST;
}
示例9: UtcDaliImageFactoryInCompatibleResource
// Different requests, incompatible resource, so two loads result:
int UtcDaliImageFactoryInCompatibleResource(void)
{
TestApplication application;
tet_infoline( "UtcDaliImageFactoryCompatibleResource02 - Two requests mapping to same resource." );
ImageFactory& imageFactory = Internal::ThreadLocalStorage::Get().GetImageFactory();
Vector2 testSize(2048.0f, 2048.0f);
application.GetPlatform().SetClosestImageSize(testSize);
// request with default attributes ( size is 0,0 )
RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
application.SendNotification();
application.Render();
application.SendNotification();
application.Render();
// emulate load success
EmulateImageLoaded( application, testSize.x, testSize.y );
// Request substantially different size than actual image.
// This will issue a second resource load as difference in sizes is greater than
// the small fudge factor used in the ImageFactory cache.
ImageAttributes attr = ImageAttributes::New();
attr.SetSize( testSize.x - 16, testSize.y - 16 );
RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );
DALI_TEST_CHECK( req != req2 ); // different requests
DALI_TEST_CHECK( ticket->GetId() != ticket2->GetId() ); // differnet resources
END_TEST;
}
示例10: UtcDaliImageFactoryReload02
// Testing file system access when reloading image
int UtcDaliImageFactoryReload02(void)
{
TestApplication application;
tet_infoline( "UtcDaliImageFactoryReload02 - Reload unchanged image" );
ImageFactory& imageFactory = Internal::ThreadLocalStorage::Get().GetImageFactory();
Vector2 testSize(80.0f, 80.0f);
application.GetPlatform().SetClosestImageSize(testSize);
RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );
application.SendNotification();
application.Render();
application.SendNotification();
application.Render();
DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
application.GetPlatform().ResetTrace();
ResourceTicketPtr ticket2 = imageFactory.Reload( *req.Get() );
application.SendNotification();
application.Render();
application.SendNotification();
application.Render();
DALI_TEST_EQUALS( ticket, ticket2, TEST_LOCATION );
// resource is still loading, do not issue another request
DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
// emulate load success
EmulateImageLoaded( application, 80, 80 );
ResourceTicketPtr ticket3 = imageFactory.Reload( *req.Get() );
application.SendNotification();
application.Render();
application.SendNotification();
application.Render();
DALI_TEST_EQUALS( ticket, ticket3, TEST_LOCATION );
DALI_TEST_CHECK( application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
application.GetPlatform().ResetTrace();
ticket3 = imageFactory.Reload( *req.Get() );
application.SendNotification();
application.Render();
application.SendNotification();
application.Render();
DALI_TEST_CHECK( !application.GetPlatform().WasCalled( TestPlatformAbstraction::LoadResourceFunc ) );
END_TEST;
}
示例11: UtcDaliModelGetLoadingState01
int UtcDaliModelGetLoadingState01(void)
{
TestApplication application;
TestPlatformAbstraction& platform = application.GetPlatform();
tet_infoline("Testing Dali::Model::New()");
Model model = Model::New(gModelFile);
application.SendNotification();
application.Render();
Integration::ResourceRequest* request = platform.GetRequest();
DALI_TEST_CHECK(model.GetLoadingState() == ResourceLoading);
DALI_TEST_EQUALS(request->GetPath(), gModelFile, TEST_LOCATION);
DALI_TEST_EQUALS(request->GetType()->id, Integration::ResourceModel, TEST_LOCATION);
END_TEST;
}
示例12: UtcDaliModelActorFactoryTwoMesh
int UtcDaliModelActorFactoryTwoMesh(void)
{
TestApplication application;
TestPlatformAbstraction& platform = application.GetPlatform();
tet_infoline("Testing Dali::ModelActorFactory with 2 meshes in an entity");
Dali::ModelData modelData = BuildTreeModel();
Dali::Entity twoMeshEntity = Dali::Entity::New("2Mesh");
MeshData meshData;
CreateMeshData(meshData);
MeshData meshData2;
CreateMeshData(meshData2);
unsigned int meshIndex = modelData.NumberOfMeshes();
modelData.AddMesh(meshData);
modelData.AddMesh(meshData2);
twoMeshEntity.AddMeshIndex(meshIndex);
twoMeshEntity.AddMeshIndex(meshIndex+1);
modelData.GetRootEntity().Add(twoMeshEntity);
// Raise a request
Model model = Model::New("Tree");
application.SendNotification();
application.Render();
Integration::ResourceRequest* request = platform.GetRequest(); // Return modelData
if(request)
{
platform.SetResourceLoaded(request->GetId(), request->GetType()->id, Integration::ResourcePointer(&(modelData.GetBaseObject())));
}
application.Render();
application.SendNotification();
Actor actor;
try
{
actor = ModelActorFactory::BuildActorTree(model, ""); // model should be loaded
}
catch( Dali::DaliException& e )
{
tet_printf("Assertion %s test at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
DALI_TEST_ASSERT(e, "entity.NumberOfMeshes() == 1", TEST_LOCATION);
DALI_TEST_CHECK( !actor );
}
END_TEST;
}
示例13: UtcDaliModelNew
int UtcDaliModelNew(void)
{
TestApplication application;
TestPlatformAbstraction& platform = application.GetPlatform();
tet_infoline("Testing Dali::Model::New()");
Model model = Model::New(gModelFile);
application.SendNotification();
application.Render();
application.Render();
application.SendNotification();
DALI_TEST_CHECK(platform.WasCalled(TestPlatformAbstraction::LoadResourceFunc));
DALI_TEST_CHECK(model);
END_TEST;
}
示例14: UtcDaliModelActorFactory
int UtcDaliModelActorFactory(void)
{
TestApplication application;
TestPlatformAbstraction& platform = application.GetPlatform();
tet_infoline("Testing Dali::ModelActorFactory");
Dali::ModelData modelData = BuildTreeModel();
// Raise a request
Model model = Model::New("Tree");
application.SendNotification();
application.Render();
Integration::ResourceRequest* request = platform.GetRequest(); // Return modelData
if(request)
{
platform.SetResourceLoaded(request->GetId(), request->GetType()->id, Integration::ResourcePointer(&(modelData.GetBaseObject())));
}
application.Render();
application.SendNotification();
Actor modelRootActor = ModelActorFactory::BuildActorTree(model, ""); // model should be loaded
DALI_TEST_CHECK(model.GetLoadingState() == ResourceLoadingSucceeded);
DALI_TEST_CHECK(modelRootActor);
DALI_TEST_CHECK(modelRootActor.GetName().compare("root") == 0);
Actor trunk = modelRootActor.FindChildByName("trunk");
DALI_TEST_CHECK(trunk);
Actor branch = modelRootActor.FindChildByName("branch");
DALI_TEST_CHECK(branch);
Actor twig = modelRootActor.FindChildByName("twig");
DALI_TEST_CHECK(twig);
MeshActor twigMeshActor = MeshActor::DownCast(twig);
DALI_TEST_CHECK(!twigMeshActor);
Actor leaf = modelRootActor.FindChildByName("leaf");
DALI_TEST_CHECK(leaf);
MeshActor leafMeshActor = MeshActor::DownCast(leaf);
DALI_TEST_CHECK(leafMeshActor);
Material leafMaterial = leafMeshActor.GetMaterial();
DALI_TEST_CHECK(leafMaterial);
END_TEST;
}
示例15: UtcDaliImageActorNew01
int UtcDaliImageActorNew01(void)
{
TestApplication application;
tet_infoline("Positive test for Dali::ImageActor::New()");
Image image = Image::New(TestImageFilename);
ImageActor actor = ImageActor::New(image);
Stage::GetCurrent().Add(actor);
application.SendNotification();
application.Render();
application.Render();
application.SendNotification();
DALI_TEST_CHECK(application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc));
DALI_TEST_CHECK(actor);
END_TEST;
}