提交 12621417 编写于 作者: R root

componentization rectification

Change-Id: Ie179fbc3b5f88bda3cd37e5ea52e206b4b3b715b
上级 e956eae9
# Copyright (c) 2021 Huawei Device 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.
group("uikit_test") {
deps = [
"//test/xts/acts/graphic_lite/a:ActsUiInterfaceTest",
"//test/xts/acts/graphic_lite/animator_posix:ActsAnimatorTest",
"//test/xts/acts/graphic_lite/color_posix:ActsColorTest",
"//test/xts/acts/graphic_lite/easing_equation_posix:ActsEasingEquationTest",
"//test/xts/acts/graphic_lite/events_posix:ActsEventsTest",
"//test/xts/acts/graphic_lite/flexlayout_posix:ActsFlexlaoutTest",
"//test/xts/acts/graphic_lite/geometry2d_posix:ActsGeometyr2dTest",
"//test/xts/acts/graphic_lite/graphic_math_posix:ActsGraphicMathTest",
"//test/xts/acts/graphic_lite/gridlayout_posix:ActsGridLayoutTest",
"//test/xts/acts/graphic_lite/heap_base_posix:ActsHeapBaseTest",
"//test/xts/acts/graphic_lite/image_posix:ActsImageTest",
"//test/xts/acts/graphic_lite/interpolation_posix:ActsInterpoliationTest",
"//test/xts/acts/graphic_lite/layout_posix:ActsLayoutTest",
"//test/xts/acts/graphic_lite/list_posix:ActsListTest",
"//test/xts/acts/graphic_lite/listlayout_posix:ActsListlayoutTest",
"//test/xts/acts/graphic_lite/mem_api_posix:ActsGraphMemApiTest",
"//test/xts/acts/graphic_lite/rect_posix:ActsRectTest",
"//test/xts/acts/graphic_lite/screen_posix:ActsScreenTest",
"//test/xts/acts/graphic_lite/style_posix:ActsStyleTest",
#"//test/xts/acts/graphic_lite/sys_info_posix:ActsSysInfoTest",
"//test/xts/acts/graphic_lite/surface_posix:ActsSurfaceTest",
"//test/xts/acts/graphic_lite/theme_posix:ActsThemeTest",
"//test/xts/acts/graphic_lite/transform_posix:ActsTransformTest",
"//test/xts/acts/graphic_lite/ui_abstract_progress_posix:ActsUIAbstractProgressTest",
"//test/xts/acts/graphic_lite/ui_analog_clock_posix:ActsUIAnalogClockTest",
"//test/xts/acts/graphic_lite/ui_arc_lable_posix:ActsUIArcLabelTest",
"//test/xts/acts/graphic_lite/ui_axis_posix:ActsUIAxisTest",
"//test/xts/acts/graphic_lite/ui_box_porgress_posix:ActsUIBoxProgressTest",
"//test/xts/acts/graphic_lite/ui_button_posix:ActsUIButtonTest",
"//test/xts/acts/graphic_lite/ui_canvas_posix:ActsUICanvasTest",
"//test/xts/acts/graphic_lite/ui_chart_posix:ActsUIChartTest",
"//test/xts/acts/graphic_lite/ui_checbox_posix:ActsUICheckboxTest",
"//test/xts/acts/graphic_lite/ui_circle_progress_posix:ActsUICircleProgressTest",
"//test/xts/acts/graphic_lite/ui_digital_clock_posix:ActsUIDigitalClockTest",
"//test/xts/acts/graphic_lite/ui_image_animator_posix:ActsUIImageAnimatorTest",
"//test/xts/acts/graphic_lite/ui_image_posix:ActsUIImageTest",
"//test/xts/acts/graphic_lite/ui_label_button_posix:ActsUILabelButtonTest",
"//test/xts/acts/graphic_lite/ui_label_posix:ActsUILabelTest",
"//test/xts/acts/graphic_lite/ui_list_posix:ActsUIListTest",
"//test/xts/acts/graphic_lite/ui_picker_posix:ActsUIPickerTest",
"//test/xts/acts/graphic_lite/ui_radio_button_posix:ActsUIRadioButtonTest",
"//test/xts/acts/graphic_lite/ui_repeat_button_posix:ActsUIRepeatButtonTest",
"//test/xts/acts/graphic_lite/ui_screenshot_posix:ActsUIScreenshotTest",
"//test/xts/acts/graphic_lite/ui_scroll_view_posix:ActsUIScrollViewTest",
"//test/xts/acts/graphic_lite/ui_slider_posix:ActsUISliderTest",
"//test/xts/acts/graphic_lite/ui_surface_view_posix:ActsUISurfaceViewTest",
"//test/xts/acts/graphic_lite/ui_swipe_view_posix:ActsUISwipeViewTest",
"//test/xts/acts/graphic_lite/ui_text_posix:ActsUITextTest",
"//test/xts/acts/graphic_lite/ui_texture_mapper_posix:ActsUITextureMapperTest",
"//test/xts/acts/graphic_lite/ui_time_picker_posix:ActsUITimePickerTest",
"//test/xts/acts/graphic_lite/ui_toggle_button_posix:ActsUIToggleButtonTest",
"//test/xts/acts/graphic_lite/ui_view_group_posix:ActsUIViewGroupTest",
"//test/xts/acts/graphic_lite/ui_view_posix:ActsUIViewTest",
"//test/xts/acts/graphic_lite/uianimator_posix:ActsUIAnimatorTest",
#"//test/xts/acts/graphic_lite/uidfx_posix:ActsUIDfxTest",
#"//test/xts/acts/graphic_lite/uifont_posix:ActsUIFontTest",
"//test/xts/acts/graphic_lite/version_posix:ActsGraphVersionTest",
]
}
# Copyright (c) 2021 Huawei Device 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.
import("//build/lite/config/component/lite_component.gni")
import("//build/lite/config/subsystem/graphic/config.gni")
import("//build/lite/ndk/ndk.gni")
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsUiInterfaceTest") {
suite_name = "acts"
if (enable_graphic_font) {
sources = [
"src/UiInterfaceTest.cpp",
"src/window_test.cpp",
]
} else {
sources = [ "src/UiInterfaceTest.cpp" ]
}
include_dirs = [
"//kernel/liteos_a/kernel/include/",
"//kernel/liteos_a/kernel/common",
"//third_party/bounds_checking_function/include",
"//third_party/cJSON",
"//third_party/libpng",
"//third_party/libjpeg",
"//utils/native/lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/communication/broadcast",
]
ldflags = [ "-Wl,-Map=toggleButtonTest.map" ]
deps = [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/communication/ipc_lite:liteipc_adapter",
"//foundation/distributedschedule/samgr_lite/communication/broadcast",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//foundation/distributedschedule/samgr_lite/samgr_client:client",
"//foundation/graphic/surface:lite_surface",
"//foundation/graphic/ui:lite_ui",
"//foundation/graphic/utils:lite_graphic_hals",
"//foundation/graphic/wms:lite_wms",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-fno-rtti" ]
}
{
"description": "ui interface coverage filled",
"environment": [
{
"type": "device",
"label": "ipcamera"
}
],
"kits": [
{
"type": "MountKit",
"server": "NfsServer",
"mount": [
{
"source": "testcases/graphic",
"target": "/test_root/graphic"
}
]
}
],
"driver": {
"type": "CppTestLite",
"execute": "/test_root/graphic/ActsUiInterfaceTest.bin"
}
}
\ No newline at end of file
此差异已折叠。
/*
* Copyright (c) 2021 Huawei Device 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.
*/
#ifndef XTS_HITS_UI_INTERFACE_API_EXPECT_H
#define XTS_HITS_UI_INTERFACE_API_EXPECT_H
#endif
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 <climits>
#include <gtest/gtest.h>
#include "common/graphic_startup.h"
#include "window/window.h"
using namespace std;
using namespace testing::ext;
namespace OHOS {
class WindowTest : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
};
/**
* @tc.number SUB_GRAPHIC_WINDOW_DESTORYWINDOW_0200
* @tc.name test window destory-window api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(WindowTest, Graphic_Window_Test_DestoryWindow_0200, Function | MediumTest | Level0)
{
Window* testObj = NULL;
Window::DestoryWindow(testObj);
EXPECT_EQ(0, 0);
}
/**
* @tc.number SUB_GRAPHIC_WINDOW_SHOW_0300
* @tc.name test window show api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(WindowTest, Graphic_Window_Test_Show_0300, Function | MediumTest | Level0)
{
OHOS::GraphicStartUp::Init();
WindowConfig config = {};
config.rect.SetRect(0, 0, 100, 100);
Window* testObj = Window::CreateWindow(config);
if (testObj != nullptr) {
testObj->Show();
}
EXPECT_EQ(0, 0);
}
/**
* @tc.number SUB_GRAPHIC_WINDOW_HIDE_0400
* @tc.name test window hide api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(WindowTest, Graphic_Window_Test_Hide_0400, Function | MediumTest | Level0)
{
OHOS::GraphicStartUp::Init();
WindowConfig config = {};
config.rect.SetRect(0, 0, 100, 100);
Window* testObj = Window::CreateWindow(config);
if (testObj != nullptr) {
testObj->Hide();
}
EXPECT_EQ(0, 0);
}
/**
* @tc.number SUB_GRAPHIC_WINDOW_MOVETO_0500
* @tc.name test window move-to api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(WindowTest, Graphic_Window_Test_MoveTo_0500, Function | MediumTest | Level0)
{
OHOS::GraphicStartUp::Init();
WindowConfig config = {};
config.rect.SetRect(0, 0, 100, 100);
Window* testObj = Window::CreateWindow(config);
int16_t xInt = 64;
int16_t yInt = 128;
if (testObj != nullptr) {
testObj->MoveTo(xInt, yInt);
testObj->RaiseToTop();
testObj->LowerToBottom();
}
}
/**
* @tc.number SUB_GRAPHIC_WINDOW_RESIZE_0600
* @tc.name test window resize api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(WindowTest, Graphic_Window_Test_Resize_0600, Function | MediumTest | Level0)
{
OHOS::GraphicStartUp::Init();
WindowConfig config = {};
config.rect.SetRect(0, 0, 100, 100);
Window* testObj = Window::CreateWindow(config);
int16_t width = 64;
int16_t height = 128;
if (testObj != nullptr) {
testObj->Resize(width, height);
}
EXPECT_EQ(0, 0);
}
/**
* @tc.number SUB_GRAPHIC_WINDOW_BINDROOTVIEW_0700
* @tc.name test window bind-root-view api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(WindowTest, Graphic_Window_Test_BindRootView_0700, Function | MediumTest | Level0)
{
OHOS::GraphicStartUp::Init();
WindowConfig config = {};
config.rect.SetRect(0, 0, 100, 100);
Window* testObj = Window::CreateWindow(config);
if (testObj != nullptr) {
testObj->BindRootView(RootView::GetInstance());
}
EXPECT_EQ(0, 0);
if (testObj != nullptr) {
EXPECT_EQ(testObj->GetRootView(), RootView::GetInstance());
testObj->UnbindRootView();
}
}
/**
* @tc.number SUB_GRAPHIC_INTERFACE_FIRST_5800
* @tc.name test DestoryWindow api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(WindowTest, SUB_GRAPHIC_INTERFACE_FIRST_5800, Function | MediumTest | Level0)
{
OHOS::GraphicStartUp::Init();
WindowConfig windowConfig = {};
Window* window = Window::CreateWindow(windowConfig);
Window::DestoryWindow(window);
EXPECT_EQ(0, 0);
}
/**
* @tc.number SUB_GRAPHIC_INTERFACE_FIRST_5900
* @tc.name test BindRootView api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(WindowTest, SUB_GRAPHIC_INTERFACE_FIRST_5900, Function | MediumTest | Level0)
{
WindowConfig windowConfig = {};
Window* window = Window::CreateWindow(windowConfig);
RootView* rootView = RootView::GetInstance();
if (window!=nullptr) {
window->BindRootView(rootView);
}
EXPECT_EQ(0, 0);
}
} // namespace OHOS
# Copyright (c) 2021 Huawei Device 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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsAnimatorTest") {
suite_name = "acts"
sources = [ "src/animator_test.cpp" ]
include_dirs = [
"//kernel/liteos_a/kernel/include/",
"//kernel/liteos_a/kernel/common",
"//third_party/bounds_checking_function/include",
"//third_party/cJSON",
"//third_party/libpng",
"//third_party/libjpeg",
"//utils/native/lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/communication/broadcast",
]
ldflags = [ "-Wl,-Map=toggleButtonTest.map" ]
deps = [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/communication/ipc_lite:liteipc_adapter",
"//foundation/distributedschedule/samgr_lite/communication/broadcast",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//foundation/distributedschedule/samgr_lite/samgr_client:client",
"//foundation/graphic/surface:lite_surface",
"//foundation/graphic/ui:lite_ui",
"//foundation/graphic/utils:lite_graphic_hals",
"//foundation/graphic/wms:lite_wms",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-fno-rtti" ]
}
{
"description": "Config for uikit uibutton test cases",
"environment": [
{
"type": "device",
"label": "ipcamera"
}
],
"kits": [
{
"type": "MountKit",
"server": "NfsServer",
"mount": [
{
"source": "testcases/graphic",
"target": "/test_root/graphic"
}
]
}
],
"driver": {
"type": "CppTestLite",
"execute": "/test_root/graphic/ActsAnimatorTest.bin"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 "animator/animator.h"
#include <climits>
#include <gtest/gtest.h>
using namespace std;
using namespace testing::ext;
namespace OHOS {
class AnimatorTest : public testing::Test {
public:
static void SetUpTestCase(void)
{
if (animator == nullptr) {
animator = new Animator();
}
}
static void TearDownTestCase(void)
{
if (animator != nullptr) {
delete animator;
animator = nullptr;
}
}
static Animator* animator;
};
Animator* AnimatorTest::animator = nullptr;
/**
* @tc.number SUB_GRAPHIC_ANIMATOR_START_0100
* @tc.name test animator start api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(AnimatorTest, Graphic_Animator_Test_Start_0100, Function | MediumTest | Level0)
{
animator->Start();
EXPECT_EQ(animator->GetState(), Animator::START);
}
/**
* @tc.number SUB_GRAPHIC_ANIMATOR_STOP_0200
* @tc.name test animator stop api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(AnimatorTest, Graphic_Animator_Test_Stop_0200, Function | MediumTest | Level0)
{
animator->Stop();
EXPECT_EQ(animator->GetState(), Animator::STOP);
}
/**
* @tc.number SUB_GRAPHIC_ANIMATOR_PAUSE_0300
* @tc.name test animator pause api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(AnimatorTest, Graphic_Animator_Test_Pause_0300, Function | MediumTest | Level0)
{
animator->Pause();
EXPECT_EQ(animator->GetState(), Animator::PAUSE);
}
/**
* @tc.number SUB_GRAPHIC_ANIMATOR_RESUME_0400
* @tc.name test animator resume api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(AnimatorTest, Graphic_Animator_Test_Resume_0400, Function | MediumTest | Level0)
{
animator->Resume();
EXPECT_EQ(animator->GetState(), Animator::START);
}
/**
* @tc.number SUB_GRAPHIC_ANIMATOR_SETSTATE_0500
* @tc.name test animator set-state api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(AnimatorTest, Graphic_Animator_Test_SetState_0500, Function | MediumTest | Level0)
{
animator->SetState(Animator::START);
EXPECT_EQ(animator->GetState(), Animator::START);
}
/**
* @tc.number SUB_GRAPHIC_ANIMATOR_SETTIME_0600
* @tc.name test animator set-time api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(AnimatorTest, Graphic_Animator_Test_SetTime_0600, Function | MediumTest | Level0)
{
uint16_t time = 300;
animator->SetTime(time);
EXPECT_EQ(animator->GetTime(), time);
}
/**
* @tc.number SUB_GRAPHIC_ANIMATOR_SETRUNTIME_0700
* @tc.name test animator set-runtime api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(AnimatorTest, Graphic_Animator_Test_SetRunTime_0700, Function | MediumTest | Level0)
{
uint16_t time = 300;
animator->SetRunTime(time);
EXPECT_EQ(animator->GetRunTime(), time);
}
/**
* @tc.number SUB_GRAPHIC_ANIMATOR_ISRPEAT_0800
* @tc.name test animator if-repeat api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(AnimatorTest, Graphic_Animator_Test_IsRepeat_0800, Function | MediumTest | Level0)
{
EXPECT_EQ(animator->IsRepeat(), false);
}
/**
* @tc.number SUB_GRAPHIC_ANIMATOR_GETINSTANCE_0900
* @tc.name test animator get-instance api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(AnimatorTest, Graphic_Animator_Test_GetInstance_0900, Function | MediumTest | Level0)
{
AnimatorManager::GetInstance();
EXPECT_EQ(0, 0);
}
} // namespace OHOS
\ No newline at end of file
# Copyright (c) 2021 Huawei Device 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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsColorTest") {
suite_name = "acts"
sources = [ "src/color_test.cpp" ]
include_dirs = [
"//kernel/liteos_a/kernel/include/",
"//kernel/liteos_a/kernel/common",
"//third_party/bounds_checking_function/include",
"//third_party/cJSON",
"//third_party/libpng",
"//third_party/libjpeg",
"//utils/native/lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/communication/broadcast",
]
ldflags = [ "-Wl,-Map=toggleButtonTest.map" ]
deps = [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/communication/ipc_lite:liteipc_adapter",
"//foundation/distributedschedule/samgr_lite/communication/broadcast",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//foundation/distributedschedule/samgr_lite/samgr_client:client",
"//foundation/graphic/surface:lite_surface",
"//foundation/graphic/ui:lite_ui",
"//foundation/graphic/utils:lite_graphic_hals",
"//foundation/graphic/wms:lite_wms",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-fno-rtti" ]
}
{
"description": "Config for uikit uibutton test cases",
"environment": [
{
"type": "device",
"label": "ipcamera"
}
],
"kits": [
{
"type": "MountKit",
"server": "NfsServer",
"mount": [
{
"source": "testcases/graphic",
"target": "/test_root/graphic"
}
]
}
],
"driver": {
"type": "CppTestLite",
"execute": "/test_root/graphic/ActsColorTest.bin"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 "gfx_utils/color.h"
#include <climits>
#include <gtest/gtest.h>
using namespace std;
using namespace testing::ext;
namespace OHOS {
class ColorTest : public testing::Test {
public:
static void SetUpTestCase(void);
static void TearDownTestCase(void);
static Color* color;
};
Color* ColorTest::color = nullptr;
void ColorTest::SetUpTestCase(void)
{
return;
}
void ColorTest::TearDownTestCase(void)
{
return;
}
/**
* @tc.number SUB_GRAPHIC_COLOR_GETCOLORFROMRGB_0100
* @tc.name test color get-color-from-RGB api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_GetColorFromRGB_0100, Function | MediumTest | Level0)
{
EXPECT_EQ(Color::GetColorFromRGB(0, 0, 0).red, 0);
EXPECT_EQ(Color::GetColorFromRGB(0, 0, 0).green, 0);
EXPECT_EQ(Color::GetColorFromRGB(0, 0, 0).blue, 0);
EXPECT_EQ(Color::GetColorFromRGB(0, 0, 0).alpha, 0xFF);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_GETCOLORFROMRGBA_0200
* @tc.name test color get-color-from-RGBA api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_GetColorFromRGBA_0200, Function | MediumTest | Level0)
{
EXPECT_EQ(Color::GetColorFromRGBA(0, 0, 0, 0).red, 0);
EXPECT_EQ(Color::GetColorFromRGBA(0, 0, 0, 0).green, 0);
EXPECT_EQ(Color::GetColorFromRGBA(0, 0, 0, 0).blue, 0);
EXPECT_EQ(Color::GetColorFromRGBA(0, 0, 0, 0).alpha, 0);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_COLORTO32_0300
* @tc.name test color color-to-32 api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_ColorTo32_0300, Function | MediumTest | Level0)
{
ColorType color;
color.red = 0;
color.green = 0;
color.blue = 0;
color.alpha = 0;
uint32_t color32 = 0;
EXPECT_EQ(Color::ColorTo32(color), color32);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_COLORTO32_0400
* @tc.name test color color-to-32-2 api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_ColorTo32_0400, Function | MediumTest | Level0)
{
Color16 color;
color.red = 0;
color.green = 0;
color.blue = 0;
EXPECT_EQ(Color::ColorTo32(color, 0), 0);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_COLORTO16_0500
* @tc.name test color color-to-16 api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_ColorTo16_0500, Function | MediumTest | Level0)
{
Color32 color32;
color32.red = 0;
color32.green = 0;
color32.blue = 0;
EXPECT_EQ(Color::ColorTo16(color32), 0);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_WHITE_0600
* @tc.name test color white api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_White_0600, Function | MediumTest | Level0)
{
ColorType white = Color::White();
EXPECT_EQ(white.red, 0xFF);
EXPECT_EQ(white.green, 0xFF);
EXPECT_EQ(white.blue, 0xFF);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_SILVER_0700
* @tc.name test color silver api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_Silver_0700, Function | MediumTest | Level0)
{
ColorType silver = Color::Silver();
EXPECT_EQ(silver.red, 0xC0);
EXPECT_EQ(silver.green, 0xC0);
EXPECT_EQ(silver.blue, 0xC0);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_GRAY_0800
* @tc.name test color gray api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_Gray_0800, Function | MediumTest | Level0)
{
ColorType gray = Color::Gray();
EXPECT_EQ(gray.red, 0x80);
EXPECT_EQ(gray.green, 0x80);
EXPECT_EQ(gray.blue, 0x80);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_BLACK_0900
* @tc.name test color black api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_Black_0900, Function | MediumTest | Level0)
{
ColorType black = Color::Black();
EXPECT_EQ(black.red, 0x00);
EXPECT_EQ(black.green, 0x00);
EXPECT_EQ(black.blue, 0x00);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_RED_1000
* @tc.name test color red api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_Red_1000, Function | MediumTest | Level0)
{
ColorType red = Color::Red();
EXPECT_EQ(red.red, 0xFF);
EXPECT_EQ(red.green, 0x00);
EXPECT_EQ(red.blue, 0x00);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_MAROON_1100
* @tc.name test color maroon api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_Maroon_1100, Function | MediumTest | Level0)
{
ColorType maroon = Color::Maroon();
EXPECT_EQ(maroon.red, 0x80);
EXPECT_EQ(maroon.green, 0x00);
EXPECT_EQ(maroon.blue, 0x00);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_YELLOW_1200
* @tc.name test color yellow api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_Yellow_1200, Function | MediumTest | Level0)
{
ColorType yellow = Color::Yellow();
EXPECT_EQ(yellow.red, 0xFF);
EXPECT_EQ(yellow.green, 0xFF);
EXPECT_EQ(yellow.blue, 0x00);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_OLIVE_1300
* @tc.name test color olive api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_Olive_1300, Function | MediumTest | Level0)
{
ColorType olive = Color::Olive();
EXPECT_EQ(olive.red, 0x80);
EXPECT_EQ(olive.green, 0x80);
EXPECT_EQ(olive.blue, 0x00);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_LIME_1400
* @tc.name test color lime api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_Lime_1400, Function | MediumTest | Level0)
{
ColorType lime = Color::Lime();
EXPECT_EQ(lime.red, 0x00);
EXPECT_EQ(lime.green, 0xFF);
EXPECT_EQ(lime.blue, 0x00);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_GREEN_1500
* @tc.name test color GREEN api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_Green_1500, Function | MediumTest | Level0)
{
ColorType green = Color::Green();
EXPECT_EQ(green.red, 0x00);
EXPECT_EQ(green.green, 0xFF);
EXPECT_EQ(green.blue, 0x00);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_CYAN_1600
* @tc.name test color CYAN api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_Cyan_1600, Function | MediumTest | Level0)
{
ColorType cyan = Color::Cyan();
EXPECT_EQ(cyan.red, 0x00);
EXPECT_EQ(cyan.green, 0xFF);
EXPECT_EQ(cyan.blue, 0xFF);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_AQUA_1700
* @tc.name test color aqua api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_Aqua_1700, Function | MediumTest | Level0)
{
ColorType aqua = Color::Aqua();
EXPECT_EQ(aqua.red, 0x00);
EXPECT_EQ(aqua.green, 0xFF);
EXPECT_EQ(aqua.blue, 0xFF);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_TEAL_1800
* @tc.name test color teal api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_Teal_1800, Function | MediumTest | Level0)
{
ColorType teal = Color::Teal();
EXPECT_EQ(teal.red, 0x00);
EXPECT_EQ(teal.green, 0x80);
EXPECT_EQ(teal.blue, 0x80);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_BLUE_1900
* @tc.name test color blue api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_Blue_1900, Function | MediumTest | Level0)
{
ColorType blue = Color::Blue();
EXPECT_EQ(blue.red, 0x00);
EXPECT_EQ(blue.green, 0x00);
EXPECT_EQ(blue.blue, 0xFF);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_NAVY_2000
* @tc.name test color navy api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_Navy_2000, Function | MediumTest | Level0)
{
ColorType navy = Color::Navy();
EXPECT_EQ(navy.red, 0x00);
EXPECT_EQ(navy.green, 0x00);
EXPECT_EQ(navy.blue, 0x80);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_MAGENTA_2100
* @tc.name test color magenta api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_Magenta_2100, Function | MediumTest | Level0)
{
ColorType magenta = Color::Magenta();
EXPECT_EQ(magenta.red, 0xFF);
EXPECT_EQ(magenta.green, 0x00);
EXPECT_EQ(magenta.blue, 0xFF);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_PURPLE_2200
* @tc.name test color purple api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_Purple_2200, Function | MediumTest | Level0)
{
ColorType purple = Color::Purple();
EXPECT_EQ(purple.red, 0x80);
EXPECT_EQ(purple.green, 0x00);
EXPECT_EQ(purple.blue, 0x80);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_ORANGE_2300
* @tc.name test color orange api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_Orange_2300, Function | MediumTest | Level0)
{
ColorType orange = Color::Orange();
EXPECT_EQ(orange.red, 0xFF);
EXPECT_EQ(orange.green, 0xA5);
EXPECT_EQ(orange.blue, 0x00);
}
/**
* @tc.number SUB_GRAPHIC_COLOR_GETMIXCOLOR_2400
* @tc.name test color getmixcolor api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ColorTest, Graphic_Color_Test_GetMixColor_2400, Function | MediumTest | Level0)
{
ColorType c1;
c1.red = 0;
c1.green = 0;
c1.blue = 0;
ColorType c2;
c2.red = 0;
c2.green = 0;
c2.blue = 0;
uint8_t mix = 0;
ColorType ret = Color::GetMixColor(c1, c2, mix);
EXPECT_EQ(ret.red, 0);
EXPECT_EQ(ret.green, 0);
EXPECT_EQ(ret.blue, 0);
EXPECT_EQ(ret.alpha, 0xFF);
}
} // namespace OHOS
\ No newline at end of file
# Copyright (c) 2021 Huawei Device 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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsEasingEquationTest") {
suite_name = "acts"
sources = [ "src/test_easing_equation.cpp" ]
include_dirs = [
"//kernel/liteos_a/kernel/include/",
"//kernel/liteos_a/kernel/common",
"//third_party/bounds_checking_function/include",
"//third_party/cJSON",
"//third_party/libpng",
"//third_party/libjpeg",
"//utils/native/lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/communication/broadcast",
]
ldflags = [ "-Wl,-Map=toggleButtonTest.map" ]
deps = [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/communication/ipc_lite:liteipc_adapter",
"//foundation/distributedschedule/samgr_lite/communication/broadcast",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//foundation/distributedschedule/samgr_lite/samgr_client:client",
"//foundation/graphic/surface:lite_surface",
"//foundation/graphic/ui:lite_ui",
"//foundation/graphic/utils:lite_graphic_hals",
"//foundation/graphic/wms:lite_wms",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-fno-rtti" ]
}
{
"description": "Config for uikit uibutton test cases",
"environment": [
{
"type": "device",
"label": "ipcamera"
}
],
"kits": [
{
"type": "MountKit",
"server": "NfsServer",
"mount": [
{
"source": "testcases/graphic",
"target": "/test_root/graphic"
}
]
}
],
"driver": {
"type": "CppTestLite",
"execute": "/test_root/graphic/ActsEasingEquationTest.bin"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 "animator/easing_equation.h"
#include <climits>
#include <gtest/gtest.h>
using namespace std;
using namespace testing::ext;
namespace OHOS {
class TestEasingEquation : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
};
/**
* @tc.number SUB_GRAPHIC_EASING_EQUATION_BACKEASEOUT_0100
* @tc.name test ui_view BackEaseOut api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestEasingEquation, Graphic_EasingEquation_Test_BackEaseOut_0100, Function | MediumTest | Level0)
{
EasingEquation* animator = new EasingEquation();
EXPECT_EQ(animator->BackEaseOut(0, 1, 10, 5), 1);
delete animator;
}
/**
* @tc.number SUB_GRAPHIC_EASING_EQUATION_BACKEASEINOUT_0200
* @tc.name test ui_view BackEaseInOut api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestEasingEquation, Graphic_EasingEquation_Test_BackEaseInOut_0200, Function | MediumTest | Level0)
{
EasingEquation* animator = new EasingEquation();
EXPECT_EQ(animator->BackEaseInOut(0, 1, 10, 5), 1);
delete animator;
}
/**
* @tc.number SUB_GRAPHIC_EASING_EQUATION_CIRCEASEIN_0300
* @tc.name test ui_view CircEaseIn api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestEasingEquation, Graphic_EasingEquation_Test_CircEaseIn_0300, Function | MediumTest | Level0)
{
EasingEquation* animator = new EasingEquation();
EXPECT_EQ(animator->CircEaseIn(0, 1, 10, 5), 1);
delete animator;
}
/**
* @tc.number SUB_GRAPHIC_EASING_EQUATION_CIRCEASEOUT_0400
* @tc.name test ui_view CircEaseOut api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestEasingEquation, Graphic_EasingEquation_Test_CircEaseOut_0400, Function | MediumTest | Level0)
{
EasingEquation* animator = new EasingEquation();
EXPECT_EQ(animator->CircEaseOut(0, 1, 10, 5), 1);
delete animator;
}
/**
* @tc.number SUB_GRAPHIC_EASING_EQUATION_CIRCEASEINOUT_0500
* @tc.name test ui_view CircEaseInOut api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestEasingEquation, Graphic_EasingEquation_Test_CircEaseInOut_0500, Function | MediumTest | Level0)
{
EasingEquation* animator = new EasingEquation();
EXPECT_EQ(animator->CircEaseInOut(0, 1, 10, 5), 1);
delete animator;
}
/**
* @tc.number SUB_GRAPHIC_EASING_EQUATION_CUBICEASEIN_0600
* @tc.name test ui_view CubicEaseIn api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestEasingEquation, Graphic_EasingEquation_Test_CubicEaseIn_0600, Function | MediumTest | Level0)
{
EasingEquation* animator = new EasingEquation();
EXPECT_EQ(animator->CubicEaseIn(0, 1, 10, 5), 1);
delete animator;
}
/**
* @tc.number SUB_GRAPHIC_EASING_EQUATION_CUBICEASEOUT_0700
* @tc.name test ui_view CubicEaseOut api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestEasingEquation, Graphic_EasingEquation_Test_CubicEaseOut_0700, Function | MediumTest | Level0)
{
EasingEquation* animator = new EasingEquation();
EXPECT_EQ(animator->CubicEaseOut(0, 1, 10, 5), 1);
delete animator;
}
/**
* @tc.number SUB_GRAPHIC_EASING_EQUATION_CUBICEASEINOUT_0800
* @tc.name test ui_view CubicEaseInOut api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestEasingEquation, Graphic_EasingEquation_Test_CubicEaseInOut_0800, Function | MediumTest | Level0)
{
EasingEquation* animator = new EasingEquation();
EXPECT_EQ(animator->CubicEaseInOut(0, 1, 10, 5), 1);
delete animator;
}
/**
* @tc.number SUB_GRAPHIC_EASING_EQUATION_LINEAREASENONE_0900
* @tc.name test ui_view LinearEaseNone api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestEasingEquation, Graphic_EasingEquation_Test_LinearEaseNone_0900, Function | MediumTest | Level0)
{
EasingEquation* animator = new EasingEquation();
EXPECT_EQ(animator->LinearEaseNone(0, 1, 10, 5), 1);
delete animator;
}
/**
* @tc.number SUB_GRAPHIC_EASING_EQUATION_QUADEASEIN_1000
* @tc.name test ui_view QuadEaseIn api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestEasingEquation, Graphic_EasingEquation_Test_QuadEaseIn_1000, Function | MediumTest | Level0)
{
EasingEquation* animator = new EasingEquation();
EXPECT_EQ(animator->QuadEaseIn(0, 1, 10, 5), 1);
delete animator;
}
/**
* @tc.number SUB_GRAPHIC_EASING_EQUATION_QUADEASEOUT_1100
* @tc.name test ui_view QuadEaseOut api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestEasingEquation, Graphic_EasingEquation_Test_QuadEaseOut_1100, Function | MediumTest | Level0)
{
EasingEquation* animator = new EasingEquation();
EXPECT_EQ(animator->QuadEaseOut(0, 1, 10, 5), 1);
delete animator;
}
/**
* @tc.number SUB_GRAPHIC_EASING_EQUATION_QUADEASEINOUT_1200
* @tc.name test ui_view QuadEaseInOut api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestEasingEquation, Graphic_EasingEquation_Test_QuadEaseInOut_1200, Function | MediumTest | Level0)
{
EasingEquation* animator = new EasingEquation();
EXPECT_EQ(animator->QuadEaseInOut(0, 1, 10, 5), 1);
delete animator;
}
/**
* @tc.number SUB_GRAPHIC_EASING_EQUATION_QUINTEASEIN_1300
* @tc.name test ui_view QuintEaseIn api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestEasingEquation, Graphic_EasingEquation_Test_QuintEaseIn_1300, Function | MediumTest | Level0)
{
EasingEquation* animator = new EasingEquation();
EXPECT_EQ(animator->QuintEaseIn(0, 1, 10, 5), 1);
delete animator;
}
/**
* @tc.number SUB_GRAPHIC_EASING_EQUATION_QUINTEASEOUT_1400
* @tc.name test ui_view QuintEaseOut api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestEasingEquation, Graphic_EasingEquation_Test_QuintEaseOut_1400, Function | MediumTest | Level0)
{
EasingEquation* animator = new EasingEquation();
EXPECT_EQ(animator->QuintEaseOut(0, 1, 10, 5), 1);
delete animator;
}
/**
* @tc.number SUB_GRAPHIC_EASING_EQUATION_QUINTEASEINOUT_1500
* @tc.name test ui_view QuintEaseInOut api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestEasingEquation, Graphic_EasingEquation_Test_QuintEaseInOut_1500, Function | MediumTest | Level0)
{
EasingEquation* animator = new EasingEquation();
EXPECT_EQ(animator->QuintEaseInOut(0, 1, 10, 5), 1);
delete animator;
}
/**
* @tc.number SUB_GRAPHIC_EASING_EQUATION_SINEEASEIN_1600
* @tc.name test ui_view SineEaseIn api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestEasingEquation, Graphic_EasingEquation_Test_SineEaseIn_1600, Function | MediumTest | Level0)
{
EasingEquation* animator = new EasingEquation();
EXPECT_EQ(animator->SineEaseIn(0, 1, 10, 5), 1);
delete animator;
}
/**
* @tc.number SUB_GRAPHIC_EASING_EQUATION_SINEEASEOUT_1700
* @tc.name test ui_view SineEaseOut api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestEasingEquation, Graphic_EasingEquation_Test_SineEaseOut_1700, Function | MediumTest | Level0)
{
EasingEquation* animator = new EasingEquation();
EXPECT_EQ(animator->SineEaseOut(0, 1, 10, 5), 1);
delete animator;
}
/**
* @tc.number SUB_GRAPHIC_EASING_EQUATION_SINEEASEINOUT_1800
* @tc.name test ui_view SineEaseInOut api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestEasingEquation, Graphic_EasingEquation_Test_SineEaseInOut_1800, Function | MediumTest | Level0)
{
EasingEquation* animator = new EasingEquation();
EXPECT_EQ(animator->SineEaseInOut(0, 1, 10, 5), 1);
delete animator;
}
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device 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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsEventsTest") {
suite_name = "acts"
sources = [
"src/cancel_event_test.cpp",
"src/click_event_test.cpp",
"src/drag_event_test.cpp",
"src/event_test.cpp",
"src/key_event_test.cpp",
"src/long_press_event_test.cpp",
"src/press_event_test.cpp",
"src/release_event_test.cpp",
"src/virtual_device_event_test.cpp",
]
include_dirs = [
"//kernel/liteos_a/kernel/include/",
"//kernel/liteos_a/kernel/common",
"//third_party/bounds_checking_function/include",
"//third_party/cJSON",
"//third_party/libpng",
"//third_party/libjpeg",
"//utils/native/lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/communication/broadcast",
]
ldflags = [ "-Wl,-Map=toggleButtonTest.map" ]
deps = [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/communication/ipc_lite:liteipc_adapter",
"//foundation/distributedschedule/samgr_lite/communication/broadcast",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//foundation/distributedschedule/samgr_lite/samgr_client:client",
"//foundation/graphic/surface:lite_surface",
"//foundation/graphic/ui:lite_ui",
"//foundation/graphic/utils:lite_graphic_hals",
"//foundation/graphic/wms:lite_wms",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-fno-rtti" ]
}
{
"description": "Config for uikit uibutton test cases",
"environment": [
{
"type": "device",
"label": "ipcamera"
}
],
"kits": [
{
"type": "MountKit",
"server": "NfsServer",
"mount": [
{
"source": "testcases/graphic",
"target": "/test_root/graphic"
}
]
}
],
"driver": {
"type": "CppTestLite",
"execute": "/test_root/graphic/ActsEventsTest.bin"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 <climits>
#include <gtest/gtest.h>
#include "events/cancel_event.h"
using namespace std;
using namespace testing::ext;
namespace OHOS {
class CancelEventTest : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
};
/**
* @tc.number SUB_GRAPHIC_CANCELEVENT_CONSTRUCTOR_0100
* @tc.name test cancel-event constructor api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(CancelEventTest, Graphic_CancelEvent_Test_Constructor_0100, Function | MediumTest | Level0)
{
Point pos = {100, 200};
CancelEvent *cancelEvent = new CancelEvent(pos);
EXPECT_EQ(cancelEvent->GetCurrentPos().x, pos.x);
EXPECT_EQ(cancelEvent->GetCurrentPos().y, pos.y);
delete cancelEvent;
}
} // namespace OHOS
/*
* Copyright (c) 2021 Huawei Device 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 <climits>
#include <gtest/gtest.h>
#include "events/click_event.h"
using namespace std;
using namespace testing::ext;
namespace OHOS {
class ClickEventTest : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
};
/**
* @tc.number SUB_GRAPHIC_CLICKEVENT_CONSTRUCTOR_0100
* @tc.name test click-event constructor api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ClickEventTest, Graphic_ClickEvent_Test_Constructor_0100, Function | MediumTest | Level0)
{
Point pos = {100, 200};
ClickEvent *clickEvent = new ClickEvent(pos);
EXPECT_EQ(clickEvent->GetCurrentPos().x, pos.x);
EXPECT_EQ(clickEvent->GetCurrentPos().y, pos.y);
delete clickEvent;
}
} // namespace OHOS
/*
* Copyright (c) 2021 Huawei Device 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 <climits>
#include <gtest/gtest.h>
#include "events/drag_event.h"
using namespace std;
using namespace testing::ext;
namespace OHOS {
class DragEventTest : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
};
/**
* @tc.number SUB_GRAPHIC_DRAYEVENT_CONSTRUCTOR_0100
* @tc.name test dray-event constructor api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(DragEventTest, Graphic_DrayEvent_Test_Constructor_0100, Function | MediumTest | Level0)
{
Point newPos = { 100, 200 };
Point lastPos = { 150, 250 };
Point totalLen = { 50, 150 };
DragEvent *daryEvent = new DragEvent(newPos, lastPos, totalLen);
EXPECT_EQ(daryEvent->GetCurrentPos().x, newPos.x);
EXPECT_EQ(daryEvent->GetCurrentPos().y, newPos.y);
delete daryEvent;
}
/**
* @tc.number SUB_GRAPHIC_DRAYEVENT_CONSTRUCTOR_0200
* @tc.name test dray-event get-last-point api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(DragEventTest, Graphic_DrayEvent_Test_GetLastPoint_0200, Function | MediumTest | Level0)
{
Point newPos = {100, 200};
Point lastPos = {150, 250};
Point totalLen = {50, 150};
DragEvent *daryEvent = new DragEvent(newPos, lastPos, totalLen);
EXPECT_EQ(daryEvent->GetLastPoint().x, lastPos.x);
EXPECT_EQ(daryEvent->GetLastPoint().y, lastPos.y);
delete daryEvent;
}
/**
* @tc.number SUB_GRAPHIC_DRAYEVENT_CONSTRUCTOR_0300
* @tc.name test dray-event get-start-point api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(DragEventTest, Graphic_DrayEvent_Test_GetStartPoint_0300, Function | MediumTest | Level0)
{
Point newPos = {100, 200};
Point lastPos = {150, 250};
Point totalLen = {50, 150};
DragEvent *daryEvent = new DragEvent(newPos, lastPos, totalLen);
EXPECT_EQ(daryEvent->GetStartPoint().x, newPos.x - totalLen.x);
EXPECT_EQ(daryEvent->GetStartPoint().y, newPos.y - totalLen.y);
delete daryEvent;
}
/**
* @tc.number SUB_GRAPHIC_DRAYEVENT_CONSTRUCTOR_0400
* @tc.name test dray-event set-prelast-point api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(DragEventTest, Graphic_DrayEvent_Test_SetPreLastPoint_0400, Function | MediumTest | Level0)
{
Point newPos = {100, 200};
Point lastPos = {150, 250};
Point totalLen = {50, 150};
DragEvent *daryEvent = new DragEvent(newPos, lastPos, totalLen);
Point preLastPos = {20, 40};
daryEvent->SetPreLastPoint(preLastPos);
EXPECT_EQ(daryEvent->GetPreLastPoint().x, preLastPos.x);
EXPECT_EQ(daryEvent->GetPreLastPoint().y, preLastPos.y);
delete daryEvent;
}
/**
* @tc.number SUB_GRAPHIC_DRAYEVENT_CONSTRUCTOR_0500
* @tc.name test dray-event get-drag-direction api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(DragEventTest, Graphic_DrayEvent_Test_GetDragDirection_0500, Function | MediumTest | Level0)
{
Point newPos = {100, 200};
Point lastPos = {150, 250};
Point totalLen = {50, 150};
DragEvent *daryEvent = new DragEvent(newPos, lastPos, totalLen);
EXPECT_EQ(daryEvent->GetDragDirection(), 2);
delete daryEvent;
}
/**
* @tc.number SUB_GRAPHIC_DRAYEVENT_CONSTRUCTOR_0600
* @tc.name test dray-event get-deltaX api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(DragEventTest, Graphic_DrayEvent_Test_GetDeltaX_0600, Function | MediumTest | Level0)
{
Point newPos = {100, 200};
Point lastPos = {150, 250};
Point totalLen = {50, 150};
DragEvent *daryEvent = new DragEvent(newPos, lastPos, totalLen);
EXPECT_EQ(daryEvent->GetDeltaX(), newPos.x - lastPos.x);
delete daryEvent;
}
/**
* @tc.number SUB_GRAPHIC_DRAYEVENT_CONSTRUCTOR_0700
* @tc.name test dray-event get-deltaY api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(DragEventTest, Graphic_DrayEvent_Test_GetDeltaY_0700, Function | MediumTest | Level0)
{
Point newPos = {100, 200};
Point lastPos = {150, 250};
Point totalLen = {50, 150};
DragEvent *daryEvent = new DragEvent(newPos, lastPos, totalLen);
EXPECT_EQ(daryEvent->GetDeltaY(), newPos.y - lastPos.y);
delete daryEvent;
}
} // namespace OHOS
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 <climits>
#include <gtest/gtest.h>
#include "events/event.h"
using namespace std;
using namespace testing::ext;
namespace OHOS {
class EventTest : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
};
/**
* @tc.number SUB_GRAPHIC_EVENT_CONSTRUCTOR_0100
* @tc.name test event constructor api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(EventTest, Graphic_Event_Test_Constructor_0100, Function | MediumTest | Level0)
{
Point pos = {100, 200};
Event *event = new Event(pos);
EXPECT_EQ(event->GetCurrentPos().x, pos.x);
EXPECT_EQ(event->GetCurrentPos().y, pos.y);
delete event;
}
/**
* @tc.number SUB_GRAPHIC_EVENT_SETTIMESTAMP_0200
* @tc.name test event set-time-stamp api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(EventTest, Graphic_Event_Test_SetTimeStamp_0200, Function | MediumTest | Level0)
{
Point pos = {100, 200};
Event *event = new Event(pos);
TimeType timeType = 100;
event->SetTimeStamp(timeType);
EXPECT_EQ(event->GetTimeStamp(), timeType);
delete event;
}
} // namespace OHOS
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 <climits>
#include <gtest/gtest.h>
#include "events/key_event.h"
using namespace std;
using namespace testing::ext;
namespace OHOS {
class KeyEventTest : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
};
/**
* @tc.number SUB_GRAPHIC_KEYEVENT_GETKEYID_0100
* @tc.name test key-event get-keyID api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(KeyEventTest, Graphic_KeyEvent_Test_GetKeyId_0100, Function | MediumTest | Level0)
{
uint16_t keyId = 10;
uint16_t state = 20;
KeyEvent *keyEvent = new KeyEvent(keyId, state);
EXPECT_EQ(keyEvent->GetKeyId(), keyId);
delete keyEvent;
}
/**
* @tc.number SUB_GRAPHIC_KEYEVENT_GETSTATE_0200
* @tc.name test key-event get-state api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(KeyEventTest, Graphic_KeyEvent_Test_GetState_0200, Function | MediumTest | Level0)
{
uint16_t keyId = 10;
uint16_t state = 20;
KeyEvent *keyEvent = new KeyEvent(keyId, state);
EXPECT_EQ(keyEvent->GetState(), state);
delete keyEvent;
}
} // namespace OHOS
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 <climits>
#include <gtest/gtest.h>
#include "events/long_press_event.h"
using namespace std;
using namespace testing::ext;
namespace OHOS {
class LongPressEventTest : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
};
/**
* @tc.number SUB_GRAPHIC_LONGPRESS_GETCURRENTPOS_0100
* @tc.name test long-press get-current-pos api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(LongPressEventTest, Graphic_LongPressEvent_Test_GetCurrentPos_0100, Function | MediumTest | Level0)
{
Point pos = {100, 200};
TimeType timeStamp = 20;
LongPressEvent *longPressEvent = new LongPressEvent(pos, timeStamp);
EXPECT_EQ(longPressEvent->GetCurrentPos().x, pos.x);
EXPECT_EQ(longPressEvent->GetCurrentPos().y, pos.y);
delete longPressEvent;
}
/**
* @tc.number SUB_GRAPHIC_LONGPRESS_GETTIMESTAMP_0200
* @tc.name test long-press get-time-stamp api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(LongPressEventTest, Graphic_LongPressEvent_Test_GetTimeStamp_0200, Function | MediumTest | Level0)
{
Point pos = {100, 200};
TimeType timeStamp = 20;
LongPressEvent *longPressEvent = new LongPressEvent(pos, timeStamp);
EXPECT_EQ(longPressEvent->GetTimeStamp(), timeStamp);
delete longPressEvent;
}
} // namespace OHOS
/*
* Copyright (c) 2021 Huawei Device 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 <climits>
#include <gtest/gtest.h>
#include "events/press_event.h"
using namespace std;
using namespace testing::ext;
namespace OHOS {
class PressEventTest : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
};
/**
* @tc.number SUB_GRAPHIC_PRESS_CONSTRUCTOR_0100
* @tc.name test press constructor api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(PressEventTest, Graphic_PressEvent_Test_Constructor_0100, Function | MediumTest | Level0)
{
Point pos = {100, 200};
PressEvent *pressEvent = new PressEvent(pos);
EXPECT_EQ(pressEvent->GetCurrentPos().x, pos.x);
EXPECT_EQ(pressEvent->GetCurrentPos().y, pos.y);
delete pressEvent;
}
} // namespace OHOS
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 <climits>
#include <gtest/gtest.h>
#include "events/release_event.h"
using namespace std;
using namespace testing::ext;
namespace OHOS {
class ReleaseEventTest : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
};
/**
* @tc.number SUB_GRAPHIC_RELEASE_CONSTRUCTOR_0100
* @tc.name test release constructor api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ReleaseEventTest, Graphic_ReleaseEvent_Test_Constructor_0100, Function | MediumTest | Level0)
{
Point pos = {100, 200};
ReleaseEvent *releaseEvent = new ReleaseEvent(pos);
EXPECT_EQ(releaseEvent->GetCurrentPos().x, pos.x);
EXPECT_EQ(releaseEvent->GetCurrentPos().y, pos.y);
delete releaseEvent;
}
} // namespace OHOS
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 <climits>
#include <gtest/gtest.h>
#include "events/virtual_device_event.h"
using namespace std;
using namespace testing::ext;
namespace OHOS {
class VirtualDeviceEventTest : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
};
/**
* @tc.number SUB_GRAPHIC_VIRTUALDEVICE_GETTYPE_0100
* @tc.name test virtual-device get-type api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(VirtualDeviceEventTest, Graphic_VirtualDeviceEvent_Test_GetType_0100, Function | MediumTest | Level0)
{
uint16_t type = 10;
uint16_t value = 20;
VirtualDeviceEvent *virtualDeviceEvent = new VirtualDeviceEvent(type, value);
EXPECT_EQ(virtualDeviceEvent->GetType(), type);
delete virtualDeviceEvent;
}
/**
* @tc.number SUB_GRAPHIC_VIRTUALDEVICE_GETSTATE_0200
* @tc.name test virtual-device get-state api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(VirtualDeviceEventTest, Graphic_VirtualDeviceEvent_Test_GetState_0200, Function | MediumTest | Level0)
{
uint16_t type = 10;
uint16_t value = 20;
VirtualDeviceEvent *virtualDeviceEvent = new VirtualDeviceEvent(type, value);
EXPECT_EQ(virtualDeviceEvent->GetState(), value);
delete virtualDeviceEvent;
}
} // namespace OHOS
\ No newline at end of file
# Copyright (c) 2021 Huawei Device 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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsFlexlaoutTest") {
suite_name = "acts"
sources = [ "src/test_flex_layout.cpp" ]
include_dirs = [
"//kernel/liteos_a/kernel/include/",
"//kernel/liteos_a/kernel/common",
"//third_party/bounds_checking_function/include",
"//third_party/cJSON",
"//third_party/libpng",
"//third_party/libjpeg",
"//utils/native/lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/communication/broadcast",
]
ldflags = [ "-Wl,-Map=toggleButtonTest.map" ]
deps = [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/communication/ipc_lite:liteipc_adapter",
"//foundation/distributedschedule/samgr_lite/communication/broadcast",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//foundation/distributedschedule/samgr_lite/samgr_client:client",
"//foundation/graphic/surface:lite_surface",
"//foundation/graphic/ui:lite_ui",
"//foundation/graphic/utils:lite_graphic_hals",
"//foundation/graphic/wms:lite_wms",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-fno-rtti" ]
}
{
"description": "Config for uikit uibutton test cases",
"environment": [
{
"type": "device",
"label": "ipcamera"
}
],
"kits": [
{
"type": "MountKit",
"server": "NfsServer",
"mount": [
{
"source": "testcases/graphic",
"target": "/test_root/graphic"
}
]
}
],
"driver": {
"type": "CppTestLite",
"execute": "/test_root/graphic/ActsFlexlaoutTest.bin"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 "layout/flex_layout.h"
#include <climits>
#include <gtest/gtest.h>
using namespace std;
using namespace testing::ext;
namespace OHOS {
class TestFlexLayout : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
virtual void SetUp() {}
virtual void TearDown() {}
};
/**
* @tc.number SUB_GRAPHIC_FLEXLAYOUT_SETMAJORAXISALIGN_0100
* @tc.name test FlexLayout SetMajorAxisAlign api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestFlexLayout, SUB_GRAPHIC_FLEXLAYOUT_SETMAJORAXISALIGN_0100, Function | MediumTest | Level0)
{
FlexLayout* layout = new FlexLayout();
layout->SetMajorAxisAlign(ALIGN_END);
EXPECT_EQ(0, 0);
delete layout;
}
/**
* @tc.number SUB_GRAPHIC_FLEXLAYOUT_SETSECONDARYAXISALIGN_0200
* @tc.name test FlexLayout SetSecondaryAxisAlign api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestFlexLayout, SUB_GRAPHIC_FLEXLAYOUT_SetSecondaryAxisAlign_0200, Function | MediumTest | Level0)
{
FlexLayout* layout = new FlexLayout();
layout->SetSecondaryAxisAlign(ALIGN_END);
EXPECT_EQ(0, 0);
delete layout;
}
/**
* @tc.number SUB_GRAPHIC_FLEXLAYOUT_SETFLEXWRAP_0300
* @tc.name test FlexLayout SetFlexWrap api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestFlexLayout, SUB_GRAPHIC_FLEXLAYOUT_SetFlexWrap_0300, Function | MediumTest | Level0)
{
FlexLayout* layout = new FlexLayout();
layout->SetFlexWrap(true);
EXPECT_EQ(0, 0);
delete layout;
}
/**
* @tc.number SUB_GRAPHIC_FLEXLAYOUT_LAYOUTCHILDREN_0400
* @tc.name test FlexLayout LayoutChildren api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TestFlexLayout, SUB_GRAPHIC_FLEXLAYOUT_LayoutChildren_0400, Function | MediumTest | Level0)
{
FlexLayout* layout = new FlexLayout();
layout->LayoutChildren(true);
EXPECT_EQ(0, 0);
delete layout;
}
} // namespace OHOS
\ No newline at end of file
# Copyright (c) 2021 Huawei Device 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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsGeometyr2dTest") {
suite_name = "acts"
sources = [ "src/geometry2d_test.cpp" ]
include_dirs = [
"//kernel/liteos_a/kernel/include/",
"//kernel/liteos_a/kernel/common",
"//third_party/bounds_checking_function/include",
"//third_party/cJSON",
"//third_party/libpng",
"//third_party/libjpeg",
"//utils/native/lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/communication/broadcast",
]
ldflags = [ "-Wl,-Map=toggleButtonTest.map" ]
deps = [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/communication/ipc_lite:liteipc_adapter",
"//foundation/distributedschedule/samgr_lite/communication/broadcast",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//foundation/distributedschedule/samgr_lite/samgr_client:client",
"//foundation/graphic/surface:lite_surface",
"//foundation/graphic/ui:lite_ui",
"//foundation/graphic/utils:lite_graphic_hals",
"//foundation/graphic/wms:lite_wms",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-fno-rtti" ]
}
{
"description": "Config for uikit uibutton test cases",
"environment": [
{
"type": "device",
"label": "ipcamera"
}
],
"kits": [
{
"type": "MountKit",
"server": "NfsServer",
"mount": [
{
"source": "testcases/graphic",
"target": "/test_root/graphic"
}
]
}
],
"driver": {
"type": "CppTestLite",
"execute": "/test_root/graphic/ActsGeometyr2dTest.bin"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 "gfx_utils/geometry2d.h"
#include <climits>
#include <gtest/gtest.h>
using namespace std;
using namespace testing::ext;
namespace OHOS {
class Geometry2dTest : public testing::Test {
public:
static void SetUpTestCase(void);
static void TearDownTestCase(void);
};
void Geometry2dTest::SetUpTestCase()
{
return;
}
void Geometry2dTest::TearDownTestCase()
{
return;
}
/**
* @tc.number SUB_GRAPHIC_GEOMETRY2D_LINE_OPERATOR_0100
* @tc.name test line of geometry2d operator api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(Geometry2dTest, Graphic_Line_Test_operator_0100, Function | MediumTest | Level0)
{
Vector2<int16_t> pt1 = { 100, 200 };
Vector2<int16_t> pt2 = { 300, 400 };
Line* line = new Line(pt1, pt2);
EXPECT_EQ(line->operator[](0).x_, 100);
EXPECT_EQ(line->operator[](0).y_, 200);
EXPECT_EQ(line->operator[](1).x_, 300);
EXPECT_EQ(line->operator[](1).y_, 400);
delete line;
line = new Line(100, 200, 300, 400);
EXPECT_EQ(line->operator[](0).x_, 100);
EXPECT_EQ(line->operator[](0).y_, 200);
EXPECT_EQ(line->operator[](1).x_, 300);
EXPECT_EQ(line->operator[](1).y_, 400);
delete line;
}
/**
* @tc.number SUB_GRAPHIC_GEOMETRY2D_POLYGON_MAKEAABB_0200
* @tc.name test polygon of geometry2d makeAABB api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(Geometry2dTest, Graphic_Polygon_Test_MakeAABB_0200, Function | MediumTest | Level0)
{
Vector2<int16_t> vertexes[4] = { {0, 0}, {500, 100}, {300, 500}, {100, 300} };
Polygon* polygon = new Polygon(vertexes, 4);
Rect rect = polygon->MakeAABB();
EXPECT_EQ(rect.GetLeft(), 0);
EXPECT_EQ(rect.GetTop(), 0);
EXPECT_EQ(rect.GetRight(), 500);
EXPECT_EQ(rect.GetBottom(), 500);
delete polygon;
}
/**
* @tc.number SUB_GRAPHIC_GEOMETRY2D_POLYGON_GETVERTEXNUM_0300
* @tc.name test polygon of geometry2d get-vertexNum api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(Geometry2dTest, Graphic_Polygon_Test_GetVertexNum_0300, Function | MediumTest | Level0)
{
Vector2<int16_t> vertexes[4] = { { 0, 0 }, { 500, 100 }, { 300, 500 }, { 100, 300 } };
Polygon* polygon = new Polygon(vertexes, 4);
EXPECT_EQ(polygon->GetVertexNum(), 4);
delete polygon;
}
/**
* @tc.number SUB_GRAPHIC_GEOMETRY2D_POLYGON_SETVERTEXNUM_0400
* @tc.name test polygon of geometry2d set-vertexNum api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(Geometry2dTest, Graphic_Polygon_Test_SetVertexNum_0400, Function | MediumTest | Level0)
{
Polygon* polygon = new Polygon();
polygon->SetVertexNum(8);
EXPECT_EQ(polygon->GetVertexNum(), 8);
delete polygon;
}
/**
* @tc.number SUB_GRAPHIC_GEOMETRY2D_POLYGON_OPERATOR_0500
* @tc.name test polygon of geometry2d operator api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(Geometry2dTest, Graphic_Polygon_Test_operator_0500, Function | MediumTest | Level0)
{
Vector2<int16_t> vertexes[4] = { { 0, 0 }, { 500, 100 }, { 300, 500 }, { 100, 300 } };
Polygon* polygon = new Polygon(vertexes, 4);
EXPECT_EQ(polygon->operator[](1).x_, 500);
EXPECT_EQ(polygon->operator[](2).y_, 500);
delete polygon;
Rect rect(100, 200, 300, 400);
polygon = new Polygon(rect);
EXPECT_EQ(polygon->operator[](0).x_, 100);
EXPECT_EQ(polygon->operator[](0).y_, 200);
EXPECT_EQ(polygon->operator[](1).x_, 300);
EXPECT_EQ(polygon->operator[](1).y_, 200);
EXPECT_EQ(polygon->operator[](2).x_, 300);
EXPECT_EQ(polygon->operator[](2).y_, 400);
EXPECT_EQ(polygon->operator[](3).x_, 100);
EXPECT_EQ(polygon->operator[](3).y_, 400);
EXPECT_EQ(polygon->GetVertexNum(), 4);
delete polygon;
}
/**
* @tc.number SUB_GRAPHIC_GEOMETRY2D_INTERSECT_0600
* @tc.name test geometry2d intersect api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(Geometry2dTest, Graphic_Geometry2d_Test_Intersect_0600, Function | MediumTest | Level0)
{
Vector2<int16_t> pt11 = { 0, 200 };
Vector2<int16_t> pt12 = { 400, 200 };
Line* line1 = new Line(pt11, pt12);
Vector2<int16_t> pt21 = { 200, 0 };
Vector2<int16_t> pt22 = { 200, 400 };
Line* line2 = new Line(pt21, pt22);
Vector2<int16_t> pt31 = { 0, 0 };
Vector2<int16_t> pt32 = { 500, 0 };
Line* line3 = new Line(pt31, pt32);
Vector2<int16_t> out;
EXPECT_EQ(Intersect(*line1, *line2, out), true);
EXPECT_EQ(out.x_, 200);
EXPECT_EQ(out.y_, 200);
EXPECT_EQ(Intersect(*line1, *line3, out), false);
delete line1;
delete line2;
delete line3;
}
/**
* @tc.number SUB_GRAPHIC_GEOMETRY2D_ISINTERSECT_0700
* @tc.name test geometry2d if-intersected api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(Geometry2dTest, Graphic_Geometry2d_Test_IsIntersect_0700, Function | MediumTest | Level0)
{
Vector2<int16_t> pt11 = { 0, 200 };
Vector2<int16_t> pt12 = { 400, 200 };
Line* line1 = new Line(pt11, pt12);
Vector2<int16_t> pt21 = { 200, 0 };
Vector2<int16_t> pt22 = { 200, 400 };
Line* line2 = new Line(pt21, pt22);
Vector2<int16_t> pt31 = { 0, 0 };
Vector2<int16_t> pt32 = { 500, 0 };
Line* line3 = new Line(pt31, pt32);
EXPECT_EQ(IsIntersect(*line1, *line2), true);
EXPECT_EQ(IsIntersect(*line1, *line3), false);
delete line1;
delete line2;
delete line3;
}
/**
* @tc.number SUB_GRAPHIC_GEOMETRY2D_CLIP_0800
* @tc.name test geometry2d clip api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(Geometry2dTest, Graphic_Geometry2d_Test_Clip_0800, Function | MediumTest | Level0)
{
const Vector2<int16_t> vertexes[4] = { { 0, 0 }, { 500, 100 }, { 300, 500 }, { 100, 300 } };
Polygon* polygon = new Polygon(vertexes, 4);
const Vector2<int16_t> pt11 = { 100, 300 };
const Vector2<int16_t> pt12 = { 500, 100 };
Line* line = new Line(pt11, pt12);
Clip(*polygon, *line);
EXPECT_EQ(polygon->GetVertexNum(), 3);
EXPECT_EQ(polygon->operator[](0).x_, 500);
EXPECT_EQ(polygon->operator[](0).y_, 100);
EXPECT_EQ(polygon->operator[](1).x_, 100);
EXPECT_EQ(polygon->operator[](1).y_, 300);
EXPECT_EQ(polygon->operator[](2).x_, 0);
EXPECT_EQ(polygon->operator[](2).y_, 0);
delete polygon;
delete line;
polygon = new Polygon(vertexes, 4);
Rect rect(1, 4, 3, 1);
Polygon polygon1 = SuthHodgClip(rect, *polygon);
EXPECT_EQ(polygon1[0].x_, 1);
EXPECT_EQ(polygon1[0].y_, 1);
EXPECT_EQ(polygon1[1].x_, 3);
EXPECT_EQ(polygon1[1].y_, 1);
EXPECT_EQ(polygon1[2].x_, 3);
EXPECT_EQ(polygon1[2].y_, 4);
EXPECT_EQ(polygon1[3].x_, 1);
EXPECT_EQ(polygon1[3].y_, 4);
delete polygon;
}
} // namespace OHOS
\ No newline at end of file
# Copyright (c) 2021 Huawei Device 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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsGraphicMathTest") {
suite_name = "acts"
sources = [ "src/graphic_math_test.cpp" ]
include_dirs = [
"//kernel/liteos_a/kernel/include/",
"//kernel/liteos_a/kernel/common",
"//third_party/bounds_checking_function/include",
"//third_party/cJSON",
"//third_party/libpng",
"//third_party/libjpeg",
"//utils/native/lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/communication/broadcast",
]
ldflags = [ "-Wl,-Map=toggleButtonTest.map" ]
deps = [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/communication/ipc_lite:liteipc_adapter",
"//foundation/distributedschedule/samgr_lite/communication/broadcast",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//foundation/distributedschedule/samgr_lite/samgr_client:client",
"//foundation/graphic/surface:lite_surface",
"//foundation/graphic/ui:lite_ui",
"//foundation/graphic/utils:lite_graphic_hals",
"//foundation/graphic/wms:lite_wms",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-fno-rtti" ]
}
{
"description": "Config for uikit uibutton test cases",
"environment": [
{
"type": "device",
"label": "ipcamera"
}
],
"kits": [
{
"type": "MountKit",
"server": "NfsServer",
"mount": [
{
"source": "testcases/graphic",
"target": "/test_root/graphic"
}
]
}
],
"driver": {
"type": "CppTestLite",
"execute": "/test_root/graphic/ActsGraphicMathTest.bin"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 "gfx_utils/graphic_math.h"
#include <climits>
#include <gtest/gtest.h>
using namespace std;
using namespace testing::ext;
namespace OHOS {
class MathTest : public testing::Test {
public:
static void SetUpTestCase(void);
static void TearDownTestCase(void);
};
void MathTest::SetUpTestCase()
{
return;
}
void MathTest::TearDownTestCase()
{
return;
}
/**
* @tc.number SUB_GRAPHIC_MATH_SIN_0100
* @tc.name test math sin api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Math_Test_Sin_0100, Function | MediumTest | Level0)
{
EXPECT_EQ(Sin(0), 0);
EXPECT_EQ(Sin(90), 1);
EXPECT_EQ(Sin(180), 0);
}
/**
* @tc.number SUB_GRAPHIC_MATH_FASTATAN2_0200
* @tc.name test math fast-atan2 api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Math_Test_FastAtan2_0200, Function | MediumTest | Level0)
{
EXPECT_EQ(FastAtan2(0, 1), 0);
EXPECT_EQ(FastAtan2(1, 0), 90);
EXPECT_EQ(FastAtan2(0, -1), 180);
EXPECT_EQ(FastAtan2(-1, 0), 270);
}
/**
* @tc.number SUB_GRAPHIC_MATH_FLOATTOINT64_0300
* @tc.name test math float-to-int64 api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Math_Test_FloatToInt64_0300, Function | MediumTest | Level0)
{
EXPECT_EQ(FloatToInt64(1), 256);
}
/**
* @tc.number SUB_GRAPHIC_MATH_SQRT_0400
* @tc.name test math sqrt api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Math_Test_Sqrt_0400, Function | MediumTest | Level0)
{
const float testInteger = 2.0;
const float testIntegerSquared = testInteger * testInteger;
const float testFloat = 2.121320; // 2.121320: 4.5 squaring results
const float testFloatSquared = 4.5;
const float accuracy = 0.000001;
EXPECT_EQ(Sqrt(0), 0);
float ret = Sqrt(testIntegerSquared);
if (ret > testInteger - accuracy && ret < testInteger + accuracy) {
EXPECT_EQ(0, 0);
} else {
EXPECT_NE(0, 0);
}
ret = Sqrt(testFloatSquared);
if (ret > testFloat - accuracy && ret < testFloat + accuracy) {
EXPECT_EQ(0, 0);
} else {
EXPECT_NE(0, 0);
}
}
/**
* @tc.number SUB_GRAPHIC_MATH_VECTOR2_DOT_0500
* @tc.name test math vector2-dot api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Vector2_Test_Dot_0500, Function | MediumTest | Level0)
{
Vector2<uint16_t>* vector1 = new Vector2<uint16_t>(5, 4);
Vector2<uint16_t>* vector2 = new Vector2<uint16_t>(3, 2);
EXPECT_EQ(vector1->Dot(*vector2), 23);
delete vector1;
delete vector2;
}
/**
* @tc.number SUB_GRAPHIC_MATH_VECTOR2_CROSS_0600
* @tc.name test math vector2-cross api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Vector2_Test_Cross_0600, Function | MediumTest | Level0)
{
Vector2<uint16_t>* vector1 = new Vector2<uint16_t>(5, 4);
Vector2<uint16_t>* vector2 = new Vector2<uint16_t>(3, 5);
EXPECT_EQ(vector1->Cross(*vector2), 13);
delete vector1;
delete vector2;
}
/**
* @tc.number SUB_GRAPHIC_MATH_VECTOR2_OPERATOR_0700
* @tc.name test math vector2-operator-minus api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Vector2_Test_operator_Minus_0700, Function | MediumTest | Level0)
{
Vector2<uint16_t>* vector1 = new Vector2<uint16_t>(5, 4);
Vector2<uint16_t> vector2 = vector1->operator-();
EXPECT_EQ(vector2.x_, 65531);
EXPECT_EQ(vector2.y_, 65532);
delete vector1;
Vector2<uint16_t>* vector3 = new Vector2<uint16_t>(5, 7);
Vector2<uint16_t>* vector4 = new Vector2<uint16_t>(3, 5);
Vector2<uint16_t> vector5 = vector3->operator-(*vector4);
EXPECT_EQ(vector5.x_, 2);
EXPECT_EQ(vector5.y_, 2);
delete vector3;
delete vector4;
}
/**
* @tc.number SUB_GRAPHIC_MATH_VECTOR2_OPERATOR_0800
* @tc.name test math vector2-operator-plus api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Vector2_Test_operator_Plus_0800, Function | MediumTest | Level0)
{
Vector2<uint16_t>* vector1 = new Vector2<uint16_t>(5, 7);
Vector2<uint16_t>* vector2 = new Vector2<uint16_t>(3, 5);
Vector2<uint16_t> vector3 = vector1->operator+(*vector2);
EXPECT_EQ(vector3.x_, 8);
EXPECT_EQ(vector3.y_, 12);
delete vector1;
delete vector2;
}
/**
* @tc.number SUB_GRAPHIC_MATH_VECTOR2_OPERATOR_0900
* @tc.name test math vector2-operator-star api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Vector2_Test_operator_Star_0900, Function | MediumTest | Level0)
{
Vector2<uint16_t>* vector1 = new Vector2<uint16_t>(5, 7);
Vector2<uint16_t> vector2 = vector1->operator*(2);
EXPECT_EQ(vector2.x_, 10);
EXPECT_EQ(vector2.y_, 14);
delete vector1;
}
/**
* @tc.number SUB_GRAPHIC_MATH_VECTOR2_OPERATOR_1000
* @tc.name test math vector2-operator-duo-equal api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Vector2_Test_operator_DuoEqual_1000, Function | MediumTest | Level0)
{
Vector2<uint16_t>* vector1 = new Vector2<uint16_t>(5, 7);
Vector2<uint16_t>* vector2 = new Vector2<uint16_t>(5, 7);
Vector2<uint16_t>* vector3 = new Vector2<uint16_t>(5, 8);
EXPECT_EQ(vector1->operator==(*vector2), true);
EXPECT_EQ(vector1->operator==(*vector3), false);
delete vector1;
delete vector2;
delete vector3;
}
/**
* @tc.number SUB_GRAPHIC_MATH_VECTOR2_OPERATOR_1100
* @tc.name test math vector2-operator-equal api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Vector2_Test_operator_Equal_1100, Function | MediumTest | Level0)
{
Vector2<uint16_t>* vector1 = new Vector2<uint16_t>(5, 7);
Vector2<uint16_t>* vector2 = new Vector2<uint16_t>(1, 2);
vector1->operator=(*vector2);
EXPECT_EQ(vector1->x_, 1);
EXPECT_EQ(vector1->y_, 2);
delete vector1;
delete vector2;
}
/**
* @tc.number SUB_GRAPHIC_MATH_VECTOR2_OPERATOR_1200
* @tc.name test math vector2-operator-plus-equal api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Vector2_Test_operator_PlusEqual_1200, Function | MediumTest | Level0)
{
Vector2<uint16_t>* vector1 = new Vector2<uint16_t>(5, 7);
Vector2<uint16_t>* vector2 = new Vector2<uint16_t>(1, 2);
vector1->operator+=(*vector2);
EXPECT_EQ(vector1->x_, 6);
EXPECT_EQ(vector1->y_, 9);
delete vector1;
delete vector2;
}
/**
* @tc.number SUB_GRAPHIC_MATH_VECTOR2_OPERATOR_1300
* @tc.name test math vector2-operator-minus-equal api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Vector2_Test_operator_MinusEqual_1300, Function | MediumTest | Level0)
{
Vector2<uint16_t>* vector1 = new Vector2<uint16_t>(5, 7);
Vector2<uint16_t>* vector2 = new Vector2<uint16_t>(1, 2);
vector1->operator-=(*vector2);
EXPECT_EQ(vector1->x_, 4);
EXPECT_EQ(vector1->y_, 5);
delete vector1;
delete vector2;
}
/**
* @tc.number SUB_GRAPHIC_MATH_VECTOR3_OPERATOR_1400
* @tc.name test math vector3-operator-brackets api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Vector3_Test_operator_Brackets_1400, Function | MediumTest | Level0)
{
Vector3<uint16_t>* vector1 = new Vector3<uint16_t>(3, 5, 7);
EXPECT_EQ(vector1->operator[](0), 3);
EXPECT_EQ(vector1->operator[](1), 5);
EXPECT_EQ(vector1->operator[](2), 7);
delete vector1;
}
/**
* @tc.number SUB_GRAPHIC_MATH_VECTOR3_OPERATOR_1500
* @tc.name test math vector3-operator-duo-equal api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Vector3_Test_operator_DuoEqual_1500, Function | MediumTest | Level0)
{
Vector3<uint16_t>* vector1 = new Vector3<uint16_t>(3, 5, 7);
Vector3<uint16_t>* vector2 = new Vector3<uint16_t>(3, 5, 7);
Vector3<uint16_t>* vector3 = new Vector3<uint16_t>(3, 5, 9);
EXPECT_EQ(vector1->operator==(*vector2), true);
EXPECT_EQ(vector1->operator==(*vector3), false);
delete vector1;
delete vector2;
delete vector3;
}
/**
* @tc.number SUB_GRAPHIC_MATH_MATRIX3_GETDATA_1600
* @tc.name test math matrix3-getdata api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Matrix3_Test_GetData_1600, Function | MediumTest | Level0)
{
Matrix3<uint16_t>* matrix = new Matrix3<uint16_t>(1, 1, 1, 1, 1, 1, 1, 1, 1);
EXPECT_EQ(matrix->GetData()[0], 1);
EXPECT_EQ(matrix->GetData()[5], 1);
delete matrix;
}
/**
* @tc.number SUB_GRAPHIC_MATH_MATRIX3_OPERATOR_1700
* @tc.name test math matrix3-operator-star api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Matrix3_Test_operator_Star_1700, Function | MediumTest | Level0)
{
Matrix3<uint16_t> matrix1(1, 1, 1, 1, 1, 1, 1, 1, 1);
Matrix3<uint16_t> matrix2(1, 2, 3, 4, 5, 6, 7, 8, 9);
Matrix3<uint16_t> matrix3 = matrix1 * matrix2;
EXPECT_EQ(matrix3.GetData()[0], 6);
EXPECT_EQ(matrix3.GetData()[1], 6);
EXPECT_EQ(matrix3.GetData()[2], 6);
EXPECT_EQ(matrix3.GetData()[3], 15);
EXPECT_EQ(matrix3.GetData()[4], 15);
EXPECT_EQ(matrix3.GetData()[5], 15);
EXPECT_EQ(matrix3.GetData()[6], 24);
EXPECT_EQ(matrix3.GetData()[7], 24);
EXPECT_EQ(matrix3.GetData()[8], 24);
Vector3<uint16_t> vector1(1, 2, 3);
Vector3<uint16_t> vector2 = matrix1 * vector1;
EXPECT_EQ(vector2.x_, 6);
EXPECT_EQ(vector2.y_, 6);
EXPECT_EQ(vector2.z_, 6);
}
/**
* @tc.number SUB_GRAPHIC_MATH_MATRIX3_OPERATOR_1800
* @tc.name test math matrix3-operator-brackets api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Matrix3_Test_operator_Brackets_1800, Function | MediumTest | Level0)
{
Matrix3<uint16_t>* matrix = new Matrix3<uint16_t>(1, 2, 3, 4, 5, 6, 7, 8, 9);
EXPECT_EQ(*matrix->operator[](0), 1);
EXPECT_EQ(*matrix->operator[](1), 4);
EXPECT_EQ(*matrix->operator[](2), 7);
delete matrix;
}
/**
* @tc.number SUB_GRAPHIC_MATH_MATRIX3_OPERATOR_1900
* @tc.name test math matrix3-operator-equal api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Matrix3_Test_operator_Equal_1900, Function | MediumTest | Level0)
{
Matrix3<uint16_t>* matrix1 = new Matrix3<uint16_t>(1, 2, 3, 4, 5, 6, 7, 8, 9);
Matrix3<uint16_t>* matrix2 = new Matrix3<uint16_t>(1, 1, 1, 1, 1, 1, 1, 1, 1);
matrix1->operator=(*matrix2);
EXPECT_EQ(matrix1->GetData()[0], 1);
EXPECT_EQ(matrix1->GetData()[1], 1);
EXPECT_EQ(matrix1->GetData()[2], 1);
EXPECT_EQ(matrix1->GetData()[3], 1);
EXPECT_EQ(matrix1->GetData()[4], 1);
EXPECT_EQ(matrix1->GetData()[5], 1);
EXPECT_EQ(matrix1->GetData()[6], 1);
EXPECT_EQ(matrix1->GetData()[7], 1);
EXPECT_EQ(matrix1->GetData()[8], 1);
delete matrix1;
delete matrix2;
}
/**
* @tc.number SUB_GRAPHIC_MATH_MATRIX3_DETERMINANT_2000
* @tc.name test math matrix3-determinant api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Matrix3_Test_Determinant_2000, Function | MediumTest | Level0)
{
Matrix3<uint16_t>* matrix1 = new Matrix3<uint16_t>(1, 2, 2, 2, 1, 2, 2, 2, 1);
EXPECT_EQ(matrix1->Determinant(), 5);
delete matrix1;
}
/**
* @tc.number SUB_GRAPHIC_MATH_MATRIX3_INVERSE_2100
* @tc.name test math matrix3-inverse api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Matrix3_Test_Inverse_2100, Function | MediumTest | Level0)
{
Matrix3<uint16_t>* matrix1 = new Matrix3<uint16_t>(1, 1, 1, 1, 1, 1, 1, 1, 1);
Matrix3<uint16_t> matrix2 = matrix1->Inverse();
EXPECT_EQ(matrix2.GetData()[0], 1);
EXPECT_EQ(matrix2.GetData()[1], 1);
EXPECT_EQ(matrix2.GetData()[2], 1);
EXPECT_EQ(matrix2.GetData()[3], 1);
EXPECT_EQ(matrix2.GetData()[4], 1);
EXPECT_EQ(matrix2.GetData()[5], 1);
EXPECT_EQ(matrix2.GetData()[6], 1);
EXPECT_EQ(matrix2.GetData()[7], 1);
EXPECT_EQ(matrix2.GetData()[8], 1);
delete matrix1;
}
/**
* @tc.number SUB_GRAPHIC_MATH_MATRIX3_OPERATOR_2200
* @tc.name test math matrix3-operator-duo-equal api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Matrix3_Test_operator_DuoEqual_2200, Function | MediumTest | Level0)
{
Matrix3<uint16_t>* matrix1 = new Matrix3<uint16_t>(1, 1, 1, 1, 1, 1, 1, 1, 1);
Matrix3<uint16_t>* matrix2 = new Matrix3<uint16_t>(1, 1, 1, 1, 1, 1, 1, 1, 1);
Matrix3<uint16_t>* matrix3 = new Matrix3<uint16_t>(1, 1, 1, 1, 1, 1, 8, 1, 1);
EXPECT_EQ(matrix1->operator==(*matrix2), true);
EXPECT_EQ(matrix1->operator==(*matrix3), false);
delete matrix1;
delete matrix2;
delete matrix3;
}
/**
* @tc.number SUB_GRAPHIC_MATH_MATRIX3_ROTATE_2300
* @tc.name test math matrix3-rotate api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Matrix3_Test_Rotate_2300, Function | MediumTest | Level0)
{
Matrix3<uint64_t> rotate = Matrix3<uint64_t>::Rotate(0, Vector2<uint64_t>(0, 0));
EXPECT_EQ(rotate.GetData()[0], 1);
EXPECT_EQ(rotate.GetData()[1], 0);
EXPECT_EQ(rotate.GetData()[3], 0);
EXPECT_EQ(rotate.GetData()[4], 1);
}
/**
* @tc.number SUB_GRAPHIC_MATH_MATRIX3_SCALE_2400
* @tc.name test math matrix3-scale api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Matrix3_Test_Scale_2400, Function | MediumTest | Level0)
{
Matrix3<int64_t> scale = Matrix3<int64_t>::Scale(Vector2<int64_t>(256, 256), Vector2<int64_t>(0, 0));
EXPECT_EQ(scale.GetData()[0], 256);
EXPECT_EQ(scale.GetData()[4], 256);
EXPECT_EQ(scale.GetData()[6], 0);
EXPECT_EQ(scale.GetData()[7], 0);
EXPECT_EQ(scale.GetData()[8], 1);
}
/**
* @tc.number SUB_GRAPHIC_MATH_MATRIX3_TRANSLATE_2500
* @tc.name test math matrix3-translate api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MathTest, Graphic_Matrix3_Test_Translate_2500, Function | MediumTest | Level0)
{
Matrix3<int64_t> translate = Matrix3<int64_t>::Translate(Vector2<int64_t>(0, 0));
EXPECT_EQ(translate.GetData()[0], 1);
EXPECT_EQ(translate.GetData()[1], 0);
EXPECT_EQ(translate.GetData()[2], 0);
EXPECT_EQ(translate.GetData()[3], 0);
EXPECT_EQ(translate.GetData()[4], 1);
EXPECT_EQ(translate.GetData()[5], 0);
EXPECT_EQ(translate.GetData()[6], 0);
EXPECT_EQ(translate.GetData()[7], 0);
EXPECT_EQ(translate.GetData()[8], 1);
}
} // namespace OHOS
\ No newline at end of file
# Copyright (c) 2021 Huawei Device 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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsGridLayoutTest") {
suite_name = "acts"
sources = [ "src/test_grid_layout.cpp" ]
include_dirs = [
"//kernel/liteos_a/kernel/include/",
"//kernel/liteos_a/kernel/common",
"//third_party/bounds_checking_function/include",
"//third_party/cJSON",
"//third_party/libpng",
"//third_party/libjpeg",
"//utils/native/lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/communication/broadcast",
]
ldflags = [ "-Wl,-Map=toggleButtonTest.map" ]
deps = [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/communication/ipc_lite:liteipc_adapter",
"//foundation/distributedschedule/samgr_lite/communication/broadcast",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//foundation/distributedschedule/samgr_lite/samgr_client:client",
"//foundation/graphic/surface:lite_surface",
"//foundation/graphic/ui:lite_ui",
"//foundation/graphic/utils:lite_graphic_hals",
"//foundation/graphic/wms:lite_wms",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-fno-rtti" ]
}
{
"description": "Config for uikit uibutton test cases",
"environment": [
{
"type": "device",
"label": "ipcamera"
}
],
"kits": [
{
"type": "MountKit",
"server": "NfsServer",
"mount": [
{
"source": "testcases/graphic",
"target": "/test_root/graphic"
}
]
}
],
"driver": {
"type": "CppTestLite",
"execute": "/test_root/graphic/ActsGridLayoutTest.bin"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 "layout/grid_layout.h"
#include <climits>
#include <gtest/gtest.h>
#include "common/screen.h"
using namespace testing::ext;
namespace OHOS {
class GridLayoutTest : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
};
/**
* @tc.number SUB_GRAPHIC_GRIDLAYOUT_LAYOUTCHILDREN_0100
* @tc.name test grid-layout layout-children api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(GridLayoutTest, Graphic_GridLayout_Test_LayoutChildren_0100, Function | MediumTest | Level0)
{
GridLayout* layout = new GridLayout();
layout->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
layout->SetLayoutDirection(LAYOUT_HOR);
layout->SetRows(5); // 5: row
layout->SetCols(4); // 4: col
layout->LayoutChildren();
EXPECT_EQ(0, 0);
delete layout;
}
} // namespace OHOS
\ No newline at end of file
# Copyright (c) 2021 Huawei Device 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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsHeapBaseTest") {
suite_name = "acts"
sources = [ "src/heap_base_test.cpp" ]
include_dirs = [
"//kernel/liteos_a/kernel/include/",
"//kernel/liteos_a/kernel/common",
"//third_party/bounds_checking_function/include",
"//third_party/cJSON",
"//third_party/libpng",
"//third_party/libjpeg",
"//utils/native/lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/communication/broadcast",
]
ldflags = [ "-Wl,-Map=toggleButtonTest.map" ]
deps = [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/communication/ipc_lite:liteipc_adapter",
"//foundation/distributedschedule/samgr_lite/communication/broadcast",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//foundation/distributedschedule/samgr_lite/samgr_client:client",
"//foundation/graphic/surface:lite_surface",
"//foundation/graphic/ui:lite_ui",
"//foundation/graphic/utils:lite_graphic_hals",
"//foundation/graphic/wms:lite_wms",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-fno-rtti" ]
}
{
"description": "Config for uikit uibutton test cases",
"environment": [
{
"type": "device",
"label": "ipcamera"
}
],
"kits": [
{
"type": "MountKit",
"server": "NfsServer",
"mount": [
{
"source": "testcases/graphic",
"target": "/test_root/graphic"
}
]
}
],
"driver": {
"type": "CppTestLite",
"execute": "/test_root/graphic/ActsHeapBaseTest.bin"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 "gfx_utils/heap_base.h"
#include <climits>
#include <gtest/gtest.h>
using namespace std;
using namespace testing::ext;
namespace OHOS {
class HeapBaseTest : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
};
/**
* @tc.number SUB_GRAPHIC_HEAPBASE_OPERATOR_NEW_0100
* @tc.name test heapbase operator-new api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(HeapBaseTest, Graphic_UIHeapBase_Test_operator_new_0100, Function | MediumTest | Level0)
{
HeapBase* heap = new HeapBase();
EXPECT_EQ(0, 0);
delete heap;
EXPECT_EQ(0, 0);
}
} // namespace OHOS
\ No newline at end of file
# Copyright (c) 2021 Huawei Device 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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsImageTest") {
suite_name = "acts"
sources = [ "src/image_test.cpp" ]
include_dirs = [
"//kernel/liteos_a/kernel/include/",
"//kernel/liteos_a/kernel/common",
"//third_party/bounds_checking_function/include",
"//third_party/cJSON",
"//third_party/libpng",
"//third_party/libjpeg",
"//utils/native/lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/communication/broadcast",
]
ldflags = [ "-Wl,-Map=toggleButtonTest.map" ]
deps = [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/communication/ipc_lite:liteipc_adapter",
"//foundation/distributedschedule/samgr_lite/communication/broadcast",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//foundation/distributedschedule/samgr_lite/samgr_client:client",
"//foundation/graphic/surface:lite_surface",
"//foundation/graphic/ui:lite_ui",
"//foundation/graphic/utils:lite_graphic_hals",
"//foundation/graphic/wms:lite_wms",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-fno-rtti" ]
}
{
"description": "Config for uikit uibutton test cases",
"environment": [
{
"type": "device",
"label": "ipcamera"
}
],
"kits": [
{
"type": "MountKit",
"server": "NfsServer",
"mount": [
{
"source": "testcases/graphic",
"target": "/test_root/graphic"
}
]
}
],
"driver": {
"type": "CppTestLite",
"execute": "/test_root/graphic/ActsImageTest.bin"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 "common/image.h"
#include <climits>
#include <gtest/gtest.h>
using namespace std;
using namespace testing::ext;
namespace OHOS {
class ImageTest : public testing::Test {
public:
static void SetUpTestCase(void)
{
if (imageObject == nullptr) {
imageObject = new Image();
}
}
static void TearDownTestCase(void)
{
if (imageObject != nullptr) {
delete imageObject;
imageObject = nullptr;
}
}
static Image* imageObject;
};
Image* ImageTest::imageObject = nullptr;
/**
* @tc.number SUB_GRAPHIC_IMAGE_GETHEADER_0100
* @tc.name test image get-header api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ImageTest, Graphic_UIImage_Test_GetHeader_0100, Function | MediumTest | Level0)
{
int colorMode = 1;
ImageHeader header = {0};
header.colorMode = colorMode;
header.reserved = 2;
header.width = 3;
header.height = 4;
imageObject->GetHeader(header);
EXPECT_EQ(header.colorMode, colorMode);
}
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device 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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsInterpoliationTest") {
suite_name = "acts"
sources = [ "src/interpolation_test.cpp" ]
include_dirs = [
"//kernel/liteos_a/kernel/include/",
"//kernel/liteos_a/kernel/common",
"//third_party/bounds_checking_function/include",
"//third_party/cJSON",
"//third_party/libpng",
"//third_party/libjpeg",
"//utils/native/lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/communication/broadcast",
]
ldflags = [ "-Wl,-Map=toggleButtonTest.map" ]
deps = [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/communication/ipc_lite:liteipc_adapter",
"//foundation/distributedschedule/samgr_lite/communication/broadcast",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//foundation/distributedschedule/samgr_lite/samgr_client:client",
"//foundation/graphic/surface:lite_surface",
"//foundation/graphic/ui:lite_ui",
"//foundation/graphic/utils:lite_graphic_hals",
"//foundation/graphic/wms:lite_wms",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-fno-rtti" ]
}
{
"description": "Config for uikit uibutton test cases",
"environment": [
{
"type": "device",
"label": "ipcamera"
}
],
"kits": [
{
"type": "MountKit",
"server": "NfsServer",
"mount": [
{
"source": "testcases/graphic",
"target": "/test_root/graphic"
}
]
}
],
"driver": {
"type": "CppTestLite",
"execute": "/test_root/graphic/ActsInterpoliationTest.bin"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 "animator/interpolation.h"
#include <climits>
#include <gtest/gtest.h>
using namespace std;
using namespace testing::ext;
namespace OHOS {
class InterpolationTest : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
};
/**
* @tc.number SUB_GRAPHIC_INTERPOLATION_GETBEZIERINTERPOLATION_0100
* @tc.name test interpolation get-bezier-interpolation api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(InterpolationTest, Graphic_UIInterpolationTest_Test_GetBezierInterpolation_0100,
Function | MediumTest | Level0)
{
Interpolation *interpolation = new Interpolation();
int16_t t = 0;
int16_t u0 = 1;
int16_t u1 = 1;
int16_t u2 = 1;
int16_t u3 = 1;
int16_t temp = 1;
EXPECT_EQ(interpolation->GetBezierInterpolation(t, u0, u1, u2, u3), temp);
delete interpolation;
}
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device 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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsLayoutTest") {
suite_name = "acts"
sources = [ "src/test_layout.cpp" ]
include_dirs = [
"//kernel/liteos_a/kernel/include/",
"//kernel/liteos_a/kernel/common",
"//third_party/bounds_checking_function/include",
"//third_party/cJSON",
"//third_party/libpng",
"//third_party/libjpeg",
"//utils/native/lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/communication/broadcast",
]
ldflags = [ "-Wl,-Map=toggleButtonTest.map" ]
deps = [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/communication/ipc_lite:liteipc_adapter",
"//foundation/distributedschedule/samgr_lite/communication/broadcast",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//foundation/distributedschedule/samgr_lite/samgr_client:client",
"//foundation/graphic/surface:lite_surface",
"//foundation/graphic/ui:lite_ui",
"//foundation/graphic/utils:lite_graphic_hals",
"//foundation/graphic/wms:lite_wms",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-fno-rtti" ]
}
{
"description": "Config for uikit uibutton test cases",
"environment": [
{
"type": "device",
"label": "ipcamera"
}
],
"kits": [
{
"type": "MountKit",
"server": "NfsServer",
"mount": [
{
"source": "testcases/graphic",
"target": "/test_root/graphic"
}
]
}
],
"driver": {
"type": "CppTestLite",
"execute": "/test_root/graphic/ActsLayoutTest.bin"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 "layout/layout.h"
#include <climits>
#include <gtest/gtest.h>
using namespace std;
using namespace testing::ext;
namespace OHOS {
class LayoutTest : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
virtual void SetUp() {}
virtual void TearDown() {}
};
class LayoutIn : public Layout {
public:
uint8_t GetLayoutDirection(void) const
{
return direction_;
}
};
/**
* @tc.number SUB_GRAPHIC_LAYOUT_SetLayoutDirection_0100
* @tc.name test ui_view SetLayoutDirection api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(LayoutTest, SUB_GRAPHIC_FLEXLAOUT_SetLayoutDirection_0100, Function | MediumTest | Level0)
{
LayoutIn* layout = new LayoutIn();
uint8_t direction = 1;
layout->SetLayoutDirection(direction);
EXPECT_EQ(layout->GetLayoutDirection(), direction);
delete layout;
}
} // namespace OHOS
\ No newline at end of file
# Copyright (c) 2021 Huawei Device 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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsListTest") {
suite_name = "acts"
sources = [ "src/list_test.cpp" ]
include_dirs = [
"//kernel/liteos_a/kernel/include/",
"//kernel/liteos_a/kernel/common",
"//third_party/bounds_checking_function/include",
"//third_party/cJSON",
"//third_party/libpng",
"//third_party/libjpeg",
"//utils/native/lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/communication/broadcast",
]
ldflags = [ "-Wl,-Map=toggleButtonTest.map" ]
deps = [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/communication/ipc_lite:liteipc_adapter",
"//foundation/distributedschedule/samgr_lite/communication/broadcast",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//foundation/distributedschedule/samgr_lite/samgr_client:client",
"//foundation/graphic/surface:lite_surface",
"//foundation/graphic/ui:lite_ui",
"//foundation/graphic/utils:lite_graphic_hals",
"//foundation/graphic/wms:lite_wms",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-fno-rtti" ]
}
{
"description": "Config for uikit uibutton test cases",
"environment": [
{
"type": "device",
"label": "ipcamera"
}
],
"kits": [
{
"type": "MountKit",
"server": "NfsServer",
"mount": [
{
"source": "testcases/graphic",
"target": "/test_root/graphic"
}
]
}
],
"driver": {
"type": "CppTestLite",
"execute": "/test_root/graphic/ActsListTest.bin"
}
}
\ No newline at end of file
此差异已折叠。
# Copyright (c) 2021 Huawei Device 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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsListlayoutTest") {
suite_name = "acts"
sources = [ "src/list_layout_test.cpp" ]
include_dirs = [
"//kernel/liteos_a/kernel/include/",
"//kernel/liteos_a/kernel/common",
"//third_party/bounds_checking_function/include",
"//third_party/cJSON",
"//third_party/libpng",
"//third_party/libjpeg",
"//utils/native/lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/communication/broadcast",
]
ldflags = [ "-Wl,-Map=toggleButtonTest.map" ]
deps = [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/communication/ipc_lite:liteipc_adapter",
"//foundation/distributedschedule/samgr_lite/communication/broadcast",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//foundation/distributedschedule/samgr_lite/samgr_client:client",
"//foundation/graphic/surface:lite_surface",
"//foundation/graphic/ui:lite_ui",
"//foundation/graphic/utils:lite_graphic_hals",
"//foundation/graphic/wms:lite_wms",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-fno-rtti" ]
}
{
"description": "Config for uikit uibutton test cases",
"environment": [
{
"type": "device",
"label": "ipcamera"
}
],
"kits": [
{
"type": "MountKit",
"server": "NfsServer",
"mount": [
{
"source": "testcases/graphic",
"target": "/test_root/graphic"
}
]
}
],
"driver": {
"type": "CppTestLite",
"execute": "/test_root/graphic/ActsListlayoutTest.bin"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device 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 <climits>
#include <gtest/gtest.h>
#include "layout/list_layout.h"
using namespace std;
using namespace testing::ext;
namespace OHOS {
class ListLayoutTest : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
};
/**
* @tc.number SUB_GRAPHIC_LISTLAYOUT_SETDIRECTION_0100
* @tc.name test list-layout set-direction api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ListLayoutTest, Graphic_ListLayout_Test_SetDirection_0100, Function | MediumTest | Level0)
{
ListLayout *listLayout = new ListLayout();
uint8_t direction = 10;
listLayout->SetDirection(direction);
EXPECT_EQ(listLayout->GetDirection(), direction);
delete listLayout;
}
} // namespace OHOS
\ No newline at end of file
# Copyright (c) 2021 Huawei Device 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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsGraphMemApiTest") {
suite_name = "acts"
sources = [ "src/mem_api_test.cpp" ]
include_dirs = [
"//kernel/liteos_a/kernel/include/",
"//kernel/liteos_a/kernel/common",
"//third_party/bounds_checking_function/include",
"//third_party/cJSON",
"//third_party/libpng",
"//third_party/libjpeg",
"//utils/native/lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/communication/broadcast",
]
ldflags = [ "-Wl,-Map=toggleButtonTest.map" ]
deps = [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/communication/ipc_lite:liteipc_adapter",
"//foundation/distributedschedule/samgr_lite/communication/broadcast",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//foundation/distributedschedule/samgr_lite/samgr_client:client",
"//foundation/graphic/surface:lite_surface",
"//foundation/graphic/ui:lite_ui",
"//foundation/graphic/utils:lite_graphic_hals",
"//foundation/graphic/wms:lite_wms",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-fno-rtti" ]
}
{
"description": "Config for uikit uibutton test cases",
"environment": [
{
"type": "device",
"label": "ipcamera"
}
],
"kits": [
{
"type": "MountKit",
"server": "NfsServer",
"mount": [
{
"source": "testcases/graphic",
"target": "/test_root/graphic"
}
]
}
],
"driver": {
"type": "CppTestLite",
"execute": "/test_root/graphic/ActsGraphMemApiTest.bin"
}
}
\ No newline at end of file
此差异已折叠。
{
"description": "Config for uikit uibutton test cases",
"environment": [
{
"type": "device",
"label": "ipcamera"
}
],
"kits": [
{
"type": "MountKit",
"server": "NfsServer",
"mount": [
{
"source": "testcases/graphic",
"target": "/test_root/graphic"
}
]
}
],
"driver": {
"type": "CppTestLite",
"execute": "/test_root/graphic/ActsRectTest.bin"
}
}
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册