X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-PageTurnView.cpp;h=85ba766fb4730754cc9342d6a3f61bebe13db3f8;hp=cb6eefa051d42859da42e190aa630b569160efee;hb=9351c4477be23e8c62ada4e65a81d2c655c3eb5f;hpb=0dd2826b16facb7e8f21ffb86853bd1b0afb97b4 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-PageTurnView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-PageTurnView.cpp index cb6eefa..85ba766 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-PageTurnView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-PageTurnView.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,12 +21,10 @@ #include #include #include -#include -#include -#include -#include - - +#include +#include +#include +#include using namespace Dali; using namespace Dali::Toolkit; @@ -36,9 +34,6 @@ namespace const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS) const unsigned int TOTAL_PAGE_NUMBER = 20; const Vector2 PAGE_SIZE( 300.f,400.f ); -const unsigned int IMAGE_WIDTH = 30; -const unsigned int IMAGE_HEIGHT = 30; -const Vector2 IMAGE_SIZE( static_cast( IMAGE_WIDTH ), static_cast(IMAGE_HEIGHT) ); const Vector2 SPINE_SHADOW_PARAMETER( 60.0f, 30.0f ); static bool gObjectCreatedCallBackCalled; @@ -190,10 +185,10 @@ class TestPageFactory : public PageFactory { public: - TestPageFactory(ToolkitTestApplication& application) - : mApplication( application ) + TestPageFactory(ToolkitTestApplication& application, bool returnValidTexture = true ) + : mApplication( application ), + mValidTexture( returnValidTexture ) { - mSourceActors.resize(TOTAL_PAGE_NUMBER); mTotalPageNumber = TOTAL_PAGE_NUMBER; } @@ -207,41 +202,23 @@ public: } /** - * Create an image actor to represent a page. + * Create an texture to represent a page content. * @param[in] pageId The ID of the page to create. - * @return An image actor, or an uninitialized pointer if the ID is out of range. + * @return An image, or an empty handle if the ID is out of range. */ - virtual Actor NewPage( unsigned int pageId ) + virtual Texture NewPage( unsigned int pageId ) { - if(!mSourceActors[pageId]) + if( mValidTexture ) { - Actor actor = CreateSolidColorImageActor(mApplication, Color::BLUE,IMAGE_WIDTH,IMAGE_HEIGHT); - actor.SetName( static_cast( &(std::ostringstream() << pageId) )->str() ); - - actor.SetParentOrigin( ParentOrigin::CENTER ); - actor.SetAnchorPoint( AnchorPoint::CENTER ); - - ImageActor backPageActor = CreateSolidColorImageActor(mApplication, Color::BLUE,IMAGE_WIDTH,IMAGE_HEIGHT); - backPageActor.SetParentOrigin( ParentOrigin::CENTER ); - backPageActor.SetAnchorPoint( AnchorPoint::CENTER ); - actor.Add( backPageActor ); - - mSourceActors[pageId] = actor; + return Texture::New( Dali::TextureType::TEXTURE_2D, Pixel::RGB888, 100, 100 ); } - - return mSourceActors[pageId]; - } - - void DeletePage( unsigned int pageId ) - { - mSourceActors.erase( mSourceActors.begin() + pageId ); - mTotalPageNumber--; + return Texture(); // empty handle } private: ToolkitTestApplication& mApplication; - std::vector mSourceActors; unsigned int mTotalPageNumber; + bool mValidTexture; }; }// namespace @@ -706,3 +683,42 @@ int UtcDaliPageTurnLanscapeViewSignals(void) DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get(), 0, TEST_LOCATION ); END_TEST; } + +int UtcDaliPageImageFactoryGetExtention(void) +{ + ToolkitTestApplication application; + TestPageFactory factory(application); + DALI_TEST_CHECK( factory.GetExtension() == NULL ); + END_TEST; +} + +int UtcDaliPageTurnEmptyTextureHandle(void) +{ + ToolkitTestApplication application; + + tet_infoline(" UtcDaliPageTurnEmptyTextureHandle "); + + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE ); + + TestPageFactory factory(application, false); // returns empty handles + Vector2 size = Stage::GetCurrent().GetSize(); + try + { + PageTurnView portraitView = PageTurnPortraitView::New( factory, size ); + portraitView.SetParentOrigin( ParentOrigin::CENTER ); + Stage::GetCurrent().Add( portraitView ); + + tet_result(TET_FAIL); + } + catch (DaliException& e) + { + DALI_TEST_ASSERT(e, "must pass in valid texture", TEST_LOCATION ); + } + catch (...) + { + tet_result(TET_FAIL); + } + + END_TEST; +} +