Merge "Remove unsafe new-delete pair from program and change unoptimal resizes to...
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Material.cpp
index 36ce22b..e07ecdd 100644 (file)
@@ -1,23 +1,24 @@
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 #include <iostream>
 
 #include <stdlib.h>
-#include <dali/dali.h>
+#include <dali/public-api/dali-core.h>
 #include <dali-test-suite-utils.h>
 
 using namespace Dali;
@@ -128,15 +129,15 @@ int UtcDaliMaterialSettersAndGetters(void)
   material.SetNormalMapFileName("normal-map.png");
   DALI_TEST_EQUALS( material.GetNormalMapFileName(), "normal-map.png", TEST_LOCATION);
 
-  Image diffuseTexture = Image::New("diffuse-texture.png");
+  Image diffuseTexture = ResourceImage::New("diffuse-texture.png");
   material.SetDiffuseTexture(diffuseTexture);
   DALI_TEST_EQUALS( material.GetDiffuseTexture(), diffuseTexture, TEST_LOCATION );
 
-  Image opacityTexture = Image::New("opacity-texture.png");
+  Image opacityTexture = ResourceImage::New("opacity-texture.png");
   material.SetOpacityTexture(opacityTexture);
   DALI_TEST_EQUALS( material.GetOpacityTexture(), opacityTexture, TEST_LOCATION);
 
-  Image normalMap = Image::New("normal-map.png");
+  Image normalMap = ResourceImage::New("normal-map.png");
   material.SetNormalMap(normalMap);
   DALI_TEST_EQUALS( material.GetNormalMap(), normalMap, TEST_LOCATION);
 
@@ -174,7 +175,7 @@ int UtcDaliMaterialStage01(void)
 
   {
     Material material = Material::New("material");
-    Image image = Image::New( "image.png", Image::Immediate, Image::Never );
+    Image image = ResourceImage::New( "image.png", ResourceImage::IMMEDIATE, Image::NEVER );
     DALI_TEST_CHECK(image);
     application.SendNotification();
     application.Render(16);
@@ -182,7 +183,7 @@ int UtcDaliMaterialStage01(void)
     std::vector<GLuint> ids;
     ids.push_back( 23 );
     application.GetGlAbstraction().SetNextTextureIds( ids );
-    Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+    Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
     Integration::ResourcePointer resource(bitmap);
     bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
     DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
@@ -204,7 +205,6 @@ int UtcDaliMaterialStage01(void)
     {
       MeshActor meshActor = MeshActor::New(mesh);
       meshActor.SetSize(100, 100);
-      meshActor.SetAffectedByLighting(false);
       Stage::GetCurrent().Add(meshActor);
       application.SendNotification();
       application.Render();
@@ -257,7 +257,7 @@ int UtcDaliMaterialStage02(void)
   {
     Material material = Material::New("material");
 
-    Image image = Image::New( "image.png", Image::OnDemand, Image::Unused );
+    Image image = ResourceImage::New( "image.png", ResourceImage::ON_DEMAND, Image::UNUSED );
     DALI_TEST_CHECK(image);
     application.SendNotification();
     application.Render(16);
@@ -284,7 +284,6 @@ int UtcDaliMaterialStage02(void)
     {
       MeshActor meshActor = MeshActor::New(mesh);
       meshActor.SetSize(100, 100);
-      meshActor.SetAffectedByLighting(false);
       Stage::GetCurrent().Add(meshActor);
       application.SendNotification();
       application.Render();
@@ -294,7 +293,7 @@ int UtcDaliMaterialStage02(void)
       Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
       DALI_TEST_CHECK( request != NULL );
 
-      Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
+      Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD );
       Integration::ResourcePointer resource(bitmap);
       bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
       if(request)