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=1142c4c186dc9fe104ed9becd3634bbf9aa4337e;hb=5e351965bad7e1de2e94027548b022bac692603c;hpb=322ff9dad8e2227d2df555a2b36242ba4bf287ca diff --git a/automated-tests/src/dali-toolkit/utc-Dali-PageTurnView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-PageTurnView.cpp index 1142c4c..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,13 +21,10 @@ #include #include #include -#include -#include -#include -#include -#include - - +#include +#include +#include +#include using namespace Dali; using namespace Dali::Toolkit; @@ -37,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; @@ -191,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; } @@ -207,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 @@ -691,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; +} +