-//
-// 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 <algorithm>
#include <stdlib.h>
-#include <dali/dali.h>
+#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <test-native-image.h>
using std::max;
using namespace Dali;
// invoke default handle constructor
FrameBufferImage image;
- Dali::ImageAttributes attributes;
Vector2 stageSize = Stage::GetCurrent().GetSize();
// initialise handle
application.Render();
application.SendNotification();
- attributes = image.GetAttributes();
-
DALI_TEST_CHECK( image );
- DALI_TEST_EQUALS((float)attributes.GetWidth(), stageSize.width, TEST_LOCATION);
- DALI_TEST_EQUALS((float)attributes.GetHeight(), stageSize.height, TEST_LOCATION);
+ DALI_TEST_EQUALS((float)image.GetWidth(), stageSize.width, TEST_LOCATION);
+ DALI_TEST_EQUALS((float)image.GetHeight(), stageSize.height, TEST_LOCATION);
image = FrameBufferImage::New(16, 16); // create framebuffer with dimensions of 16x16
actor.SetImage(image);
application.Render();
application.SendNotification();
- attributes = image.GetAttributes();
+ DALI_TEST_CHECK( image );
+ DALI_TEST_EQUALS(image.GetWidth(), 16u, TEST_LOCATION);
+ DALI_TEST_EQUALS(image.GetHeight(), 16u, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliFrameBufferImageNew02(void)
+{
+ TestApplication application;
+
+ tet_infoline("UtcDaliFrameBufferImageNew02 - FrameBufferImage::New(NativeImageInterface&)");
+
+ // invoke default handle constructor
+ FrameBufferImage image;
+ TestNativeImagePointer nativeImage = TestNativeImage::New(16, 16);
+
+ DALI_TEST_CHECK( !image );
+
+ // initialise handle
+ image = FrameBufferImage::New(*(nativeImage.Get()));
+
+ DALI_TEST_CHECK( image );
+ END_TEST;
+}
+
+int UtcDaliFrameBufferImageNew03(void)
+{
+ TestApplication application;
+
+ tet_infoline("UtcDaliFrameBufferImageNew03 - FrameBufferImage::New(NativeImageInterface&, ReleasePolicy)");
+
+ // invoke default handle constructor
+ FrameBufferImage image;
+ TestNativeImagePointer nativeImage = TestNativeImage::New(16, 16);
+
+ DALI_TEST_CHECK( !image );
+
+ // initialise handle with UNUSED release policy
+ image = FrameBufferImage::New(*(nativeImage.Get()), Image::UNUSED);
+
+ DALI_TEST_CHECK( image );
+ DALI_TEST_EQUALS( image.GetReleasePolicy(), Image::UNUSED, TEST_LOCATION );
+
+ // initialise handle with NEVER release policy
+ image.Reset();
+ DALI_TEST_CHECK( !image );
+
+ image = FrameBufferImage::New(*(nativeImage.Get()), Image::NEVER);
DALI_TEST_CHECK( image );
- DALI_TEST_EQUALS(attributes.GetWidth(), 16u, TEST_LOCATION);
- DALI_TEST_EQUALS(attributes.GetHeight(), 16u, TEST_LOCATION);
+ DALI_TEST_EQUALS( image.GetReleasePolicy(), Image::NEVER, TEST_LOCATION );
+
END_TEST;
}