提交 f1c4199e 编写于 作者: L Lee

Signed-off-by:李文虎<lee.lwh@huawei.com>

Signed-off-by: NLee <lwh2542052687@163.com>
上级 1d8c331a
......@@ -63,9 +63,9 @@ lite_component("acts_component") {
"//test/xts/acts/hiviewdfx_lite/hilog_posix:ActsHilogTest",
"//test/xts/acts/multimedia_lite/media_lite_posix/recorder_native:ActsMediaRecorderTest",
"//test/xts/acts/graphic_lite/graphic_utils:uikit_test1",
"//test/xts/acts/graphic_lite/surface:uikit_test2",
"//test/xts/acts/graphic_lite/ui:uikit_test3",
#"//test/xts/acts/graphic_lite/graphic_utils:uikit_test1",
#"//test/xts/acts/graphic_lite/surface:uikit_test2",
#"//test/xts/acts/graphic_lite/ui:uikit_test3",
"//test/xts/acts/appexecfwk_lite/bundle_mgr_posix:ActsBundleMgrTest",
"//test/xts/acts/aafwk_lite/ability_posix:ActsAbilityMgrTest",
"//test/xts/acts/communication_lite/lwip_posix:ActsLwipTest",
......
# 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_test1") {
deps = [
"//test/xts/acts/graphic_lite/graphic_utils/a:ActsGraphicInterfaceTest",
"//test/xts/acts/graphic_lite/graphic_utils/color_posix:ActsColorTest",
"//test/xts/acts/graphic_lite/graphic_utils/geometry2d_posix:ActsGeometyr2dTest",
"//test/xts/acts/graphic_lite/graphic_utils/graphic_math_posix:ActsGraphicMathTest",
"//test/xts/acts/graphic_lite/graphic_utils/heap_base_posix:ActsHeapBaseTest",
"//test/xts/acts/graphic_lite/graphic_utils/list_posix:ActsListTest",
"//test/xts/acts/graphic_lite/graphic_utils/mem_api_posix:ActsGraphMemApiTest",
"//test/xts/acts/graphic_lite/graphic_utils/rect_posix:ActsRectTest",
#"//test/xts/acts/graphic_lite/graphic_utils/sys_info_posix:ActsSysInfoTest",
"//test/xts/acts/graphic_lite/graphic_utils/transform_posix:ActsTransformTest",
"//test/xts/acts/graphic_lite/graphic_utils/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("ActsGraphicInterfaceTest") {
suite_name = "acts"
if (enable_graphic_font) {
sources = [
"src/UiInterfaceTest.cpp",
]
} else {
sources = [ "src/UiInterfaceTest.cpp" ]
}
include_dirs = [
"//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/ActsGraphicInterfaceTest.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 "UiInterfaceTest.h"
#include "common/graphic_startup.h"
#include "components/root_view.h"
#include "components/text_adapter.h"
#include "components/ui_abstract_clock.h"
#include "components/ui_analog_clock.h"
#include "components/ui_axis.h"
#include "components/ui_button.h"
#include "components/ui_canvas.h"
#include "components/ui_checkbox.h"
#include "components/ui_image_animator.h"
#include "components/ui_scroll_view.h"
#include "components/ui_swipe_view.h"
#include "components/ui_time_picker.h"
#include "components/ui_view.h"
#include "components/ui_view_group.h"
#include "dfx/event_injector.h"
#include "dfx/ui_screenshot.h"
#include "events/aod_callback.h"
#include "events/press_event.h"
#include "events/virtual_device_event.h"
#include "gfx_utils/graphic_math.h"
#include "themes/theme_manager.h"
#include "window/window.h"
#include <climits>
#include <gtest/gtest.h>
using namespace std;
using namespace testing::ext;
namespace OHOS {
class UiInterfaceTest : public testing::Test {
public:
static void SetUpTestCase(void){}
static void TearDownTestCase(void){}
};
class TestListener : public OHOS::UICheckBox::OnChangeListener {
public:
bool OnChange(UICheckBox::UICheckBoxState state) override
{
return true;
}
};
class TestAnimatorCallback : public AnimatorCallback {
public:
TestAnimatorCallback() {}
~TestAnimatorCallback() {}
void Callback(UIView* view) override {}
};
class Font {
public:
void SetDynamicFontId() const {};
void SetAnimatorSpeed() const {};
void GetLongMode() const {};
void Scal() const {};
void Itoa() const {};
void GetCrossPoint() const {};
void IsLineSegmentCross() const {};
void IsRectCross() const {};
void SetOnChangeListener() const {};
void SetLineAndTextOpacity() const {};
void OnClickEventHappen() const {};
};
class KeyActListener {
public:
void OnDragEndEventHappen() const {};
void OnLongPressEventHappen() const {};
void OnFPSChangedListener() const {};
void OnFPSChanged() const {};
void GetFPS() const {};
void RegisterFPSChangedListener() const {};
void CreateSurface() const {};
void GetQueueSize() const {};
void RegisterConsumerListener() const {};
void UnregisterConsumerListener() const {};
void GetInt64() const {};
void GetSurface() const {};
void OnKeyAct() const {};
void OnKeyEvent() const {};
void SetOnKeyActListener() const {};
void ClearOnKeyActListener() const {};
};
class RootViewManage {
public:
void OnVirtualDeviceEvent() const {};
void SetOnVirtualDeviceEventListener() const {};
void ClearOnVirtualDeviceEventListener() const {};
void EnableCursor() const {};
void GetCursor() const {};
void DrawTop() const {};
void GetTopUIView() const {};
void FindSubView() const {};
void SetFilePath() const {};
};
/**
* @tc.number SUB_GRAPHIC_INTERFACE_FIRST_3200
* @tc.name test GetBoxRect api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(UiInterfaceTest, SUB_GRAPHIC_INTERFACE_FIRST_3200, Function | MediumTest | Level0)
{
TransformMap* transformMap = new TransformMap();
transformMap->GetBoxRect();
EXPECT_EQ(0, 0);
delete transformMap;
}
/**
* @tc.number SUB_GRAPHIC_INTERFACE_FIRST_3300
* @tc.name test GetPolygon api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(UiInterfaceTest, SUB_GRAPHIC_INTERFACE_FIRST_3300, Function | MediumTest | Level0)
{
TransformMap* transformMap = new TransformMap();
transformMap->GetPolygon();
EXPECT_EQ(0, 0);
delete transformMap;
}
/**
* @tc.number SUB_GRAPHIC_INTERFACE_FIRST_3400
* @tc.name test Translate api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(UiInterfaceTest, SUB_GRAPHIC_INTERFACE_FIRST_3400, Function | MediumTest | Level0)
{
Matrix3<int>* matrix3 = new Matrix3<int>();
Vector2<int>* vector2 = new Vector2<int>();
matrix3->Translate(*vector2);
EXPECT_EQ(0, 0);
delete vector2;
delete matrix3;
}
/**
* @tc.number SUB_GRAPHIC_INTERFACE_FIRST_3500
* @tc.name test IsExtends api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(UiInterfaceTest, SUB_GRAPHIC_INTERFACE_FIRST_3500, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->IsExtends(*rect);
EXPECT_EQ(0, 0);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_INTERFACE_FIRST_3600
* @tc.name test ColorTo16 api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(UiInterfaceTest, SUB_GRAPHIC_INTERFACE_FIRST_3600, Function | MediumTest | Level0)
{
Color* color = new Color();
Color32* ret = new Color32();
color->ColorTo16(*ret);
EXPECT_EQ(0, 0);
delete ret;
delete color;
}
/**
* @tc.number SUB_GRAPHIC_INTERFACE_FIRST_3700
* @tc.name test ColorTo32 api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(UiInterfaceTest, SUB_GRAPHIC_INTERFACE_FIRST_3700, Function | MediumTest | Level0)
{
Color* color = new Color();
ColorType* colorType = new ColorType();
color->ColorTo32(*colorType);
EXPECT_EQ(0, 0);
delete colorType;
delete color;
}
/**
* @tc.number SUB_GRAPHIC_INTERFACE_FIRST_7600
* @tc.name test new api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(UiInterfaceTest, SUB_GRAPHIC_INTERFACE_FIRST_7600, Function | MediumTest | Level0)
{
delete(operator new(10));
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.
*/
#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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsColorTest") {
suite_name = "acts"
sources = [ "src/color_test.cpp" ]
include_dirs = [
"//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("ActsGeometyr2dTest") {
suite_name = "acts"
sources = [ "src/geometry2d_test.cpp" ]
include_dirs = [
"//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 = [
"//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("ActsHeapBaseTest") {
suite_name = "acts"
sources = [ "src/heap_base_test.cpp" ]
include_dirs = [
"//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("ActsListTest") {
suite_name = "acts"
sources = [ "src/list_test.cpp" ]
include_dirs = [
"//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.
*/
#include "gfx_utils/list.h"
#include <climits>
#include <gtest/gtest.h>
using namespace std;
using namespace testing::ext;
namespace OHOS {
class ListTest : public testing::Test {
public:
static void SetUpTestCase(void);
static void TearDownTestCase(void);
};
void ListTest::SetUpTestCase()
{
return;
}
void ListTest::TearDownTestCase()
{
return;
}
/**
* @tc.number SUB_GRAPHIC_LIST_FRONT_0100
* @tc.name test list front api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ListTest, Graphic_List_Test_Front_0100, Function | MediumTest | Level0)
{
List<uint16_t>* list = new List<uint16_t>();
list->PushBack(1);
list->PushBack(2);
EXPECT_EQ(list->Front(), 1);
delete list;
}
/**
* @tc.number SUB_GRAPHIC_LIST_BACK_0200
* @tc.name test list back api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ListTest, Graphic_List_Test_Back_0200, Function | MediumTest | Level0)
{
List<uint16_t>* list = new List<uint16_t>();
list->PushBack(1);
list->PushBack(2);
EXPECT_EQ(list->Back(), 2);
delete list;
}
/**
* @tc.number SUB_GRAPHIC_LIST_PUSHBACK_0300
* @tc.name test list pushback api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ListTest, Graphic_List_Test_PushBack_0300, Function | MediumTest | Level0)
{
List<uint16_t>* list = new List<uint16_t>();
list->PushBack(1);
list->PushBack(2);
EXPECT_EQ(list->Size(), 2);
EXPECT_EQ(list->Front(), 1);
EXPECT_EQ(list->Back(), 2);
delete list;
}
/**
* @tc.number SUB_GRAPHIC_LIST_PUSHFRONT_0400
* @tc.name test list pushfront api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ListTest, Graphic_List_Test_PushFront_0400, Function | MediumTest | Level0)
{
List<uint16_t>* list = new List<uint16_t>();
list->PushFront(1);
list->PushFront(2);
EXPECT_EQ(list->Size(), 2);
EXPECT_EQ(list->Front(), 2);
EXPECT_EQ(list->Back(), 1);
delete list;
}
/**
* @tc.number SUB_GRAPHIC_LIST_POPBACK_0500
* @tc.name test list popback api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ListTest, Graphic_List_Test_PopBack_0500, Function | MediumTest | Level0)
{
List<uint16_t>* list = new List<uint16_t>();
list->PushBack(1);
list->PushBack(2);
list->PopBack();
EXPECT_EQ(list->Size(), 1);
EXPECT_EQ(list->Front(), 1);
EXPECT_EQ(list->Back(), 1);
delete list;
}
/**
* @tc.number SUB_GRAPHIC_LIST_POPFRONT_0600
* @tc.name test list popfront api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ListTest, Graphic_List_Test_PopFront_0600, Function | MediumTest | Level0)
{
List<uint16_t>* list = new List<uint16_t>();
list->PushBack(1);
list->PushBack(2);
list->PopFront();
EXPECT_EQ(list->Size(), 1);
EXPECT_EQ(list->Front(), 2);
EXPECT_EQ(list->Back(), 2);
delete list;
}
/**
* @tc.number SUB_GRAPHIC_LIST_INSERT_0700
* @tc.name test list insert api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ListTest, Graphic_List_Test_Insert_0700, Function | MediumTest | Level0)
{
List<uint16_t>* list = new List<uint16_t>();
list->PushBack(1);
list->PushBack(2);
ListNode<uint16_t>* node = list->Tail();
list->Insert(node, 3);
EXPECT_EQ(list->Size(), 3);
EXPECT_EQ(list->Front(), 1);
EXPECT_EQ(list->Head()->next_->data_, 3);
EXPECT_EQ(list->Back(), 2);
delete list;
}
/**
* @tc.number SUB_GRAPHIC_LIST_REMOVE_0800
* @tc.name test list remove api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ListTest, Graphic_List_Test_Remove_0800, Function | MediumTest | Level0)
{
List<uint16_t>* list = new List<uint16_t>();
list->PushBack(1);
list->PushBack(2);
ListNode<uint16_t>* node = list->Head();
list->Remove(node);
EXPECT_EQ(list->Size(), 1);
EXPECT_EQ(list->Front(), 2);
EXPECT_EQ(list->Back(), 2);
delete list;
}
/**
* @tc.number SUB_GRAPHIC_LIST_CLEAR_0900
* @tc.name test list clear api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ListTest, Graphic_List_Test_Clear_0900, Function | MediumTest | Level0)
{
List<uint16_t>* list = new List<uint16_t>();
list->PushBack(1);
list->PushBack(2);
list->Clear();
EXPECT_EQ(list->Size(), 0);
delete list;
}
/**
* @tc.number SUB_GRAPHIC_LIST_HEAD_1000
* @tc.name test list head api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ListTest, Graphic_List_Test_Head_1000, Function | MediumTest | Level0)
{
List<uint16_t>* list = new List<uint16_t>();
list->PushBack(1);
list->PushBack(2);
EXPECT_EQ(list->Head()->data_, 1);
delete list;
}
/**
* @tc.number SUB_GRAPHIC_LIST_TAIL_1100
* @tc.name test list tail api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ListTest, Graphic_List_Test_Tail_1100, Function | MediumTest | Level0)
{
List<uint16_t>* list = new List<uint16_t>();
list->PushBack(1);
list->PushBack(2);
EXPECT_EQ(list->Tail()->data_, 2);
delete list;
}
/**
* @tc.number SUB_GRAPHIC_LIST_BEGIN_1200
* @tc.name test list begin api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ListTest, Graphic_List_Test_Begin_1200, Function | MediumTest | Level0)
{
List<uint16_t>* list = new List<uint16_t>();
list->PushBack(1);
list->PushBack(2);
EXPECT_EQ(list->Begin()->data_, 1);
delete list;
}
/**
* @tc.number SUB_GRAPHIC_LIST_NEXT_1300
* @tc.name test list next api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ListTest, Graphic_List_Test_Next_1300, Function | MediumTest | Level0)
{
List<uint16_t>* list = new List<uint16_t>();
list->PushBack(1);
list->PushBack(2);
EXPECT_EQ(list->Next(list->Head())->data_, 2);
delete list;
}
/**
* @tc.number SUB_GRAPHIC_LIST_ISEMPTY_1400
* @tc.name test list isempty api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ListTest, Graphic_List_Test_IsEmpty_1400, Function | MediumTest | Level0)
{
List<uint16_t>* list = new List<uint16_t>();
list->PushBack(1);
EXPECT_EQ(list->IsEmpty(), false);
list->Clear();
EXPECT_EQ(list->IsEmpty(), true);
delete list;
}
/**
* @tc.number SUB_GRAPHIC_LIST_SIZE_1500
* @tc.name test list size api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(ListTest, Graphic_List_Test_Size_1500, Function | MediumTest | Level0)
{
List<uint16_t>* list = new List<uint16_t>();
list->PushBack(1);
EXPECT_EQ(list->Size(), 1);
list->Clear();
EXPECT_EQ(list->Size(), 0);
delete list;
}
} // 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 = [
"//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
/*
* 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/mem_api.h"
#include <climits>
#include <gtest/gtest.h>
using namespace std;
using namespace testing::ext;
namespace OHOS {
class MemapiTest : public testing::Test {
public:
static void SetUpTestCase(void);
static void TearDownTestCase(void);
};
void MemapiTest::SetUpTestCase()
{
return;
}
void MemapiTest::TearDownTestCase()
{
return;
}
/**
* @tc.number SUB_GRAPHIC_MEMAPI_IMAGECACHEMALLOC_0100
* @tc.name test memapi image-cache-malloc api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MemapiTest, Graphic_UIAnimatorTest_Test_ImageCacheMalloc_0100, Function | MediumTest | Level0)
{
ImageInfo* info = new ImageInfo();
free(ImageCacheMalloc(*info));
EXPECT_EQ(0, 0);
ImageCacheFree(*info);
delete info;
}
/**
* @tc.number SUB_GRAPHIC_MEMAPI_UIMALLOC_0200
* @tc.name test memapi uimalloc api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MemapiTest, Graphic_UIAnimatorTest_Test_UIMalloc_0200, Function | MediumTest | Level0)
{
void* size = UIMalloc(3);
EXPECT_EQ(0, 0);
free(size);
}
/**
* @tc.number SUB_GRAPHIC_MEMAPI_UIFREE_0300
* @tc.name test memapi uifree api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(MemapiTest, Graphic_UIAnimatorTest_Test_UIFree_0300, Function | MediumTest | Level0)
{
void* buffer = nullptr;
UIFree(buffer);
EXPECT_EQ(0, 0);
}
}
\ 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("ActsRectTest") {
suite_name = "acts"
sources = [ "src/rect_test.cpp" ]
include_dirs = [
"//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/ActsRectTest.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/rect.h"
#include <climits>
#include <gtest/gtest.h>
using namespace std;
using namespace testing::ext;
namespace OHOS {
class RectTest : public testing::Test {
public:
static void SetUpTestCase(void);
static void TearDownTestCase(void);
};
void RectTest::SetUpTestCase()
{
return;
}
void RectTest::TearDownTestCase()
{
return;
}
/**
* @tc.number SUB_GRAPHIC_RECT_OPERATOR_EQUAL_0100
* @tc.name test rect operator-equal api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_operator_Equal_0100, Function | MediumTest | Level0)
{
Rect* rect1 = new Rect();
rect1->SetRect(100, 200, 300, 400);
Rect* rect = new Rect();
rect->operator=(*rect1);
EXPECT_EQ(rect->GetLeft(), 100);
EXPECT_EQ(rect->GetTop(), 200);
EXPECT_EQ(rect->GetRight(), 300);
EXPECT_EQ(rect->GetBottom(), 400);
delete rect1;
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_SETRECT_0200
* @tc.name test rect set-rect api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_SetRect_0200, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetRect(100, 200, 300, 400);
EXPECT_EQ(rect->GetLeft(), 100);
EXPECT_EQ(rect->GetTop(), 200);
EXPECT_EQ(rect->GetRight(), 300);
EXPECT_EQ(rect->GetBottom(), 400);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_GETWIDTH_0300
* @tc.name test rect get-width api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_GetWidth_0300, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetRect(100, 200, 300, 400);
EXPECT_EQ(rect->GetWidth(), 201);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_GETHEIGHT_0400
* @tc.name test rect get-height api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_GetHeight_0400, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetRect(100, 200, 300, 400);
EXPECT_EQ(rect->GetHeight(), 201);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_GETX_0500
* @tc.name test rect getX api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_GetX_0500, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetRect(100, 200, 300, 400);
EXPECT_EQ(rect->GetX(), 100);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_GETY_0600
* @tc.name test rect getY api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_GetY_0600, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetRect(100, 200, 300, 400);
EXPECT_EQ(rect->GetY(), 200);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_GETLEFT_0700
* @tc.name test rect get-left api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_GetLeft_0700, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetRect(100, 200, 300, 400);
EXPECT_EQ(rect->GetLeft(), 100);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_GETTOP_0800
* @tc.name test rect get-top api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_GetTop_0800, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetRect(100, 200, 300, 400);
EXPECT_EQ(rect->GetTop(), 200);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_GETRIGHT_0900
* @tc.name test rect get-right api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_GetRight_0900, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetRect(100, 200, 300, 400);
EXPECT_EQ(rect->GetRight(), 300);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_GETBOTTOM_1000
* @tc.name test rect get-bottom api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_GetBottom_1000, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetRect(100, 200, 300, 400);
EXPECT_EQ(rect->GetBottom(), 400);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_SETX_1100
* @tc.name test rect setX api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_SetX_1100, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetRect(100, 200, 300, 400);
rect->SetX(200);
EXPECT_EQ(rect->GetLeft(), 200);
EXPECT_EQ(rect->GetRight(), 400);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_SETY_1200
* @tc.name test rect setY api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_SetY_1200, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetRect(100, 200, 300, 400);
rect->SetY(300);
EXPECT_EQ(rect->GetTop(), 300);
EXPECT_EQ(rect->GetBottom(), 500);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_SETPOSITION_1300
* @tc.name test rect set-position api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_SetPosition_1300, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetRect(100, 200, 300, 400);
rect->SetPosition(200, 300);
EXPECT_EQ(rect->GetLeft(), 200);
EXPECT_EQ(rect->GetRight(), 400);
EXPECT_EQ(rect->GetTop(), 300);
EXPECT_EQ(rect->GetBottom(), 500);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_SETWIDTH_1400
* @tc.name test rect set-width api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_SetWidth_1400, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetRect(100, 200, 300, 400);
rect->SetWidth(300);
EXPECT_EQ(rect->GetRight(), 399);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_SETHEIGHT_1500
* @tc.name test rect set-height api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_SetHeight_1500, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetRect(100, 200, 300, 400);
rect->SetHeight(300);
EXPECT_EQ(rect->GetBottom(), 499);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_SETLEFT_1600
* @tc.name test rect set-left api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_SetLeft_1600, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetLeft(200);
EXPECT_EQ(rect->GetLeft(), 200);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_SETTOP_1700
* @tc.name test rect set-top api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_SetTop_1700, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetTop(200);
EXPECT_EQ(rect->GetTop(), 200);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_SETRIGHT_1800
* @tc.name test rect set-right api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_SetRight_1800, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetRight(200);
EXPECT_EQ(rect->GetRight(), 200);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_SETBOTTOM_1900
* @tc.name test rect set-bottom api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_SetBottom_1900, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetBottom(200);
EXPECT_EQ(rect->GetBottom(), 200);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_RESIZE_2000
* @tc.name test rect resize api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_Resize_2000, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetRect(100, 200, 300, 400);
rect->Resize(300, 300);
EXPECT_EQ(rect->GetLeft(), 100);
EXPECT_EQ(rect->GetTop(), 200);
EXPECT_EQ(rect->GetRight(), 399);
EXPECT_EQ(rect->GetBottom(), 499);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_GETSIZE_2100
* @tc.name test rect get-size api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_GetSize_2100, Function | MediumTest | Level0)
{
Rect* rect = new Rect();
rect->SetRect(100, 200, 300, 400);
EXPECT_EQ(rect->GetSize(), 40401);
delete rect;
}
/**
* @tc.number SUB_GRAPHIC_RECT_INTERSECT_2200
* @tc.name test rect intersect api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_Intersect_2200, Function | MediumTest | Level0)
{
Rect* rect1 = new Rect(100, 200, 300, 400);
Rect* rect2 = new Rect(0, 0, 500, 600);
Rect* rect3 = new Rect(100, 500, 300, 600);
EXPECT_EQ(rect1->Intersect(*rect1, *rect2), true);
EXPECT_EQ(rect1->Intersect(*rect1, *rect3), false);
delete rect1;
delete rect2;
delete rect3;
}
/**
* @tc.number SUB_GRAPHIC_RECT_JOIN_2300
* @tc.name test rect join api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_Join_2300, Function | MediumTest | Level0)
{
Rect* rect1 = new Rect(100, 200, 300, 400);
Rect* rect2 = new Rect(0, 0, 500, 600);
Rect* rect3 = new Rect(100, 500, 300, 700);
rect1->Join(*rect1, *rect2);
EXPECT_EQ(rect1->GetLeft(), 0);
EXPECT_EQ(rect1->GetTop(), 0);
EXPECT_EQ(rect1->GetRight(), 500);
EXPECT_EQ(rect1->GetBottom(), 600);
rect1->Join(*rect1, *rect3);
EXPECT_EQ(rect1->GetLeft(), 0);
EXPECT_EQ(rect1->GetTop(), 0);
EXPECT_EQ(rect1->GetRight(), 500);
EXPECT_EQ(rect1->GetBottom(), 700);
delete rect1;
delete rect2;
delete rect3;
}
/**
* @tc.number SUB_GRAPHIC_RECT_ISCONTAINS_2400
* @tc.name test rect judge-whether-contains api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_IsContains_2400, Function | MediumTest | Level0)
{
Rect* rect1 = new Rect(100, 200, 300, 400);
Vector2<int16_t> pt1 = { 200, 300 };
Vector2<int16_t> pt2 = { 0, 0 };
EXPECT_EQ(rect1->IsContains(pt1), true);
EXPECT_EQ(rect1->IsContains(pt2), false);
delete rect1;
}
/**
* @tc.number SUB_GRAPHIC_RECT_ISCONTAINS_2500
* @tc.name test rect judge-whether-contains2 api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_IsContains_2500, Function | MediumTest | Level0)
{
Rect* rect1 = new Rect(100, 200, 300, 400);
Point pt1;
pt1.x = 200;
pt1.y = 300;
Point pt2;
pt2.x = 0;
pt2.y = 0;
EXPECT_EQ(rect1->IsContains(pt1), true);
EXPECT_EQ(rect1->IsContains(pt2), false);
delete rect1;
}
/**
* @tc.number SUB_GRAPHIC_RECT_ISINTERSECT_2600
* @tc.name test rect judge-whether-intersect api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_IsIntersect_2600, Function | MediumTest | Level0)
{
Rect* rect1 = new Rect(100, 200, 300, 400);
Rect* rect2 = new Rect(0, 0, 500, 600);
Rect* rect3 = new Rect(100, 500, 300, 700);
EXPECT_EQ(rect1->IsIntersect(*rect2), true);
EXPECT_EQ(rect1->IsIntersect(*rect3), false);
delete rect1;
delete rect2;
delete rect3;
}
/**
* @tc.number SUB_GRAPHIC_RECT_ISCONTAINS_2700
* @tc.name test rect judge-whether-contains3 api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(RectTest, Graphic_Rect_Test_IsContains_2700, Function | MediumTest | Level0)
{
Rect* rect1 = new Rect(100, 200, 300, 400);
Rect* rect2 = new Rect(0, 0, 500, 600);
Rect* rect3 = new Rect(100, 500, 300, 700);
EXPECT_EQ(rect2->IsContains(*rect1), true);
EXPECT_EQ(rect2->IsContains(*rect3), false);
delete rect1;
delete rect2;
delete rect3;
}
} // 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("ActsSysInfoTest") {
suite_name = "acts"
sources = [ "src/sys_info_test.cpp" ]
include_dirs = [
"//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/ActsSysInfoTest.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 "../utils/sys_info.h"
using namespace std;
using namespace testing::ext;
namespace OHOS {
class SysInfoTest : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
};
class OnFPSChangedInstance : public SysInfo::OnFPSChangedListener {
void OnFPSChanged(float newFPS) override
{
return;
}
};
/**
* @tc.number SUB_GRAPHIC_SYSINFO_FPSCALCULATETYPE_0100
* @tc.name test themes-manager FPS-calculate-type api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SysInfoTest, Graphic_SysInfo_Test_FPSCalculateType_0100, Function | MediumTest | Level0)
{
SysInfo::FPSCalculateType type;
auto* fpsChangedListener = new OnFPSChangedInstance;
fpsChangedListener->SetFPSCalculateType(type);
EXPECT_EQ(fpsChangedListener->GetFPSCalculateType(), type);
delete fpsChangedListener;
}
/**
* @tc.number SUB_GRAPHIC_SYSINFO_GETFPS_0200
* @tc.name test themes-manager get-FPS api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SysInfoTest, Graphic_SysInfo_Test_GetFPS_0200, Function | MediumTest | Level0)
{
float value = 0.0;
value = SysInfo::GetFPS();
EXPECT_EQ(0, 0);
}
/**
* @tc.number SUB_GRAPHIC_SYSINFO_REGISTERFPSCHANGEDLISTENER_0300
* @tc.name test themes-manager register-FPS-changed-listener api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SysInfoTest, Graphic_SysInfo_Test_RegisterFPSChangedListener_0300, Function | MediumTest | Level0)
{
auto* fpsChangedListener = new OnFPSChangedInstance;
SysInfo::RegisterFPSChangedListener(fpsChangedListener);
EXPECT_EQ(0, 0);
delete fpsChangedListener;
}
} // 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("ActsTransformTest") {
suite_name = "acts"
sources = [ "src/transform_test.cpp" ]
include_dirs = [
"//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/ActsTransformTest.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/transform.h"
#include <climits>
#include <gtest/gtest.h>
using namespace std;
using namespace testing::ext;
namespace OHOS {
class TransformTest : public testing::Test {
public:
static void SetUpTestCase(void);
static void TearDownTestCase(void);
};
void TransformTest::SetUpTestCase()
{
return;
}
void TransformTest::TearDownTestCase()
{
return;
}
/**
* @tc.number SUB_GRAPHIC_TRANSFORM_SETPOLYGON_0100
* @tc.name test transform set-polygon api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TransformTest, Graphic_Transform_Test_SetPolygon_0100, Function | MediumTest | Level0)
{
TransformMap *transform = new TransformMap();
Polygon poly;
uint8_t vertexNum = 8;
poly.SetVertexNum(vertexNum);
transform->SetPolygon(poly);
EXPECT_EQ(transform->GetPolygon().GetVertexNum(), vertexNum);
delete transform;
}
/**
* @tc.number SUB_GRAPHIC_TRANSFORM_GETPIVOT_0200
* @tc.name test transform get-pivot api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TransformTest, Graphic_Transform_Test_GetPivot_0200, Function | MediumTest | Level0)
{
TransformMap *transform = new TransformMap();
EXPECT_EQ(transform->GetPivot().x_, 0);
EXPECT_EQ(transform->GetPivot().y_, 0);
delete transform;
}
/**
* @tc.number SUB_GRAPHIC_TRANSFORM_GETCLOCKWISE_0300
* @tc.name test transform get-clockwise api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TransformTest, Graphic_Transform_Test_GetClockWise_0300, Function | MediumTest | Level0)
{
TransformMap *transform = new TransformMap();
transform->GetPolygon().SetVertexNum(2); // 2 < VERTEX_NUM_MIN
EXPECT_EQ(transform->GetClockWise(), false);
delete transform;
}
/**
* @tc.number SUB_GRAPHIC_TRANSFORM_ISINVALID_0400
* @tc.name test transform judge-whether-invalid api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TransformTest, Graphic_Transform_Test_IsInvalid_0400, Function | MediumTest | Level0)
{
TransformMap *transform = new TransformMap();
EXPECT_EQ(transform->IsInvalid(), true);
delete transform;
}
/**
* @tc.number SUB_GRAPHIC_TRANSFORM_ISINVALID_0500
* @tc.name test transform judge-whether-invalid2 api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TransformTest, Graphic_Transform_Test_IsInvalid_0500, Function | MediumTest | Level0)
{
TransformMap *transform = new TransformMap(Rect(100, 200, 300, 400));
EXPECT_EQ(transform->IsInvalid(), true);
delete transform;
}
/**
* @tc.number SUB_GRAPHIC_TRANSFORM_GETTRANSMAPRECT_0600
* @tc.name test transform get-transmaprect api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TransformTest, Graphic_Transform_Test_GetTransMapRect_0600, Function | MediumTest | Level0)
{
TransformMap *transform = new TransformMap(Rect(100, 200, 300, 400));
EXPECT_EQ(transform->GetTransMapRect().GetLeft(), 100);
EXPECT_EQ(transform->GetTransMapRect().GetTop(), 200);
EXPECT_EQ(transform->GetTransMapRect().GetRight(), 300);
EXPECT_EQ(transform->GetTransMapRect().GetBottom(), 400);
delete transform;
}
/**
* @tc.number SUB_GRAPHIC_TRANSFORM_GETBOXRECT_0700
* @tc.name test transform getboxrect api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TransformTest, Graphic_Transform_Test_GetBoxRect_0700, Function | MediumTest | Level0)
{
TransformMap *transform = new TransformMap(Rect(100, 200, 300, 400));
EXPECT_EQ(transform->GetBoxRect().GetLeft(), 100);
EXPECT_EQ(transform->GetBoxRect().GetTop(), 200);
EXPECT_EQ(transform->GetBoxRect().GetRight(), 300);
EXPECT_EQ(transform->GetBoxRect().GetBottom(), 400);
delete transform;
}
/**
* @tc.number SUB_GRAPHIC_TRANSFORM_ROTATE_0800
* @tc.name test transform rotate api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TransformTest, Graphic_Transform_Test_Rotate_0800, Function | MediumTest | Level0)
{
TransformMap *transform = new TransformMap();
int16_t angle = 0;
Vector2<float> pivot = {0, 0};
transform->Rotate(angle, pivot);
EXPECT_EQ(0, 0);
delete transform;
}
/**
* @tc.number SUB_GRAPHIC_TRANSFORM_SCAL_0900
* @tc.name test transform scal api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TransformTest, Graphic_Transform_Test_Scal_0900, Function | MediumTest | Level0)
{
TransformMap *transform = new TransformMap();
Vector2<float> scale = {0, 0};
Vector2<float> pivot = {0, 0};
transform->Scale(scale, pivot);
EXPECT_EQ(0, 0);
delete transform;
}
/**
* @tc.number SUB_GRAPHIC_TRANSFORM_ROTATE_1000
* @tc.name test transform rotate2 api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TransformTest, Graphic_Transform_Test_Rotate_1000, Function | MediumTest | Level0)
{
Vector2<int16_t> point = {0, 0};
int16_t angle = 0;
Vector2<int16_t> pivot = {0, 0};
Vector2<int16_t> out = {0, 0};
Rotate(point, angle, pivot, out);
EXPECT_EQ(0, 0);
}
/**
* @tc.number SUB_GRAPHIC_TRANSFORM_ROTATE_1100
* @tc.name test transform rotate3 api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TransformTest, Graphic_Transform_Test_Rotate_1100, Function | MediumTest | Level0)
{
Line* origLine = new Line();
int16_t angle = 0;
Vector2<int16_t> pivot = {0, 0};
Line* out =new Line();
Rotate(*origLine, angle, pivot, *out);
EXPECT_EQ(0, 0);
delete out;
delete origLine;
}
/**
* @tc.number SUB_GRAPHIC_TRANSFORM_ROTATE_1200
* @tc.name test transform rotate4 api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(TransformTest, Graphic_Transform_Test_Rotate_1200, Function | MediumTest | Level0)
{
Rect* origRect = new Rect();
int16_t angle = 0;
Vector2<int16_t> pivot = {0, 0};
Polygon* out =new Polygon();
Rotate(*origRect, angle, pivot, *out);
EXPECT_EQ(0, 0);
delete out;
delete origRect;
}
} // 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("ActsGraphVersionTest") {
suite_name = "acts"
sources = [ "src/version_test.cpp" ]
include_dirs = [
"//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/ActsGraphVersionTest.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/version.h"
#include <climits>
#include <gtest/gtest.h>
using namespace std;
using namespace testing::ext;
namespace OHOS {
class VersionTest : public testing::Test {
public:
static void SetUpTestCase(void);
static void TearDownTestCase(void);
};
void VersionTest::SetUpTestCase()
{
return;
}
void VersionTest::TearDownTestCase()
{
return;
}
/**
* @tc.number SUB_GRAPHIC_VERSION_GETVERSION_0100
* @tc.name test version get-version api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(VersionTest, Graphic_VersionTest_Test_GetVersion_0100, Function | MediumTest | Level0)
{
GetVersion();
EXPECT_EQ(0, 0);
}
/**
* @tc.number SUB_GRAPHIC_VERSION_GETLIBDSC_0200
* @tc.name test version get-lib-dsc api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(VersionTest, Graphic_VersionTest_Test_GetLibDsc_0200, Function | MediumTest | Level0)
{
GetLibDsc();
EXPECT_EQ(0, 0);
}
}
\ 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.
group("uikit_test2") {
deps = [
"//test/xts/acts/graphic_lite/surface/surface_posix:ActsSurfaceTest",
]
}
# 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("ActsSurfaceTest") {
suite_name = "acts"
sources = [
"src/surface_test.cpp",
#"src/surface_surface_test.cpp"
]
include_dirs = [
"//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/ActsSurfaceTest.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 "surface_buffer.h"
#include <climits>
#include <gtest/gtest.h>
using namespace std;
using namespace testing::ext;
namespace OHOS {
class SurfaceSurfaceTest : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
};
/**
* @tc.number SUB_GRAPHIC_SURFACE_SURFACE_GETVIRADDR_0100
* @tc.name test surface-surface get-vir-addr api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SurfaceSurfaceTest, Graphic_SurfaceSurface_Test_GetVirAddr_0100, Function | MediumTest | Level0)
{
Surface* surfaceVar = new Surface();
surfaceVar->GetVirAddr();
EXPECT_EQ(0, 0);
delete surfaceVar;
}
/**
* @tc.number SUB_GRAPHIC_SURFACE_SURFACE_INT32_0200
* @tc.name test surface int32 api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SurfaceSurfaceTest, Graphic_SurfaceSurface_Test_Int32_0200, Function | MediumTest | Level0)
{
Surface* surfaceVar = new Surface();
uint32_t key = 0x00001000;
int32_t value = 0x00002000;
int32_t testReturn = surfaceVar->SetInt32(key, value);
if (testReturn) {
EXPECT_EQ(surfaceVar->GetInt32(key, value), value);
}
delete surfaceVar;
}
/**
* @tc.number SUB_GRAPHIC_SURFACE_SURFACE_INT64_0300
* @tc.name test surface int64 api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SurfaceSurfaceTest, Graphic_SurfaceSurface_Test_Int64_0300, Function | MediumTest | Level0)
{
Surface* surfaceVar = new Surface();
uint32_t key = 0x00001000;
int64_t value_ = 0x0000000000002000;
int64_t testReturn = surfaceVar->SetInt64(key, value);
if (testReturn) {
EXPECT_EQ(surfaceVar->GetInt32(key, value), value);
}
delete surfaceVar;
}
} // 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 "buffer_common.h"
#include "surface.h"
#include "surface_impl.h"
#include <climits>
#include <gtest/gtest.h>
using namespace std;
using namespace testing::ext;
namespace OHOS {
class SurfaceTest : public testing::Test {
public:
static void SetUpTestCase(void) {}
static void TearDownTestCase(void) {}
};
/**
* @tc.number SUB_GRAPHIC_SURFACE_FORMAT_0100
* @tc.name test surface format api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SurfaceTest, Graphic_Surface_Test_Format_0100, Function | MediumTest | Level0)
{
uint32_t format = 0x00001000;
Surface* surface = Surface::CreateSurface();
if (surface != nullptr) {
surface->SetFormat(format);
surface->GetFormat();
delete surface;
}
EXPECT_EQ(0, 0);
}
/**
* @tc.number SUB_GRAPHIC_SURFACE_SIZE_0200
* @tc.name test surface size api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SurfaceTest, Graphic_Surface_Test_Size_0200, Function | MediumTest | Level0)
{
uint32_t size = 0x00001000;
Surface* surface = Surface::CreateSurface();
if (surface != nullptr) {
surface->SetSize(size);
}
if (surface != nullptr) {
EXPECT_EQ(surface->GetSize(), size);
}
delete surface;
}
/**
* @tc.number SUB_GRAPHIC_SURFACE_STRIDEALIGNMENT_0300
* @tc.name test surface stride-alignment api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SurfaceTest, Graphic_Surface_Test_StrideAlignment_0300, Function | MediumTest | Level0)
{
uint32_t strideAlignment = 0x00001000;
Surface* surface = Surface::CreateSurface();
if (surface != nullptr) {
surface->SetStrideAlignment(strideAlignment);
surface->GetStrideAlignment();
delete surface;
}
EXPECT_EQ(0, 0);
}
/**
* @tc.number SUB_GRAPHIC_SURFACE_USAGE_0400
* @tc.name test surface usage api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SurfaceTest, Graphic_Surface_Test_Usage_0400, Function | MediumTest | Level0)
{
uint32_t usage = 0x00001000;
Surface* surface = Surface::CreateSurface();
if (surface != nullptr) {
surface->SetUsage(usage);
surface->GetUsage();
delete surface;
}
EXPECT_EQ(0, 0);
}
/**
* @tc.number SUB_GRAPHIC_SURFACE_RELEASEBUFFER_0500
* @tc.name test surface release-buffer api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SurfaceTest, Graphic_Surface_Test_ReleaseBuffer_0500, Function | MediumTest | Level0)
{
Surface* surface = Surface::CreateSurface();
if (surface != nullptr) {
surface->AcquireBuffer();
delete surface;
}
EXPECT_EQ(0, 0);
}
/**
* @tc.number SUB_GRAPHIC_SURFACE_FLUSHBUFFER_0600
* @tc.name test surface flush-buffer api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SurfaceTest, Graphic_Surface_Test_FlushBuffer_0600, Function | MediumTest | Level0)
{
Surface* surface = Surface::CreateSurface();
if (surface != nullptr) {
surface->SetSize(1024);
SurfaceBuffer* buffer = surface->RequestBuffer();
surface->ReleaseBuffer(buffer);
delete surface;
}
EXPECT_EQ(0, 0);
}
/**
* @tc.number SUB_GRAPHIC_SURFACE_ACQUIREBUFFER_0700
* @tc.name test surface acquire-buffer api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SurfaceTest, Graphic_Surface_Test_AcquireBuffer_0700, Function | MediumTest | Level0)
{
Surface* surface = Surface::CreateSurface();
if (surface != nullptr) {
surface->AcquireBuffer();
}
EXPECT_EQ(0, 0);
delete surface;
}
/**
* @tc.number SUB_GRAPHIC_SURFACE_REQUESTBUFFER_0800
* @tc.name test surface request-buffer api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SurfaceTest, Graphic_Surface_Test_RequestBuffer_0800, Function | MediumTest | Level0)
{
uint8_t wait = 100;
Surface* surface = Surface::CreateSurface();
if (surface != nullptr) {
surface->RequestBuffer(wait);
}
EXPECT_EQ(0, 0);
delete surface;
}
/**
* @tc.number SUB_GRAPHIC_SURFACE_CANCELBUFFER_0900
* @tc.name test surface cancel-buffer api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SurfaceTest, Graphic_Surface_Test_CancelBuffer_0900, Function | MediumTest | Level0)
{
Surface* surface = Surface::CreateSurface();
if (surface != nullptr) {
surface->SetSize(1024);
SurfaceBuffer* buffer = surface->RequestBuffer();
surface->CancelBuffer(buffer);
}
EXPECT_EQ(0, 0);
delete surface;
}
/**
* @tc.number SUB_GRAPHIC_SURFACE_USERDATA_1000
* @tc.name test surface user-data api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SurfaceTest, Graphic_Surface_Test_UserData_1000, Function | MediumTest | Level0)
{
std::string key = "testWord";
std::string value = "testValue";
Surface* surface = Surface::CreateSurface();
if (surface != nullptr) {
surface->SetUserData(key, value);
}
if (surface != nullptr) {
EXPECT_EQ(surface->GetUserData(key), value);
}
delete surface;
}
/**
* @tc.number SUB_GRAPHIC_SURFACE_GETSTRIDE_1100
* @tc.name test surface get-stride api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SurfaceTest, Graphic_Surface_Test_GetStride_1100, Function | MediumTest | Level0)
{
Surface* surface = Surface::CreateSurface();
if (surface != nullptr) {
surface->GetStride();
}
EXPECT_EQ(0, 0);
delete surface;
}
/**
* @tc.number SUB_GRAPHIC_SURFACE_SETWIDTHANDHEIGHT_1200
* @tc.name test surface set-width-and-height api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SurfaceTest, Graphic_Surface_Test_SetWidthAndHeight_1200, Function | MediumTest | Level0)
{
uint32_t width = 0x00000200;
uint32_t height = 0x00000100;
Surface* surface = Surface::CreateSurface();
if (surface != nullptr) {
surface->SetWidthAndHeight(width, height);
}
EXPECT_EQ(0, 0);
delete surface;
}
/**
* @tc.number SUB_GRAPHIC_SURFACE_SETQUEUESIZE_1300
* @tc.name test surface set-queue-size api
* @tc.desc [C- SOFTWARE -0200]
*/
HWTEST_F(SurfaceTest, Graphic_Surface_Test_SetQueueSize_1300, Function | MediumTest | Level0)
{
uint8_t queueSize = 100;
Surface* surface = Surface::CreateSurface();
if (surface != nullptr) {
surface->SetQueueSize(queueSize);
}
EXPECT_EQ(0, 0);
delete surface;
}
} // 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.
group("uikit_test3") {
deps = [
"//test/xts/acts/graphic_lite/ui/a:ActsUiInterfaceTest",
"//test/xts/acts/graphic_lite/ui/animator_posix:ActsAnimatorTest",
"//test/xts/acts/graphic_lite/ui/easing_equation_posix:ActsEasingEquationTest",
"//test/xts/acts/graphic_lite/ui/events_posix:ActsEventsTest",
"//test/xts/acts/graphic_lite/ui/flexlayout_posix:ActsFlexlaoutTest",
"//test/xts/acts/graphic_lite/ui/gridlayout_posix:ActsGridLayoutTest",
"//test/xts/acts/graphic_lite/ui/image_posix:ActsImageTest",
"//test/xts/acts/graphic_lite/ui/interpolation_posix:ActsInterpoliationTest",
"//test/xts/acts/graphic_lite/ui/layout_posix:ActsLayoutTest",
"//test/xts/acts/graphic_lite/ui/listlayout_posix:ActsListlayoutTest",
"//test/xts/acts/graphic_lite/ui/screen_posix:ActsScreenTest",
"//test/xts/acts/graphic_lite/ui/style_posix:ActsStyleTest",
"//test/xts/acts/graphic_lite/ui/theme_posix:ActsThemeTest",
"//test/xts/acts/graphic_lite/ui/ui_abstract_progress_posix:ActsUIAbstractProgressTest",
"//test/xts/acts/graphic_lite/ui/ui_analog_clock_posix:ActsUIAnalogClockTest",
"//test/xts/acts/graphic_lite/ui/ui_arc_lable_posix:ActsUIArcLabelTest",
"//test/xts/acts/graphic_lite/ui/ui_axis_posix:ActsUIAxisTest",
"//test/xts/acts/graphic_lite/ui/ui_box_porgress_posix:ActsUIBoxProgressTest",
"//test/xts/acts/graphic_lite/ui/ui_button_posix:ActsUIButtonTest",
"//test/xts/acts/graphic_lite/ui/ui_canvas_posix:ActsUICanvasTest",
"//test/xts/acts/graphic_lite/ui/ui_chart_posix:ActsUIChartTest",
"//test/xts/acts/graphic_lite/ui/ui_checbox_posix:ActsUICheckboxTest",
"//test/xts/acts/graphic_lite/ui/ui_circle_progress_posix:ActsUICircleProgressTest",
"//test/xts/acts/graphic_lite/ui/ui_digital_clock_posix:ActsUIDigitalClockTest",
"//test/xts/acts/graphic_lite/ui/ui_image_animator_posix:ActsUIImageAnimatorTest",
"//test/xts/acts/graphic_lite/ui/ui_image_posix:ActsUIImageTest",
"//test/xts/acts/graphic_lite/ui/ui_label_button_posix:ActsUILabelButtonTest",
"//test/xts/acts/graphic_lite/ui/ui_label_posix:ActsUILabelTest",
"//test/xts/acts/graphic_lite/ui/ui_list_posix:ActsUIListTest",
"//test/xts/acts/graphic_lite/ui/ui_picker_posix:ActsUIPickerTest",
"//test/xts/acts/graphic_lite/ui/ui_radio_button_posix:ActsUIRadioButtonTest",
"//test/xts/acts/graphic_lite/ui/ui_repeat_button_posix:ActsUIRepeatButtonTest",
"//test/xts/acts/graphic_lite/ui/ui_screenshot_posix:ActsUIScreenshotTest",
"//test/xts/acts/graphic_lite/ui/ui_scroll_view_posix:ActsUIScrollViewTest",
"//test/xts/acts/graphic_lite/ui/ui_slider_posix:ActsUISliderTest",
"//test/xts/acts/graphic_lite/ui/ui_surface_view_posix:ActsUISurfaceViewTest",
"//test/xts/acts/graphic_lite/ui/ui_swipe_view_posix:ActsUISwipeViewTest",
"//test/xts/acts/graphic_lite/ui/ui_text_posix:ActsUITextTest",
"//test/xts/acts/graphic_lite/ui/ui_texture_mapper_posix:ActsUITextureMapperTest",
"//test/xts/acts/graphic_lite/ui/ui_time_picker_posix:ActsUITimePickerTest",
"//test/xts/acts/graphic_lite/ui/ui_toggle_button_posix:ActsUIToggleButtonTest",
"//test/xts/acts/graphic_lite/ui/ui_view_group_posix:ActsUIViewGroupTest",
"//test/xts/acts/graphic_lite/ui/ui_view_posix:ActsUIViewTest",
"//test/xts/acts/graphic_lite/ui/uianimator_posix:ActsUIAnimatorTest",
#"//test/xts/acts/graphic_lite/ui/uidfx_posix:ActsUIDfxTest",
#"//test/xts/acts/graphic_lite/ui/uifont_posix:ActsUIFontTest",
]
}
# 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 = [
"//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
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册