Merge "packaging/dali-toolkit.spec use license macro" into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 24 Mar 2017 18:35:19 +0000 (11:35 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Fri, 24 Mar 2017 18:35:19 +0000 (11:35 -0700)
13 files changed:
automated-tests/CMakeLists.txt.in
automated-tests/README.md
automated-tests/src/dali-toolkit-styling/default-theme.json
automated-tests/src/dali-toolkit/utc-Dali-ImageAtlas.cpp
automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopupMirroringLTR.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopupMirroringRTL.cpp
automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp
dali-toolkit/devel-api/visuals/image-visual-properties-devel.h
dali-toolkit/internal/visuals/image/image-visual.cpp
dali-toolkit/internal/visuals/image/image-visual.h
dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec

index 377ec92..8851c15 100644 (file)
@@ -18,9 +18,8 @@ MESSAGE("po dir: ${PO_DIR}")
 FILE(GLOB PO_FILES RELATIVE "${PO_DIR}" "${PO_DIR}/*.po")
 
 SET(MSGFMT "/usr/bin/msgfmt")
-SET(MO_FILES_DIR /tmp/locale/en/LC_MESSAGES)
+SET(MO_FILES_DIR /tmp/locale)
 FILE(MAKE_DIRECTORY ${MO_FILES_DIR})
-MESSAGE("mo dir: ${MO_FILES_DIR}")
 
 FOREACH(PO_FILE ${PO_FILES})
         SET(PO_FILE ${PO_DIR}/${PO_FILE})
@@ -29,7 +28,8 @@ FOREACH(PO_FILE ${PO_FILES})
         MESSAGE("ABS_PO_FILE : ${ABS_PO_FILE}")
         GET_FILENAME_COMPONENT(lang ${ABS_PO_FILE} NAME_WE)
         MESSAGE("lang : ${lang}")
-        SET(MO_FILE ${MO_FILES_DIR}/dali-toolkit.mo.${lang})
+        FILE(MAKE_DIRECTORY ${MO_FILES_DIR}/${lang}/LC_MESSAGES)
+        SET(MO_FILE ${MO_FILES_DIR}/${lang}/LC_MESSAGES/dali-toolkit.mo)
         MESSAGE("MO_FILE : ${MO_FILE}")
         ADD_CUSTOM_COMMAND(OUTPUT ${MO_FILE}
                            COMMAND ${MSGFMT} -o ${MO_FILE} ${ABS_PO_FILE}
index 6761a3b..72d7473 100644 (file)
@@ -14,6 +14,16 @@ These are device specific instructions, however, installing the test suite will
 
 If you are planning on running tests on device, then flash your handset with latest image, or turn off ssh: `set_usb_debug.sh --mtp-sdb` and plug it in, then follow the quickstart instructions repeated below.
 
+Multi-language locale environment
+---------------------------------
+
+Locales for English and Arabic must be installed to pass some test cases:
+
+$ sudo locale-gen en
+$ sudo locale-gen ar
+$ sudo update-locale
+
+
 Quickstart
 ----------
 
index 4f9fb77..c9e87f8 100644 (file)
                 "testVisual":
                 {
                   "visualType":"IMAGE",
-                  "url":"0001.png"
+                  "url":"0001.png",
+                  "atlasing":true
                 },
                 "testVisual2":
                 {
                 "foregroundVisual":
                 {
                   "visualType":"IMAGE",
-                  "url":"theSameImage.png"
+                  "url":"theSameImage.png",
+                  "atlasing":true
                 },
                 "labelVisual":
                 {
                 "testVisual":
                 {
                   "visualType":"IMAGE",
-                  "url":"0002.png"
+                  "url":"0002.png",
+                  "atlasing":true
                 },
                 "testVisual2":
                 {
                 "foregroundVisual":
                 {
                   "visualType":"IMAGE",
-                  "url":"theSameImage.png"
+                  "url":"theSameImage.png",
+                  "atlasing":true
                 },
                 "labelVisual":
                 {
                 "testVisual":
                 {
                   "visualType":"IMAGE",
-                  "url":"0001.png"
+                  "url":"0001.png",
+                  "atlasing":true
                 },
                 "testVisual2":
                 {
             "focusVisual":
             {
               "visualType":"IMAGE",
-              "url": "focus.png"
+              "url": "focus.png",
+              "atlasing":true
             }
           },
           "entryTransition":
index 17b4432..f6164fb 100644 (file)
 #include <dali-toolkit-test-suite-utils.h>
 #include <toolkit-event-thread-callback.h>
 #include <dali-toolkit/devel-api/image-loader/image-atlas.h>
+#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
+
 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
+#include <dali-toolkit/dali-toolkit.h>
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -390,8 +393,25 @@ int UtcDaliImageAtlasImageView(void)
   callStack.Reset();
   callStack.Enable(true);
 
-  ImageView imageView1 = ImageView::New( gImage_34_RGBA, ImageDimensions(34, 34) );
-  ImageView imageView2 = ImageView::New( gImage_50_RGBA, ImageDimensions(50, 50) );
+  Property::Map imageMap1;
+
+  imageMap1[ ImageVisual::Property::URL ] = gImage_34_RGBA;
+  imageMap1[ ImageVisual::Property::DESIRED_HEIGHT ] = 34;
+  imageMap1[ ImageVisual::Property::DESIRED_WIDTH ] = 34;
+  imageMap1[ DevelImageVisual::Property::ATLASING] = true;
+
+  Property::Map imageMap2;
+
+  imageMap2[ ImageVisual::Property::URL ] = gImage_50_RGBA;
+  imageMap2[ ImageVisual::Property::DESIRED_HEIGHT ] = 50;
+  imageMap2[ ImageVisual::Property::DESIRED_WIDTH ] = 50;
+  imageMap2[ DevelImageVisual::Property::ATLASING ] = true;
+
+  ImageView imageView1 = ImageView::New();
+  imageView1.SetProperty( ImageView::Property::IMAGE, imageMap1 );
+
+  ImageView imageView2 = ImageView::New();
+  imageView2.SetProperty( ImageView::Property::IMAGE, imageMap2 );
 
   // ImageView doesn't do size negotiation properly: it only listens to OnSizeSet:
   imageView1.SetSize( 100, 100 );
@@ -434,7 +454,16 @@ int UtcDaliImageAtlasImageView(void)
   Stage::GetCurrent().Remove( imageView2 );
   application.SendNotification();
   application.Render(RENDER_FRAME_INTERVAL);
-  ImageView imageView3 = ImageView::New( gImage_128_RGB, ImageDimensions(100, 100) );
+
+  Property::Map imageMap3;
+  imageMap3[ ImageVisual::Property::URL ] = gImage_128_RGB;
+  imageMap3[ ImageVisual::Property::DESIRED_HEIGHT ] = 100;
+  imageMap3[ ImageVisual::Property::DESIRED_WIDTH ] = 100;
+  imageMap3[ DevelImageVisual::Property::ATLASING ] = true;
+
+  ImageView imageView3 = ImageView::New();
+  imageView3.SetProperty( ImageView::Property::IMAGE, imageMap3 );
+
   application.GetPlatform().SetClosestImageSize(  Vector2(100, 100) );
   Stage::GetCurrent().Add( imageView3 );
 
index 721bfec..596d09a 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/devel-api/scripting/scripting.h>
+#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
 #include <dali/public-api/rendering/renderer.h>
 
 #include <test-native-image.h>
@@ -452,7 +453,15 @@ int UtcDaliImageViewAsyncLoadingWithAtlasing(void)
   callStack.Reset();
   callStack.Enable(true);
 
-  ImageView imageView = ImageView::New( gImage_34_RGBA, ImageDimensions( 34, 34 ) );
+  Property::Map imageMap;
+
+  imageMap[ ImageVisual::Property::URL ] = gImage_34_RGBA;
+  imageMap[ ImageVisual::Property::DESIRED_HEIGHT ] = 34;
+  imageMap[ ImageVisual::Property::DESIRED_WIDTH ] = 34;
+  imageMap[ DevelImageVisual::Property::ATLASING] = true;
+
+  ImageView imageView = ImageView::New();
+  imageView.SetProperty( ImageView::Property::IMAGE, imageMap );
 
   // By default, Aysnc loading is used
   // loading is not started if the actor is offStage
@@ -493,6 +502,7 @@ int UtcDaliImageViewAsyncLoadingWithAtlasing02(void)
   asyncLoadingMap[ "desiredHeight" ] = 34;
   asyncLoadingMap[ "desiredWidth" ] = 34;
   asyncLoadingMap[ "synchronousLoading" ] = false;
+  asyncLoadingMap[ "atlasing" ] = true;
 
   ImageView imageView = ImageView::New();
   imageView.SetProperty( ImageView::Property::IMAGE, asyncLoadingMap );
@@ -527,6 +537,7 @@ int UtcDaliImageViewSyncLoading(void)
 
   Property::Map syncLoadingMap;
   syncLoadingMap[ ImageVisual::Property::SYNCHRONOUS_LOADING ] = true;
+  syncLoadingMap[ DevelImageVisual::Property::ATLASING ] = true;
 
   // Sync loading, no atlasing for big size image
   {
@@ -536,6 +547,7 @@ int UtcDaliImageViewSyncLoading(void)
     syncLoadingMap[ ImageVisual::Property::URL ] = gImage_600_RGB;
     imageView.SetProperty( ImageView::Property::IMAGE, syncLoadingMap );
 
+
     // BitmapLoader is used, and the loading is started immediately even the actor is not on stage.
     BitmapLoader loader = BitmapLoader::GetLatestCreated();
     DALI_TEST_CHECK( loader );
@@ -598,6 +610,7 @@ int UtcDaliImageViewSyncLoading02(void)
     syncLoadingMap[ "desiredHeight" ] = 34;
     syncLoadingMap[ "desiredWidth" ] = 34;
     syncLoadingMap[ "synchronousLoading" ] = true;
+    syncLoadingMap[ "atlasing" ] = true;
     imageView.SetProperty( ImageView::Property::IMAGE, syncLoadingMap );
 
     // loading is started even if the actor is offStage
index 5234210..6a4bfa8 100644 (file)
@@ -31,22 +31,33 @@ namespace
 {
 
 const char* DEFAULT_LOCALE_DIR = "/tmp/locale/";
-const std::string DEFAULT_EN_LOCALE_DIR = "/tmp/locale/en/LC_MESSAGES/";
+static std::string gLocaleLang;
+static std::string gLocaleLanguage;
 
 }
 
 void dali_textselectionpopupmirroringltr_startup(void)
 {
-  // Cheat! Copy the .mo file
-  std::ifstream  src( std::string( DEFAULT_EN_LOCALE_DIR + "dali-toolkit.mo.en" ).c_str(), std::ifstream::binary );
-  std::ofstream  dst( std::string( DEFAULT_EN_LOCALE_DIR + "dali-toolkit.mo" ).c_str(), std::ofstream::binary );
-  dst << src.rdbuf();
+  // Keep the current locale environment.
+  char* langPtr = getenv( "LANG" );
+  gLocaleLang = std::string( langPtr );
+
+  char* languagePtr = getenv( "LANGUAGE" );
+  gLocaleLanguage = std::string( languagePtr );
+
+  // Set the locale environment to Arabic.
+  setenv( "LANG", "en_GB.UTF-8", 1 );
+  setenv( "LANGUAGE", "en_GB:en", 1 );
 
   test_return_value = TET_UNDEF;
 }
 
 void dali_textselectionpopupmirroringltr_cleanup(void)
 {
+  // Restore the locale environment.
+  setenv( "LANG", gLocaleLang.c_str(), 1 );
+  setenv( "LANGUAGE", gLocaleLanguage.c_str(), 1 );
+
   test_return_value = TET_PASS;
 }
 
index 9d3e750..930e85e 100644 (file)
@@ -31,22 +31,33 @@ namespace
 {
 
 const char* DEFAULT_LOCALE_DIR = "/tmp/locale/";
-const std::string DEFAULT_EN_LOCALE_DIR = "/tmp/locale/en/LC_MESSAGES/";
+static std::string gLocaleLang;
+static std::string gLocaleLanguage;
 
 }
 
 void dali_textselectionpopupmirroringrtl_startup(void)
 {
-  // Cheat! Copy the .mo file
-  std::ifstream  src( std::string( DEFAULT_EN_LOCALE_DIR + "dali-toolkit.mo.ar" ).c_str(), std::ifstream::binary );
-  std::ofstream  dst( std::string( DEFAULT_EN_LOCALE_DIR + "dali-toolkit.mo" ).c_str(), std::ofstream::binary );
-  dst << src.rdbuf();
+  // Keep the current locale environment.
+  char* langPtr = getenv( "LANG" );
+  gLocaleLang = std::string( langPtr );
+
+  char* languagePtr = getenv( "LANGUAGE" );
+  gLocaleLanguage = std::string( languagePtr );
+
+  // Set the locale environment to Arabic.
+  setenv( "LANG", "ar_AE.UTF-8", 1 );
+  setenv( "LANGUAGE", "ar_AE:ar", 1 );
 
   test_return_value = TET_UNDEF;
 }
 
 void dali_textselectionpopupmirroringrtl_cleanup(void)
 {
+  // Restore the locale environment.
+  setenv( "LANG", gLocaleLang.c_str(), 1 );
+  setenv( "LANGUAGE", gLocaleLanguage.c_str(), 1 );
+
   test_return_value = TET_PASS;
 }
 
@@ -59,7 +70,7 @@ int UtcDaliToolkitTextSelectionPopupMirroringRTL(void)
 
   ToolkitTestApplication application;
 
-  setlocale( LC_ALL, "en_GB.UTF-8" );
+  setlocale( LC_ALL, "ar_AE.UTF-8" );
   textdomain("dali-toolkit");
   bindtextdomain("dali-toolkit", DEFAULT_LOCALE_DIR );
 
index 29c4cc7..4966804 100644 (file)
@@ -687,6 +687,7 @@ int UtcDaliVisualFactoryGetImageVisual3(void)
   propertyMap.Insert( ImageVisual::Property::PIXEL_AREA, pixelArea );
   propertyMap.Insert( ImageVisual::Property::WRAP_MODE_U, WrapMode::MIRRORED_REPEAT );
   propertyMap.Insert( ImageVisual::Property::WRAP_MODE_V, WrapMode::REPEAT );
+  propertyMap.Insert( DevelImageVisual::Property::ATLASING, true );
 
   Visual::Base visual = factory.CreateVisual( propertyMap );
   DALI_TEST_CHECK( visual );
index eb2ac49..d2622da 100644 (file)
@@ -55,6 +55,15 @@ enum Type
    * @note For N-Patch images only.
    */
   BORDER = WRAP_MODE_V + 1,
+
+  /**
+   * @brief Whether to use the texture atlas
+   * @details Name "atlasing", type Property::BOOLEAN, true to enable texture atlas
+   *
+   * @note Optional. By default atlasing is off.
+   */
+
+  ATLASING = WRAP_MODE_V + 2,
 };
 
 } //namespace Property
index 49e2c00..5c8a004 100644 (file)
@@ -31,6 +31,7 @@
 
 // INTERNAL HEADERS
 #include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 #include <dali-toolkit/internal/visuals/visual-string-constants.h>
 #include <dali-toolkit/internal/visuals/visual-factory-impl.h>
@@ -58,6 +59,7 @@ const char * const IMAGE_SAMPLING_MODE( "samplingMode" );
 const char * const IMAGE_DESIRED_WIDTH( "desiredWidth" );
 const char * const IMAGE_DESIRED_HEIGHT( "desiredHeight" );
 const char * const SYNCHRONOUS_LOADING( "synchronousLoading" );
+const char * const IMAGE_ATLASING("atlasing");
 
 // fitting modes
 DALI_ENUM_TO_STRING_TABLE_BEGIN( FITTING_MODE )
@@ -93,7 +95,9 @@ const char* DEFAULT_SAMPLER_TYPENAME = "sampler2D";
 
 const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
   attribute mediump vec2 aPosition;\n
-  uniform mediump mat4 uMvpMatrix;\n
+  uniform mediump mat4 uModelMatrix;\n
+  uniform mediump mat4 uViewMatrix;\n
+  uniform mediump mat4 uProjection;\n
   uniform mediump vec3 uSize;\n
   uniform mediump vec4 pixelArea;
   varying mediump vec2 vTexCoord;\n
@@ -115,7 +119,9 @@ const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
 
   void main()\n
   {\n
-    mediump vec4 vertexPosition = uMvpMatrix * ComputeVertexPosition();\n
+    mediump vec4 vertexPosition = uViewMatrix * uModelMatrix * ComputeVertexPosition();\n
+    vertexPosition.xy = floor ( vertexPosition.xy );\n // Pixel alignment
+    vertexPosition = uProjection *  vertexPosition;\n
     vTexCoord = pixelArea.xy+pixelArea.zw*(aPosition + vec2(0.5) );\n
     gl_Position = vertexPosition;\n
   }\n
@@ -253,7 +259,8 @@ ImageVisual::ImageVisual( VisualFactoryCache& factoryCache,
   mFittingMode( fittingMode ),
   mSamplingMode( samplingMode ),
   mWrapModeU( WrapMode::DEFAULT ),
-  mWrapModeV( WrapMode::DEFAULT )
+  mWrapModeV( WrapMode::DEFAULT ),
+  mAttemptAtlasing( false )
 {
 }
 
@@ -268,7 +275,8 @@ ImageVisual::ImageVisual( VisualFactoryCache& factoryCache, const Image& image )
   mFittingMode( FittingMode::DEFAULT ),
   mSamplingMode( SamplingMode::DEFAULT ),
   mWrapModeU( WrapMode::DEFAULT ),
-  mWrapModeV( WrapMode::DEFAULT )
+  mWrapModeV( WrapMode::DEFAULT ),
+  mAttemptAtlasing( false )
 {
 }
 
@@ -320,10 +328,14 @@ void ImageVisual::DoSetProperties( const Property::Map& propertyMap )
       {
         DoSetProperty( Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, keyValue.second );
       }
+      else if ( keyValue.first == IMAGE_ATLASING )
+      {
+        DoSetProperty( Toolkit::DevelImageVisual::Property::ATLASING, keyValue.second );
+      }
     }
   }
 
-  if( mImpl->mFlags & Impl::IS_SYNCHRONOUS_RESOURCE_LOADING && mImageUrl.IsValid() )
+  if( ( mImpl->mFlags & Impl::IS_SYNCHRONOUS_RESOURCE_LOADING ) && mImageUrl.IsValid() )
   {
     // if sync loading is required, the loading should start
     // immediately when new image url is set or the actor is off stage
@@ -423,6 +435,12 @@ void ImageVisual::DoSetProperty( Property::Index index, const Property::Value& v
       mWrapModeV = Dali::WrapMode::Type( wrapMode );
       break;
     }
+
+    case Toolkit::DevelImageVisual::Property::ATLASING:
+    {
+      bool atlasing = false;
+      mAttemptAtlasing = value.Get( atlasing );
+    }
   }
 }
 
@@ -628,7 +646,7 @@ void ImageVisual::InitializeRenderer()
     Vector4 atlasRect;
     // texture set has to be created first as we need to know if atlasing succeeded or not
     // when selecting the shader
-    TextureSet textures = CreateTextureSet( atlasRect, IsSynchronousResourceLoading(), true );
+    TextureSet textures = CreateTextureSet( atlasRect, IsSynchronousResourceLoading(), mAttemptAtlasing );
     CreateRenderer( textures );
 
     if( mImpl->mFlags & Impl::IS_ATLASING_APPLIED ) // the texture is packed inside atlas
@@ -761,6 +779,8 @@ void ImageVisual::DoCreatePropertyMap( Property::Map& map ) const
   map.Insert( Toolkit::ImageVisual::Property::PIXEL_AREA, mPixelArea );
   map.Insert( Toolkit::ImageVisual::Property::WRAP_MODE_U, mWrapModeU );
   map.Insert( Toolkit::ImageVisual::Property::WRAP_MODE_V, mWrapModeV );
+
+  map.Insert( Toolkit::DevelImageVisual::Property::ATLASING, mAttemptAtlasing );
 }
 
 void ImageVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
index 83fd71c..f2d7023 100644 (file)
@@ -320,6 +320,8 @@ private:
   Dali::WrapMode::Type mWrapModeU:3;
   Dali::WrapMode::Type mWrapModeV:3;
 
+  bool mAttemptAtlasing:1; // If true will attempt atlasing, otherwise create unique texture
+
 };
 
 } // namespace Internal
index 2f4b7a3..0b257b2 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 31;
+const unsigned int TOOLKIT_MICRO_VERSION = 32;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 1c05ee9..239159d 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    The OpenGLES Canvas Core Library Toolkit
-Version:    1.2.31
+Version:    1.2.32
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-2-Clause and MIT