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=ab4551f36b57c0f4d01e2c54d795274bee3179fb;hb=9351c4477be23e8c62ada4e65a81d2c655c3eb5f;hpb=9c35e1a812315865392da6dee724d89312d2e9ea diff --git a/automated-tests/src/dali-toolkit/utc-Dali-PageTurnView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-PageTurnView.cpp index ab4551f..85ba766 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-PageTurnView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-PageTurnView.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -35,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; @@ -189,8 +185,9 @@ class TestPageFactory : public PageFactory { public: - TestPageFactory(ToolkitTestApplication& application) - : mApplication( application ) + TestPageFactory(ToolkitTestApplication& application, bool returnValidTexture = true ) + : mApplication( application ), + mValidTexture( returnValidTexture ) { mTotalPageNumber = TOTAL_PAGE_NUMBER; } @@ -205,18 +202,23 @@ public: } /** - * Create an image to represent a page content. + * Create an texture to represent a page content. * @param[in] pageId The ID of the page to create. * @return An image, or an empty handle if the ID is out of range. */ - virtual Image NewPage( unsigned int pageId ) + virtual Texture NewPage( unsigned int pageId ) { - return BufferImage::WHITE(); + if( mValidTexture ) + { + return Texture::New( Dali::TextureType::TEXTURE_2D, Pixel::RGB888, 100, 100 ); + } + return Texture(); // empty handle } private: ToolkitTestApplication& mApplication; unsigned int mTotalPageNumber; + bool mValidTexture; }; }// namespace @@ -689,3 +691,34 @@ int UtcDaliPageImageFactoryGetExtention(void) 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; +} +