unittest cases not on board rectification

Signed-off-by: liyujie <liyujie43@huawei.com>
Change-Id: I91243410867763028cfc7bc35391127fe9066532
This commit is contained in:
liyujie 2023-12-05 16:27:38 +08:00
parent a6bbbcc06c
commit ee3215330e
120 changed files with 1209 additions and 1457 deletions

2
.gitignore vendored
View File

@ -14,4 +14,4 @@ lite/jsfwk/
lite/maplejs/
lite/tools/
lite/ui/
test/unittest/scripts/*

View File

@ -112,7 +112,7 @@ constexpr LogType LOG_TYPES[] = {
LOG_APP,
};
}
} // namespace
// initial static member object
LogLevel LogWrapper::level_ = LogLevel::DEBUG;

View File

@ -240,8 +240,8 @@ bool SystemProperties::isRound_ = false;
bool SystemProperties::isDeviceAccess_ = false;
ACE_WEAK_SYM int32_t SystemProperties::deviceWidth_ = 0;
ACE_WEAK_SYM int32_t SystemProperties::deviceHeight_ = 0;
int32_t SystemProperties::devicePhysicalWidth_ = 0;
int32_t SystemProperties::devicePhysicalHeight_ = 0;
ACE_WEAK_SYM int32_t SystemProperties::devicePhysicalWidth_ = 0;
ACE_WEAK_SYM int32_t SystemProperties::devicePhysicalHeight_ = 0;
ACE_WEAK_SYM double SystemProperties::resolution_ = 1.0;
ACE_WEAK_SYM DeviceType SystemProperties::deviceType_ { DeviceType::UNKNOWN };
ACE_WEAK_SYM DeviceOrientation SystemProperties::orientation_ { DeviceOrientation::PORTRAIT };
@ -271,7 +271,7 @@ int32_t SystemProperties::astcPsnr_ = GetAstcPsnrProp();
ACE_WEAK_SYM bool SystemProperties::extSurfaceEnabled_ = IsExtSurfaceEnabled();
ACE_WEAK_SYM uint32_t SystemProperties::dumpFrameCount_ = GetSysDumpFrameCount();
bool SystemProperties::resourceDecoupling_ = GetResourceDecoupling();
bool SystemProperties::changeTitleStyleEnabled_ = IsTitleStyleEnabled();
ACE_WEAK_SYM bool SystemProperties::changeTitleStyleEnabled_ = IsTitleStyleEnabled();
bool SystemProperties::flutterDecouplingEnabled_ = IsFlutterDecouplingEnabled();
bool SystemProperties::IsSyscapExist(const char* cap)
@ -508,7 +508,7 @@ int32_t SystemProperties::GetJankFrameThreshold()
return system::GetIntParameter<int>("persist.sys.arkui.perf.threshold", DEFAULT_THRESHOLD_JANK);
}
std::string SystemProperties::GetCustomTitleFilePath()
ACE_WEAK_SYM std::string SystemProperties::GetCustomTitleFilePath()
{
return system::GetParameter(CUSTOM_TITLE_KEY, "");
}

View File

@ -16,12 +16,11 @@
#ifndef FOUNDATION_ACE_FRAMEWORKS_BASE_GEOMETRY_LEAST_SQUARE_IMPL_H
#define FOUNDATION_ACE_FRAMEWORKS_BASE_GEOMETRY_LEAST_SQUARE_IMPL_H
#include <cstdint>
#include <vector>
#include "base/utils/macros.h"
#ifdef LINUX_PLATFORM
#include <cstdint>
#endif
namespace OHOS::Ace {
/**
* @brief Least square method of four parametres.

View File

@ -16,13 +16,11 @@
#ifndef FOUNDATION_ACE_FRAMEWORKS_BASE_THREAD_BACKGROUND_TASK_EXECUTOR_H
#define FOUNDATION_ACE_FRAMEWORKS_BASE_THREAD_BACKGROUND_TASK_EXECUTOR_H
#include <list>
#include <thread>
#ifdef LINUX_PLATFORM
#include <mutex>
#include <functional>
#include <condition_variable>
#endif
#include <functional>
#include <list>
#include <mutex>
#include <thread>
#include "base/utils/noncopyable.h"

View File

@ -21,10 +21,8 @@
namespace OHOS::Ace::StringUtils {
namespace {
const size_t MAX_STRING_SIZE = 256;
}
} // namespace
const char DEFAULT_STRING[] = "error";
const std::wstring DEFAULT_WSTRING = L"error";

View File

@ -16,12 +16,11 @@
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_ANIMATION_CURVE_H
#define FOUNDATION_ACE_FRAMEWORKS_CORE_ANIMATION_CURVE_H
#include <functional>
#include "base/memory/ace_type.h"
#include "base/utils/macros.h"
#include "base/utils/utils.h"
#ifdef LINUX_PLATFORM
#include <functional>
#endif
namespace OHOS::Ace {
class NativeCurveHelper;

View File

@ -87,11 +87,11 @@ void EventManager::TouchTest(const TouchEvent& touchPoint, const RefPtr<RenderNo
void EventManager::TouchTest(const TouchEvent& touchPoint, const RefPtr<NG::FrameNode>& frameNode,
const TouchRestrict& touchRestrict, const Offset& offset, float viewScale, bool needAppend)
{
TAG_LOGI(AceLogTag::ACE_INPUTTRACKING, "TouchEvent do TouchTest in EventManager: "
TAG_LOGI(AceLogTag::ACE_INPUTTRACKING,
"TouchEvent do TouchTest in EventManager: "
"eventInfo: id:%{public}d, pointX=%{public}f pointY=%{public}f "
"touchPoint referee state:%{public}d, needAppend:%{public}d", touchPoint.id,
touchPoint.x, touchPoint.y, (int)(refereeNG_->QueryAllDone(touchPoint.id)),
(int)needAppend);
"touchPoint referee state:%{public}d, needAppend:%{public}d",
touchPoint.id, touchPoint.x, touchPoint.y, (int)(refereeNG_->QueryAllDone(touchPoint.id)), (int)needAppend);
ContainerScope scope(instanceId_);
ACE_FUNCTION_TRACE();
@ -252,8 +252,7 @@ void EventManager::HandleGlobalEventNG(const TouchEvent& touchPoint,
const RefPtr<NG::SelectOverlayManager>& selectOverlayManager, const NG::OffsetF& rootOffset)
{
CHECK_NULL_VOID(selectOverlayManager);
if (touchPoint.type == TouchType::DOWN &&
touchTestResults_.find(touchPoint.id) != touchTestResults_.end()) {
if (touchPoint.type == TouchType::DOWN && touchTestResults_.find(touchPoint.id) != touchTestResults_.end()) {
std::vector<std::string> touchTestIds;
const auto& resultList = touchTestResults_[touchPoint.id];
for (const auto& result : resultList) {
@ -346,9 +345,11 @@ void EventManager::FlushTouchEventsEnd(const std::list<TouchEvent>& touchEvents)
bool EventManager::DispatchTouchEvent(const TouchEvent& event)
{
if (event.type != TouchType::MOVE) {
TAG_LOGI(AceLogTag::ACE_INPUTTRACKING, "TouchEvent Dispatch in EventManager: "
TAG_LOGI(AceLogTag::ACE_INPUTTRACKING,
"TouchEvent Dispatch in EventManager: "
"eventInfo: id:%{public}d, pointX=%{public}f pointY=%{public}f "
"type=%{public}d", event.id, event.x, event.y, (int)event.type);
"type=%{public}d",
event.id, event.x, event.y, (int)event.type);
}
ContainerScope scope(instanceId_);
TouchEvent point = event;
@ -362,13 +363,13 @@ bool EventManager::DispatchTouchEvent(const TouchEvent& event)
point.type = TouchType::UP;
}
#endif // ENABLE_DRAG_FRAMEWORK
ACE_SCOPED_TRACE(
"DispatchTouchEvent id:%d, pointX=%f pointY=%f type=%d", point.id, point.x, point.y, (int)point.type);
const auto iter = touchTestResults_.find(point.id);
if (iter == touchTestResults_.end()) {
LOGI("the %{public}d touch test result does not exist!", point.id);
return false;
}
ACE_SCOPED_TRACE("DispatchTouchEvent id:%d, pointX=%f pointY=%f type=%d",
point.id, point.x, point.y, (int)point.type);
if (point.type == TouchType::DOWN) {
int64_t currentEventTime = static_cast<int64_t>(point.time.time_since_epoch().count());
@ -404,16 +405,13 @@ bool EventManager::DispatchTouchEvent(const TouchEvent& event)
auto recognizer = AceType::DynamicCast<NG::NGGestureRecognizer>(entry);
if (recognizer) {
entry->HandleMultiContainerEvent(point);
eventTree_.AddGestureProcedure(
reinterpret_cast<uintptr_t>(AceType::RawPtr(recognizer)),
point,
eventTree_.AddGestureProcedure(reinterpret_cast<uintptr_t>(AceType::RawPtr(recognizer)), point,
NG::TransRefereeState(recognizer->GetRefereeState()),
NG::TransGestureDisposal(recognizer->GetGestureDisposal()));
}
if (!recognizer && !isStopTouchEvent) {
isStopTouchEvent = !entry->HandleMultiContainerEvent(point);
eventTree_.AddGestureProcedure(
reinterpret_cast<uintptr_t>(AceType::RawPtr(entry)),
eventTree_.AddGestureProcedure(reinterpret_cast<uintptr_t>(AceType::RawPtr(entry)),
std::string("Handle").append(GestureSnapshot::TransTouchType(point.type)), "", "");
}
}
@ -682,8 +680,8 @@ void EventManager::MouseTest(
const MouseEvent& event, const RefPtr<NG::FrameNode>& frameNode, const TouchRestrict& touchRestrict)
{
TAG_LOGD(AceLogTag::ACE_MOUSE,
"Mouse test start. Event is (%{public}f,%{public}f), button: %{public}d, action: %{public}d", event.x,
event.y, event.button, event.action);
"Mouse test start. Event is (%{public}f,%{public}f), button: %{public}d, action: %{public}d", event.x, event.y,
event.button, event.action);
CHECK_NULL_VOID(frameNode);
const NG::PointF point { event.x, event.y };
TouchTestResult testResult;
@ -745,7 +743,7 @@ bool EventManager::DispatchMouseEventNG(const MouseEvent& event)
CHECK_NULL_RETURN(container, false);
if ((event.button == MouseButton::LEFT_BUTTON && !container->IsScenceBoardWindow()) ||
(event.button == MouseButton::LEFT_BUTTON && container->IsScenceBoardWindow() &&
event.pullAction != MouseAction::PULL_UP && event.pullAction != MouseAction::PULL_MOVE)) {
event.pullAction != MouseAction::PULL_UP && event.pullAction != MouseAction::PULL_MOVE)) {
for (const auto& mouseTarget : pressMouseTestResults_) {
if (mouseTarget) {
handledResults.emplace_back(mouseTarget);

View File

@ -16,8 +16,8 @@
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_CANVAS_RENDERER_CANVAS_RENDERER_MODEL_NG_H
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_CANVAS_RENDERER_CANVAS_RENDERER_MODEL_NG_H
#include "base/utils/macros.h"
#include "core/components_ng/pattern/canvas_renderer/canvas_renderer_model.h"
#include "frameworks/base/utils/macros.h"
namespace OHOS::Ace::NG {
class ACE_EXPORT CanvasRendererModelNG : public OHOS::Ace::CanvasRendererModel {
@ -66,14 +66,14 @@ public:
void Arc(const BaseInfo& baseInfo, const ArcParam& param) override;
void Ellipse(const BaseInfo& baseInfo, const EllipseParam& param) override;
void SetFillRuleForPath(const BaseInfo& baseInfo, const CanvasFillRule& fillRule) override;
void SetFillRuleForPath2D(const BaseInfo& baseInfo, const CanvasFillRule& fillRule,
const RefPtr<CanvasPath2D>& path) override;
void SetStrokeRuleForPath2D(const BaseInfo& baseInfo, const CanvasFillRule& fillRule,
const RefPtr<CanvasPath2D>& path) override;
void SetFillRuleForPath2D(
const BaseInfo& baseInfo, const CanvasFillRule& fillRule, const RefPtr<CanvasPath2D>& path) override;
void SetStrokeRuleForPath2D(
const BaseInfo& baseInfo, const CanvasFillRule& fillRule, const RefPtr<CanvasPath2D>& path) override;
void SetStrokeRuleForPath(const BaseInfo& baseInfo, const CanvasFillRule& fillRule) override;
void SetClipRuleForPath(const BaseInfo& baseInfo, const CanvasFillRule& fillRule) override;
void SetClipRuleForPath2D(const BaseInfo& baseInfo, const CanvasFillRule& fillRule,
const RefPtr<CanvasPath2D>& path) override;
void SetClipRuleForPath2D(
const BaseInfo& baseInfo, const CanvasFillRule& fillRule, const RefPtr<CanvasPath2D>& path) override;
void AddRect(const BaseInfo& baseInfo, const Rect& rect) override;
void BeginPath(const BaseInfo& baseInfo) override;
void ClosePath(const BaseInfo& baseInfo) override;

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
#include "frameworks/core/components_ng/pattern/folder_stack/folder_stack_layout_algorithm.h"
#include "core/components_ng/pattern/folder_stack/folder_stack_layout_algorithm.h"
#include "base/memory/ace_type.h"
#include "base/subwindow/subwindow_manager.h"

View File

@ -15,6 +15,8 @@
#include "core/components_ng/pattern/image/image_modifier.h"
#include <cstdlib>
namespace OHOS::Ace::NG {
ImageModifier::ImageModifier()
{
@ -56,8 +58,8 @@ void ImageModifier::SetImageFit(ImageFit imagefit)
imageFit_->Set(static_cast<float>(imagefit));
}
void ImageModifier::UpdateImageData(const WeakPtr<CanvasImage>& canvasImage,
const OffsetF& offset, const SizeF& contentSize)
void ImageModifier::UpdateImageData(
const WeakPtr<CanvasImage>& canvasImage, const OffsetF& offset, const SizeF& contentSize)
{
canvasImage_ = canvasImage;
offset_ = offset;
@ -94,7 +96,7 @@ void ImageModifier::DrawImageWithAnimation(DrawingContext& context)
float ratio = 1.0f;
if (!NearZero(difference)) {
// ratio goes from 0 to 1
ratio = abs((imageFit_->Get() - static_cast<float>(startImageFit_)) / difference);
ratio = std::abs((imageFit_->Get() - static_cast<float>(startImageFit_)) / difference);
}
UpdatePaintConfig(ratio);
auto canvas = canvasImage_.Upgrade();

View File

@ -20,6 +20,7 @@
#include "base/utils/macros.h"
#include "core/components/common/layout/constants.h"
#include "core/components_ng/render/paint_property.h"
namespace OHOS::Ace::NG {
constexpr Dimension DEFAULT_MARQUEE_SCROLL_AMOUNT = 6.0_vp;
class ACE_EXPORT MarqueePaintProperty : public PaintProperty {

View File

@ -16,6 +16,7 @@
#include "core/components_ng/pattern/picker/datepicker_column_pattern.h"
#include <cstdint>
#include <cstdlib>
#include <iterator>
#include <list>
#include <stdint.h>
@ -1182,7 +1183,7 @@ void DatePickerColumnPattern::OnAroundButtonClick(RefPtr<DatePickerEventParam> p
animation_ = AnimationUtils::StartAnimation(option, [weak = AceType::WeakClaim(this), step, distance]() {
auto column = weak.Upgrade();
CHECK_NULL_VOID(column);
column->aroundClickProperty_->Set(step > 0 ? 0.0 - abs(distance) : abs(distance));
column->aroundClickProperty_->Set(step > 0 ? 0.0 - std::abs(distance) : std::abs(distance));
});
}
}
@ -1210,7 +1211,7 @@ void DatePickerColumnPattern::AddHotZoneRectToText()
auto childSize = static_cast<int32_t>(host->GetChildren().size());
auto midSize = childSize / MINDDLE_CHILD_INDEX;
auto middleChildHeight = optionProperties_[midSize].height;
auto otherChildHeight = optionProperties_[midSize-1].height;
auto otherChildHeight = optionProperties_[midSize - 1].height;
for (int32_t i = 0; i < childSize; i++) {
RefPtr<FrameNode> childNode = DynamicCast<FrameNode>(host->GetChildAtIndex(i));
CHECK_NULL_VOID(childNode);
@ -1225,14 +1226,14 @@ void DatePickerColumnPattern::AddHotZoneRectToText()
hotZoneHegiht = (size_.Height() - middleChildHeight) / MINDDLE_CHILD_INDEX;
hotZoneOffsetY = (i == midSize - 1) ? (otherChildHeight - hotZoneHegiht) : 0;
}
} else if (size_.Height() <= (middleChildHeight + HOT_ZONE_HEIGHT_DISAPPEAR * otherChildHeight)) {
} else if (size_.Height() <= (middleChildHeight + HOT_ZONE_HEIGHT_DISAPPEAR * otherChildHeight)) {
if (i == midSize) {
hotZoneHegiht = middleChildHeight;
} else if ((i == midSize + 1) || (i == midSize - 1)) {
hotZoneHegiht = otherChildHeight;
} else if ((i == midSize + HOT_ZONE_HEIGHT_CANDIDATE) || (i == midSize - HOT_ZONE_HEIGHT_CANDIDATE)) {
hotZoneHegiht = (size_.Height() - middleChildHeight - HOT_ZONE_HEIGHT_CANDIDATE * otherChildHeight)
/ MINDDLE_CHILD_INDEX;
hotZoneHegiht = (size_.Height() - middleChildHeight - HOT_ZONE_HEIGHT_CANDIDATE * otherChildHeight) /
MINDDLE_CHILD_INDEX;
hotZoneOffsetY = (i == midSize - HOT_ZONE_HEIGHT_CANDIDATE) ? (otherChildHeight - hotZoneHegiht) : 0;
}
} else {

View File

@ -955,8 +955,6 @@ void TextFieldPattern::HandleOnUndoAction()
auto textEditingValue = operationRecords_.back(); // record应该包含光标、select状态、文本
contentController_->SetTextValue(textEditingValue.text);
selectController_->UpdateCaretIndex(textEditingValue.caretPosition);
auto layoutProperty = GetLayoutProperty<TextFieldLayoutProperty>();
CHECK_NULL_VOID(layoutProperty);
auto tmpHost = GetHost();
CHECK_NULL_VOID(tmpHost);
tmpHost->MarkDirtyNode(PROPERTY_UPDATE_MEASURE_SELF_AND_PARENT);
@ -972,8 +970,6 @@ void TextFieldPattern::HandleOnRedoAction()
selectController_->UpdateCaretIndex(textEditingValue.caretPosition);
redoOperationRecords_.pop_back();
operationRecords_.push_back(textEditingValue);
auto layoutProperty = GetLayoutProperty<TextFieldLayoutProperty>();
CHECK_NULL_VOID(layoutProperty);
auto tmpHost = GetHost();
CHECK_NULL_VOID(tmpHost);
tmpHost->MarkDirtyNode(PROPERTY_UPDATE_MEASURE_SELF_AND_PARENT);

View File

@ -16,6 +16,7 @@
#include "core/components_ng/pattern/text_picker/textpicker_column_pattern.h"
#include <cstdint>
#include <cstdlib>
#include "base/geometry/dimension.h"
#include "base/geometry/ng/size_t.h"
@ -348,8 +349,8 @@ void TextPickerColumnPattern::ResetOptionPropertyHeight()
auto pickerItemHeight = 0.0;
auto pattern = parentNode->GetPattern<TextPickerPattern>();
CHECK_NULL_VOID(pattern);
pickerItemHeight = pattern->GetResizeFlag() ? pattern->GetResizePickerItemHeight()
: pattern->GetDefaultPickerItemHeight();
pickerItemHeight =
pattern->GetResizeFlag() ? pattern->GetResizePickerItemHeight() : pattern->GetDefaultPickerItemHeight();
int32_t itemCounts = GetShowOptionCount();
for (int32_t i = 0; i < itemCounts; i++) {
TextPickerOptionProperty& prop = optionProperties_[i];
@ -971,7 +972,7 @@ void TextPickerColumnPattern::HandleDragEnd()
ScrollOption(0.0);
return;
}
ScrollDirection dir = scrollDelta_ > 0.0 ? ScrollDirection::DOWN :ScrollDirection::UP;
ScrollDirection dir = scrollDelta_ > 0.0 ? ScrollDirection::DOWN : ScrollDirection::UP;
int32_t middleIndex = GetShowOptionCount() / HALF_NUMBER;
auto shiftDistance = (dir == ScrollDirection::UP) ? optionProperties_[middleIndex].prevDistance
: optionProperties_[middleIndex].nextDistance;
@ -1099,7 +1100,7 @@ double TextPickerColumnPattern::GetShiftDistance(int32_t index, ScrollDirection
distance = -optionProperties_[nextIndex].height;
} else {
val = optionProperties_[index].height +
(optionProperties_[nextIndex].height - optionProperties_[nextIndex].fontheight) / HALF_NUMBER;
(optionProperties_[nextIndex].height - optionProperties_[nextIndex].fontheight) / HALF_NUMBER;
distance = std::ceil(val);
}
break;
@ -1412,7 +1413,7 @@ void TextPickerColumnPattern::OnAroundButtonClick(RefPtr<EventParam> param)
animation_ = AnimationUtils::StartAnimation(option, [weak = AceType::WeakClaim(this), step, distance]() {
auto column = weak.Upgrade();
CHECK_NULL_VOID(column);
column->aroundClickProperty_->Set(step > 0 ? 0.0 - abs(distance) : abs(distance));
column->aroundClickProperty_->Set(step > 0 ? 0.0 - std::abs(distance) : std::abs(distance));
});
}
}

View File

@ -16,6 +16,7 @@
#include "core/components_ng/pattern/time_picker/timepicker_column_pattern.h"
#include <cstdint>
#include <cstdlib>
#include <iterator>
#include <list>
@ -1232,7 +1233,7 @@ void TimePickerColumnPattern::OnAroundButtonClick(RefPtr<TimePickerEventParam> p
animation_ = AnimationUtils::StartAnimation(option, [weak = AceType::WeakClaim(this), step, distance]() {
auto column = weak.Upgrade();
CHECK_NULL_VOID(column);
column->aroundClickProperty_->Set(step > 0 ? 0.0 - abs(distance) : abs(distance));
column->aroundClickProperty_->Set(step > 0 ? 0.0 - std::abs(distance) : std::abs(distance));
});
}
}
@ -1264,7 +1265,7 @@ void TimePickerColumnPattern::AddHotZoneRectToText()
auto childSize = static_cast<int32_t>(host->GetChildren().size());
auto midSize = childSize / MIDDLE_CHILD_INDEX;
auto middleChildHeight = optionProperties_[midSize].height;
auto otherChildHeight = optionProperties_[midSize-1].height;
auto otherChildHeight = optionProperties_[midSize - 1].height;
for (int32_t i = 0; i < childSize; i++) {
RefPtr<FrameNode> childNode = DynamicCast<FrameNode>(host->GetChildAtIndex(i));
CHECK_NULL_VOID(childNode);
@ -1279,14 +1280,14 @@ void TimePickerColumnPattern::AddHotZoneRectToText()
hotZoneHegiht = (size_.Height() - middleChildHeight) / MIDDLE_CHILD_INDEX;
hotZoneOffsetY = (i == midSize - 1) ? (otherChildHeight - hotZoneHegiht) : 0;
}
} else if (size_.Height() <= (middleChildHeight + HOT_ZONE_HEIGHT_DISAPPEAR * otherChildHeight)) {
} else if (size_.Height() <= (middleChildHeight + HOT_ZONE_HEIGHT_DISAPPEAR * otherChildHeight)) {
if (i == midSize) {
hotZoneHegiht = middleChildHeight;
} else if ((i == midSize + 1) || (i == midSize - 1)) {
hotZoneHegiht = otherChildHeight;
} else if ((i == midSize + HOT_ZONE_HEIGHT_CANDIDATE) || (i == midSize - HOT_ZONE_HEIGHT_CANDIDATE)) {
hotZoneHegiht = (size_.Height() - middleChildHeight - HOT_ZONE_HEIGHT_CANDIDATE * otherChildHeight)
/ MIDDLE_CHILD_INDEX;
hotZoneHegiht = (size_.Height() - middleChildHeight - HOT_ZONE_HEIGHT_CANDIDATE * otherChildHeight) /
MIDDLE_CHILD_INDEX;
hotZoneOffsetY = (i == midSize - HOT_ZONE_HEIGHT_CANDIDATE) ? (otherChildHeight - hotZoneHegiht) : 0;
}
} else {

View File

@ -52,10 +52,11 @@ enum class RepeatType {
AUTO_FILL,
};
using Value = struct {
struct Repeat {
std::string str;
bool isRepeat = false;
};
using Value = Repeat;
double ConvertVirtualSize(const std::string& val, const DimensionUnit& unit, double size)
{

View File

@ -15,11 +15,11 @@
#include "core/event/mouse_event.h"
#include "base/log/log.h"
#include "core/accessibility/accessibility_utils.h"
#include "core/common/ace_application_info.h"
#include "core/components_ng/base/frame_node.h"
#include "core/pipeline/pipeline_base.h"
#include "base/log/log.h"
namespace OHOS::Ace {
bool HoverEventTarget::HandleHoverEvent(bool isHovered, const MouseEvent& event)
@ -28,7 +28,7 @@ bool HoverEventTarget::HandleHoverEvent(bool isHovered, const MouseEvent& event)
AccessibilityEvent event;
event.type = isHovered ? AccessibilityEventType::HOVER_ENTER_EVENT : AccessibilityEventType::HOVER_EXIT_EVENT;
auto frameNode = ElementRegister::GetInstance()->GetSpecificItemById<NG::FrameNode>(GetNodeId());
event.nodeId = frameNode ? frameNode->GetAccessibilityId(): -1;
event.nodeId = frameNode ? frameNode->GetAccessibilityId() : -1;
auto pipeline = PipelineBase::GetCurrentContext();
if (pipeline) {
pipeline->SendEventToAccessibility(event);
@ -42,9 +42,6 @@ bool HoverEventTarget::HandleHoverEvent(bool isHovered, const MouseEvent& event)
hoverInfo.SetDeviceId(event.deviceId);
hoverInfo.SetSourceDevice(event.sourceType);
onHoverEventCallback_(isHovered, hoverInfo);
if (hoverInfo.IsStopPropagation()) {
return false;
}
return true;
return !hoverInfo.IsStopPropagation();
}
}
} // namespace OHOS::Ace

View File

@ -524,8 +524,8 @@ public:
void OnFoldStatusChange(FoldStatus foldStatus) override;
// for frontend animation interface.
void OpenFrontendAnimation(const AnimationOption& option, const RefPtr<Curve>& curve,
const std::function<void()>& finishCallback);
void OpenFrontendAnimation(
const AnimationOption& option, const RefPtr<Curve>& curve, const std::function<void()>& finishCallback);
void CloseFrontendAnimation();
bool IsDragging() const override;
@ -533,8 +533,8 @@ public:
protected:
void StartWindowSizeChangeAnimate(int32_t width, int32_t height, WindowSizeChangeReason type,
const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr);
void StartWindowMaximizeAnimation(int32_t width, int32_t height,
const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr);
void StartWindowMaximizeAnimation(
int32_t width, int32_t height, const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr);
void FlushVsync(uint64_t nanoTimestamp, uint32_t frameCount) override;
void FlushPipelineWithoutAnimation() override;
@ -546,8 +546,7 @@ protected:
void OnVirtualKeyboardHeightChange(
float keyboardHeight, const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr) override;
void OnVirtualKeyboardHeightChange(
float keyboardHeight, double positionY, double height,
void OnVirtualKeyboardHeightChange(float keyboardHeight, double positionY, double height,
const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr) override;
private:
@ -608,8 +607,8 @@ private:
std::tuple<float, float, uint64_t> GetAvgPoint(const std::vector<TouchEvent>& events, const bool isScreen);
TouchEvent GetResampleTouchEvent(const std::vector<TouchEvent>& history,
const std::vector<TouchEvent>& current, const uint64_t nanoTimeStamp);
TouchEvent GetResampleTouchEvent(
const std::vector<TouchEvent>& history, const std::vector<TouchEvent>& current, const uint64_t nanoTimeStamp);
TouchEvent GetLatestPoint(const std::vector<TouchEvent>& current, const uint64_t nanoTimeStamp);

View File

@ -30,4 +30,4 @@ std::string AppBarHelper::QueryAppGalleryBundleName()
return "";
}
} // namespace OHOS::Ace
} // namespace OHOS::Ac

View File

@ -26,8 +26,10 @@ char LogWrapper::GetSeparatorCharacter()
void LogWrapper::PrintLog(LogDomain domain, LogLevel level, AceLogTag tag, const char* fmt, va_list args) {}
#ifdef ACE_INSTANCE_LOG
int32_t LogWrapper::GetId()
{
return 0;
}
#endif
} // namespace OHOS::Ace

View File

@ -13,14 +13,17 @@
* limitations under the License.
*/
#include "core/common/app_bar_helper.h"
#include "core/common/modal_ui_extension.h"
namespace OHOS::Ace {
RefPtr<NG::FrameNode> AppBarHelper::CreateUIExtensionNode(const std::string& bundleName, const std::string& abilityName,
const std::map<std::string, std::string>& params, std::function<void(int32_t)>&& onRelease)
RefPtr<NG::FrameNode> ModalUIExtension::Create(
const AAFwk::Want& /* want */, const ModalUIExtensionCallbacks& /* callbacks */)
{
return nullptr;
}
} // namespace OHOS::Ace
int32_t ModalUIExtension::GetSessionId(const RefPtr<NG::FrameNode>& /* uiExtNode */)
{
return 0;
}
} // namespace OHOS::Ace

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2021-2023 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 <string>
#include "base/log/ace_checker.h"
#include "base/log/ace_performance_check.h"
namespace OHOS::Ace {
int32_t AceChecker::pageNodes_ = 0;
int32_t AceChecker::pageDepth_ = 0;
int32_t AceChecker::nodeChildren_ = 0;
int32_t AceChecker::functionTimeout_ = 0;
int32_t AceChecker::vsyncTimeout_ = 0;
int32_t AceChecker::nodeTimeout_ = 0;
int32_t AceChecker::foreachItems_ = 0;
int32_t AceChecker::flexLayouts_ = 0;
void AceScopedPerformanceCheck::RecordPerformanceCheckData(const PerformanceCheckNodeMap& nodeMap, int64_t vsyncTimeout)
{}
AceScopedPerformanceCheck::AceScopedPerformanceCheck(const std::string& /* name */) {}
AceScopedPerformanceCheck::~AceScopedPerformanceCheck() {}
bool AceChecker::IsPerformanceCheckEnabled()
{
return false;
}
void AceChecker::NotifyCaution(const std::string& tag) {}
void AceChecker::InitPerformanceParameters() {}
} // namespace OHOS::Ace

View File

@ -0,0 +1,67 @@
/*
* Copyright (c) 2023 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 "bridge/common/utils/engine_helper.h"
namespace OHOS::Ace {
std::shared_mutex EngineHelper::mutex_;
std::unordered_map<int32_t, WeakPtr<Framework::JsEngine>> EngineHelper::engineWeakMap_;
ScopedDelegate::ScopedDelegate(const RefPtr<Framework::FrontendDelegate>& delegate, int32_t id)
: delegate_(delegate), scope_(new ContainerScope(id))
{}
ScopedDelegate::~ScopedDelegate()
{
delete scope_;
scope_ = nullptr;
}
void EngineHelper::AddEngine(int32_t id, WeakPtr<Framework::JsEngine> engine)
{
engineWeakMap_.emplace(id, engine);
}
RefPtr<Framework::JsEngine> EngineHelper::GetEngine(int32_t id)
{
return nullptr;
}
void EngineHelper::RemoveEngine(int32_t id)
{
engineWeakMap_.erase(id);
}
RefPtr<Framework::JsEngine> EngineHelper::GetCurrentEngine()
{
return nullptr;
}
ScopedDelegate EngineHelper::GetCurrentDelegate()
{
return { nullptr, 0 };
}
std::pair<int32_t, int32_t> EngineHelper::StringToPair(const std::string& match)
{
std::pair<int32_t, int32_t> res;
return res;
}
std::pair<int32_t, int32_t> EngineHelper::GetPositionOnJsCode()
{
return { 0, 0 };
}
} // namespace OHOS::Ace

View File

@ -18,7 +18,7 @@
#include "base/memory/ace_type.h"
namespace OHOS::Ace {
RefPtr<FoldableWindow> FoldableWindow::CreateFoldableWindow(int32_t)
RefPtr<FoldableWindow> FoldableWindow::CreateFoldableWindow(int32_t /* id */)
{
static RefPtr<FoldableWindow> foldablewindow = AceType::MakeRefPtr<MockFoldableWindow>();
return foldablewindow;

View File

@ -21,4 +21,4 @@ FrameTraceAdapter* FrameTraceAdapter::GetInstance()
static MockFrameTraceAdapter instance;
return &instance;
}
}
} // namespace OHOS::Ace

View File

@ -13,10 +13,9 @@
* limitations under the License.
*/
#include "base/log/ace_checker.h"
#include "base/log/ace_performance_check.h"
#include <string>
#include "base/utils/system_properties.h"
#include "bridge/common/utils/engine_helper.h"
namespace OHOS::Ace {
namespace {
@ -47,55 +46,9 @@ int32_t SystemProperties::deviceWidth_ = 720;
int32_t SystemProperties::deviceHeight_ = 1280;
bool SystemProperties::downloadByNetworkEnabled_ = false;
bool SystemProperties::traceEnabled_ = false;
int32_t AceChecker::pageNodes_ = 0;
int32_t AceChecker::pageDepth_ = 0;
int32_t AceChecker::nodeChildren_ = 0;
int32_t AceChecker::functionTimeout_ = 0;
int32_t AceChecker::vsyncTimeout_ = 0;
int32_t AceChecker::nodeTimeout_ = 0;
int32_t AceChecker::foreachItems_ = 0;
int32_t AceChecker::flexLayouts_ = 0;
// =================================================================================
// resolve compile error temporarily and wait
// for unittest cases to be integrated and modified
ScopedDelegate::ScopedDelegate(const RefPtr<Framework::FrontendDelegate>& delegate, int32_t id)
: delegate_(delegate), scope_(new ContainerScope(id))
{}
ScopedDelegate::~ScopedDelegate()
{
delete scope_;
scope_ = nullptr;
}
std::pair<int32_t, int32_t> EngineHelper::GetPositionOnJsCode()
{
return { 0, 0 };
}
ScopedDelegate EngineHelper::GetCurrentDelegate()
{
return { nullptr, 0 };
}
void AceScopedPerformanceCheck::RecordPerformanceCheckData(const PerformanceCheckNodeMap& nodeMap, int64_t vsyncTimeout)
{}
AceScopedPerformanceCheck::AceScopedPerformanceCheck(const std::string& /* name */) {}
AceScopedPerformanceCheck::~AceScopedPerformanceCheck() {}
bool AceChecker::IsPerformanceCheckEnabled()
{
return false;
}
void AceChecker::NotifyCaution(const std::string& tag) {}
void AceChecker::InitPerformanceParameters() {}
// =================================================================================
bool SystemProperties::changeTitleStyleEnabled_ = false;
int32_t SystemProperties::devicePhysicalWidth_ = 0;
int32_t SystemProperties::devicePhysicalHeight_ = 0;
float SystemProperties::GetFontWeightScale()
{
@ -143,4 +96,9 @@ bool SystemProperties::GetImageFrameworkEnabled()
{
return true;
}
std::string SystemProperties::GetCustomTitleFilePath()
{
return {};
}
} // namespace OHOS::Ace

View File

@ -13,33 +13,24 @@
* limitations under the License.
*/
#define private public
#define protected public
#include "base/memory/ace_type.h"
#include "core/components/theme/icon_theme.h"
#include "core/components/theme/theme.h"
#include "core/components/theme/theme_manager.h"
namespace OHOS::Ace {
RefPtr<IconTheme> IconTheme::Builder::Build(const RefPtr<ThemeConstants>& /* themeConstants */) const
namespace {
const std::string DEFAULT_PATH = "resource:///ohos_test_image.svg";
} // namespace
RefPtr<IconTheme> IconTheme::Builder::Build(const RefPtr<ThemeConstants>& /* themeConstants */) const
{
return nullptr;
}
void IconTheme::Builder::ParsePattern(const RefPtr<ThemeStyle>& themeStyle, const RefPtr<IconTheme>& theme) const {}
RefPtr<Theme> ThemeManager::GetTheme(ThemeType /* type */)
{
return AceType::MakeRefPtr<IconTheme>();
}
std::string IconTheme::GetIconPath(const InternalResource::ResourceId& resourceId) const
{
if (resourceId == InternalResource::ResourceId::NO_ID) {
return std::string();
return {};
}
return "resource:///ohos_test_image.svg";
return DEFAULT_PATH;
}
} // namespace OHOS::Ace

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2023 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

View File

@ -40,17 +40,13 @@ void Scrollable::StartSpringMotion(
double mainPosition, double mainVelocity, const ExtentPair& extent, const ExtentPair& initExtent)
{}
void Scrollable::UpdateScrollSnapStartOffset(double offset)
{}
void Scrollable::UpdateScrollSnapStartOffset(double offset) {}
void Scrollable::StartScrollSnapMotion(float predictSnapOffset, float scrollSnapVelocity)
{}
void Scrollable::StartScrollSnapMotion(float predictSnapOffset, float scrollSnapVelocity) {}
void Scrollable::UpdateScrollSnapEndWithOffset(double offset)
{}
void Scrollable::UpdateScrollSnapEndWithOffset(double offset) {}
void Scrollable::SetAxis(Axis axis)
{}
void Scrollable::SetAxis(Axis axis) {}
bool Scrollable::IsSpringStopped() const
{

View File

@ -1,4 +1,3 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,23 +0,0 @@
/*
* Copyright (c) 2023 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 "core/components/custom_paint/render_custom_paint.h"
namespace OHOS::Ace {
Size RenderCustomPaint::MeasureTextSize(const MeasureContext& context)
{
return Size(70.0, 40.0);
}
} // namespace OHOS::Ace::NG

View File

@ -13,10 +13,9 @@
* limitations under the License.
*/
#include "core/components_ng/pattern/ui_extension/ui_extension_model_ng.h"
#include "base/want/want_wrap.h"
#include "core/components_ng/base/frame_node.h"
#include "core/components_ng/pattern/ui_extension/ui_extension_model_ng.h"
namespace OHOS::Ace::NG {
RefPtr<FrameNode> UIExtensionModelNG::Create(const std::string& bundleName, const std::string& abilityName,
@ -34,4 +33,9 @@ void UIExtensionModelNG::SetOnResult(std::function<void(int32_t, const AAFwk::Wa
void UIExtensionModelNG::SetOnReceive(std::function<void(const AAFwk::WantParams&)>&& onReceive) {}
void UIExtensionModelNG::SetOnRemoteReady(std::function<void(const RefPtr<UIExtensionProxy>&)>&& onRemoteReady) {}
void UIExtensionModelNG::SetOnError(
std::function<void(int32_t code, const std::string& name, const std::string& message)>&& onError)
{}
} // namespace OHOS::Ace::NG

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
#include "test/mock/core/pipeline/mock_pipeline_context.h"
#include "mock_pipeline_context.h"
#include "base/utils/utils.h"
#include "core/components_ng/base/frame_node.h"
@ -79,6 +79,11 @@ RefPtr<PipelineContext> PipelineContext::GetMainPipelineContext()
return MockPipelineContext::GetCurrent();
}
RefPtr<PipelineContext> PipelineContext::GetContextByContainerId(int32_t /* containerId */)
{
return MockPipelineContext::GetCurrent();
}
void PipelineContext::AddWindowFocusChangedCallback(int32_t nodeId) {}
void PipelineContext::SetupRootElement()
@ -369,9 +374,9 @@ SafeAreaInsets PipelineContext::GetSafeArea() const
return SafeAreaInsets({}, { 0, 1 }, {}, {});
}
void PipelineContext::AddFontNodeNG(const WeakPtr<NG::UINode>& node) {}
void PipelineContext::AddFontNodeNG(const WeakPtr<UINode>& node) {}
void PipelineContext::RemoveFontNodeNG(const WeakPtr<NG::UINode>& node) {}
void PipelineContext::RemoveFontNodeNG(const WeakPtr<UINode>& node) {}
void PipelineContext::SetWindowSceneConsumed(bool isConsumed) {}
@ -385,6 +390,47 @@ bool PipelineContext::HasDifferentDirectionGesture() const
{
return false;
}
void PipelineContext::SetJSViewActive(bool active, WeakPtr<CustomNode> custom) {}
RefPtr<FrameNode> PipelineContext::FindNavigationNodeToHandleBack(const RefPtr<UINode>& node)
{
return nullptr;
}
bool PipelineContext::SetIsFocusActive(bool isFocusActive)
{
return false;
}
bool PipelineContext::NeedSoftKeyboard()
{
return false;
}
void PipelineContext::SetCursor(int32_t cursorValue) {}
void PipelineContext::RestoreDefault() {}
void PipelineContext::HandleSubwindow(bool isShow) {}
std::string PipelineContext::GetCurrentExtraInfo()
{
return std::string();
}
void PipelineContext::CloseFrontendAnimation() {}
void PipelineContext::OpenFrontendAnimation(
const AnimationOption& option, const RefPtr<Curve>& curve, const std::function<void()>& finishCallback)
{}
bool PipelineContext::IsDragging() const
{
return false;
}
void PipelineContext::SetIsDragging(bool isDragging) {}
} // namespace OHOS::Ace::NG
// pipeline_context ============================================================
@ -513,40 +559,5 @@ void PipelineBase::SetTextFieldManager(const RefPtr<ManagerInterface>& manager)
{
textFieldManager_ = manager;
}
void NG::PipelineContext::SetJSViewActive(bool active, WeakPtr<NG::CustomNode> custom) {}
RefPtr<NG::FrameNode> NG::PipelineContext::FindNavigationNodeToHandleBack(const RefPtr<NG::UINode>& node)
{
return nullptr;
}
bool NG::PipelineContext::SetIsFocusActive(bool isFocusActive)
{
return false;
}
bool NG::PipelineContext::NeedSoftKeyboard()
{
return false;
}
void NG::PipelineContext::SetCursor(int32_t cursorValue) {}
void NG::PipelineContext::RestoreDefault() {}
void NG::PipelineContext::HandleSubwindow(bool isShow) {}
std::string NG::PipelineContext::GetCurrentExtraInfo()
{
return std::string();
}
bool NG::PipelineContext::IsDragging() const
{
return false;
}
void NG::PipelineContext::SetIsDragging(bool isDragging) {}
} // namespace OHOS::Ace
// pipeline_base ===============================================================

View File

@ -16,6 +16,7 @@
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_COLOR_H
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_COLOR_H
#include <algorithm>
#include <cstdint>
#include <string>

View File

@ -16,6 +16,7 @@
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_TYPOGRAPHY_STYLE_H
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_TYPOGRAPHY_STYLE_H
#include <limits>
#include <string>
#include <vector>
@ -43,7 +44,7 @@ public:
std::u16string ellipsis;
TextAlign textAlign = TextAlign::START;
size_t maxLines = std::numeric_limits<size_t>::max();
std::string fontFamily = "";
std::string fontFamily;
#endif
};
} // namespace OHOS::Ace::Testing

View File

@ -20,6 +20,7 @@ group("unittest") {
deps = []
if (!is_asan) {
deps += [
":linux_unittest",
"base:base_unittest",
"core:core_unittest",
"interfaces:interfaces_unittest",
@ -27,6 +28,14 @@ group("unittest") {
}
}
group("linux_unittest") {
testonly = true
deps = [
"base:linux_base_unittest(${host_toolchain})",
"core:linux_core_unittest(${host_toolchain})",
]
}
config("ace_coverage_config") {
cflags = []
ldflags = []
@ -45,33 +54,32 @@ config("ace_unittest_config") {
"$root_out_dir/arkui/framework",
]
cflags_cc = []
defines = []
if (is_ohos_standard_system && !use_mingw_win && !use_mac && !use_linux) {
cflags_cc += [
"-Wno-thread-safety-attributes",
"-Wno-thread-safety-analysis",
"-Wno-non-c-typedef-for-linkage",
]
defines += [ "OHOS_STANDARD_SYSTEM" ]
}
cflags_cc = [
"-Wno-thread-safety-attributes",
"-Wno-thread-safety-analysis",
"-Wno-non-c-typedef-for-linkage",
"-fvisibility-inlines-hidden",
]
cflags = [
"-fvisibility=hidden",
"-fdata-sections",
"-ffunction-sections",
"-g",
]
cflags_cc += [ "-fvisibility-inlines-hidden" ]
ldflags = [ "-Wl,-gc-sections" ]
ldflags = [ "-Wl,--gc-sections,--as-needed" ]
if (ace_engine_feature_enable_coverage) {
cflags += [ "--coverage" ]
ldflags += [ "--coverage" ]
}
defines += [ "ACE_UNITTEST" ]
defines = [
"ACE_UNITTEST",
"OHOS_STANDARD_SYSTEM",
"ACE_INSTANCE_LOG",
]
}
# ace unittest log
@ -82,7 +90,6 @@ ohos_source_set("ace_unittest_log") {
sources = [ "$ace_root/adapter/ohos/osal/log_wrapper.cpp" ]
external_deps = [ "hilog:libhilog" ]
configs = [ ":ace_unittest_config" ]
configs += [ "$ace_root:ace_test_config" ]
}
# ace unittest trace
@ -117,6 +124,7 @@ ohos_source_set("ace_components_base") {
"$ace_root/frameworks/core/components_ng/base/view_partial_update_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/base/view_stack_processor.cpp",
]
deps = [ "$ace_root/frameworks/core/components/theme:build_theme_code" ]
configs = [ ":ace_unittest_config" ]
}
@ -142,6 +150,7 @@ ohos_source_set("ace_components_event") {
"$ace_root/frameworks/core/components_ng/event/touch_event.cpp",
]
configs = [ ":ace_unittest_config" ]
deps = [ "$ace_root/frameworks/core/components/theme:build_theme_code" ]
}
# ace components gestures
@ -171,6 +180,7 @@ ohos_source_set("ace_components_gestures") {
"$ace_root/frameworks/core/components_ng/gestures/swipe_gesture.cpp",
"$ace_root/frameworks/core/components_ng/gestures/tap_gesture.cpp",
]
deps = [ "$ace_root/frameworks/core/components/theme:build_theme_code" ]
configs = [ ":ace_unittest_config" ]
}
@ -186,6 +196,7 @@ ohos_source_set("ace_components_layout") {
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_builder.cpp",
"$ace_root/frameworks/core/components_ng/layout/layout_wrapper_node.cpp",
]
deps = [ "$ace_root/frameworks/core/components/theme:build_theme_code" ]
configs = [ ":ace_unittest_config" ]
}
@ -205,6 +216,7 @@ ohos_source_set("ace_components_property") {
"$ace_root/frameworks/core/components_ng/property/safe_area_insets.cpp",
"$ace_root/frameworks/core/components_ng/property/templates_parser.cpp",
]
deps = [ "$ace_root/frameworks/core/components/theme:build_theme_code" ]
configs = [ ":ace_unittest_config" ]
}
@ -226,6 +238,7 @@ ohos_source_set("ace_components_manager") {
"$ace_root/frameworks/core/components_ng/manager/shared_overlay/shared_overlay_manager.cpp",
"$ace_root/frameworks/core/components_ng/manager/shared_overlay/shared_transition_effect.cpp",
]
deps = [ "$ace_root/frameworks/core/components/theme:build_theme_code" ]
configs = [ ":ace_unittest_config" ]
}
@ -242,6 +255,7 @@ ohos_source_set("ace_components_syntax") {
"$ace_root/frameworks/core/components_ng/syntax/lazy_for_each_node.cpp",
"$ace_root/frameworks/core/components_ng/syntax/lazy_layout_wrapper_builder.cpp",
]
deps = [ "$ace_root/frameworks/core/components/theme:build_theme_code" ]
configs = [ ":ace_unittest_config" ]
}
@ -267,6 +281,7 @@ ohos_source_set("ace_components_render") {
"$ace_root/frameworks/core/components_ng/render/render_property.cpp",
"$ace_root/frameworks/core/components_ng/render/shape_painter.cpp",
]
deps = [ "$ace_root/frameworks/core/components/theme:build_theme_code" ]
configs = [ ":ace_unittest_config" ]
}
@ -285,6 +300,8 @@ ohos_source_set("ace_base") {
"$ace_root/frameworks/base/geometry/quaternion.cpp",
"$ace_root/frameworks/base/geometry/transform_util.cpp",
"$ace_root/frameworks/base/json/json_util.cpp",
"$ace_root/frameworks/base/json/node_object.cpp",
"$ace_root/frameworks/base/json/uobject.cpp",
"$ace_root/frameworks/base/log/dump_log.cpp",
"$ace_root/frameworks/base/memory/memory_monitor.cpp",
"$ace_root/frameworks/base/subwindow/subwindow_manager.cpp",
@ -298,8 +315,9 @@ ohos_source_set("ace_base") {
]
deps = [
"//third_party/bounds_checking_function:libsec_shared",
"//third_party/cJSON:cjson",
"$ace_root/frameworks/core/components/theme:build_theme_code",
"//third_party/bounds_checking_function:libsec_static",
"//third_party/cJSON:cjson_static",
]
configs = [ ":ace_unittest_config" ]
}
@ -326,7 +344,7 @@ ohos_source_set("ace_core_animation") {
"$ace_root/test/mock/core/animation/mock_animator.cpp",
"$ace_root/test/mock/core/animation/mock_scheduler.cpp",
]
deps = [ "$ace_root/frameworks/core/components/theme:build_theme_code" ]
configs = [ ":ace_unittest_config" ]
}
@ -337,8 +355,11 @@ ohos_source_set("ace_core_extra") {
part_name = ace_engine_part
sources = [
"$ace_root/frameworks/base/thread/background_task_executor.cpp",
"$ace_root/frameworks/core/accessibility/accessibility_node.cpp",
"$ace_root/frameworks/core/accessibility/accessibility_utils.cpp",
"$ace_root/frameworks/core/common/container_scope.cpp",
"$ace_root/frameworks/core/common/event_dump.cpp",
"$ace_root/frameworks/core/common/event_manager.cpp",
"$ace_root/frameworks/core/common/ime/text_editing_value.cpp",
"$ace_root/frameworks/core/common/ime/text_input_action.cpp",
"$ace_root/frameworks/core/common/ime/text_input_client.cpp",
@ -360,19 +381,28 @@ ohos_source_set("ace_core_extra") {
"$ace_root/frameworks/core/components/common/properties/border.cpp",
"$ace_root/frameworks/core/components/common/properties/border_edge.cpp",
"$ace_root/frameworks/core/components/common/properties/border_image.cpp",
"$ace_root/frameworks/core/components/common/properties/clip_path.cpp",
"$ace_root/frameworks/core/components/common/properties/color.cpp",
"$ace_root/frameworks/core/components/common/properties/decoration.cpp",
"$ace_root/frameworks/core/components/common/properties/shadow.cpp",
"$ace_root/frameworks/core/components/common/properties/shadow_config.cpp",
"$ace_root/frameworks/core/components/common/properties/text_style.cpp",
"$ace_root/frameworks/core/components/panel/sliding_events.cpp",
"$ace_root/frameworks/core/components/picker/picker_data.cpp",
"$ace_root/frameworks/core/components_v2/grid/grid_event.cpp",
"$ace_root/frameworks/core/components_v2/grid_layout/grid_container_utils.cpp",
"$ace_root/frameworks/core/components_v2/inspector/inspector_constants.cpp",
"$ace_root/frameworks/core/components_v2/inspector/utils.cpp",
"$ace_root/frameworks/core/event/back_end_event_manager.cpp",
"$ace_root/frameworks/core/gestures/velocity_tracker.cpp",
"$ace_root/frameworks/core/pipeline/base/constants.cpp",
"$ace_root/test/mock/core/common/mock_icon_theme.cpp",
]
deps = [
"$ace_root/frameworks/core/components/theme:build_theme_code",
"//third_party/googletest:gtest_main",
]
configs = [ ":ace_unittest_config" ]
}
@ -398,13 +428,21 @@ ohos_source_set("ace_engine_unittest_flutter_deps") {
source_set("ace_components_mock") {
testonly = true
sources = [
"$ace_root/test/mock/adapter/mock_app_bar_helper_impl.cpp",
"$ace_root/test/mock/adapter/mock_log_wrapper.cpp",
"$ace_root/test/mock/adapter/mock_modal_ui_extension.cpp",
"$ace_root/test/mock/adapter/mock_view_data_wrap_ohos.cpp",
"$ace_root/test/mock/base/mock_ace_performance_check.cpp",
"$ace_root/test/mock/base/mock_ace_trace.cpp",
"$ace_root/test/mock/base/mock_drag_window.cpp",
"$ace_root/test/mock/base/mock_engine_helper.cpp",
"$ace_root/test/mock/base/mock_event_report.cpp",
"$ace_root/test/mock/base/mock_foldable_window.cpp",
"$ace_root/test/mock/base/mock_frame_trace_adapter.cpp",
"$ace_root/test/mock/base/mock_jank_frame_report.cpp",
"$ace_root/test/mock/base/mock_localization.cpp",
"$ace_root/test/mock/base/mock_measure_util.cpp",
"$ace_root/test/mock/base/mock_mouse_style.cpp",
"$ace_root/test/mock/base/mock_observer_handler.cpp",
"$ace_root/test/mock/base/mock_pixel_map.cpp",
"$ace_root/test/mock/base/mock_ressched_report.cpp",
@ -419,25 +457,32 @@ source_set("ace_components_mock") {
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
"$ace_root/test/mock/core/common/mock_image_analyzer_mgr.cpp",
"$ace_root/test/mock/core/common/mock_interaction.cpp",
"$ace_root/test/mock/core/common/mock_motion_path_evaluator.cpp",
"$ace_root/test/mock/core/common/mock_scrollable.cpp",
"$ace_root/test/mock/core/common/mock_theme_constants.cpp",
"$ace_root/test/mock/core/common/mock_theme_utils.cpp",
"$ace_root/test/mock/core/event/mock_time_event_proxy.cpp",
"$ace_root/test/mock/core/image_provider/mock_image_cache.cpp",
"$ace_root/test/mock/core/image_provider/mock_image_loading_context.cpp",
"$ace_root/test/mock/core/image_provider/mock_image_source_info.cpp",
"$ace_root/test/mock/core/pattern/mock_container_modal_utils.cpp",
"$ace_root/test/mock/core/pipeline/mock_element_register.cpp",
"$ace_root/test/mock/core/pipeline/mock_pipeline_context.cpp",
"$ace_root/test/mock/core/render/mock_animation_utils.cpp",
"$ace_root/test/mock/core/render/mock_font_collection.cpp",
"$ace_root/test/mock/core/render/mock_media_player_creator.cpp",
"$ace_root/test/mock/core/render/mock_modifier_adapter.cpp",
"$ace_root/test/mock/core/render/mock_paragraph.cpp",
"$ace_root/test/mock/core/render/mock_path_painter.cpp",
"$ace_root/test/mock/core/render/mock_render_context_creator.cpp",
"$ace_root/test/mock/core/render/mock_render_surface_creator.cpp",
"$ace_root/test/mock/core/rosen/testing_typography_style.cpp",
"$ace_root/test/mock/interfaces/mock_ace_forward_compatibility.cpp",
"$ace_root/test/unittest/core/event/mock_scrollable.cpp",
"$ace_root/test/unittest/core/pattern/test_ng.cpp",
"$ace_root/test/unittest/core/pattern/text/mock/mock_text_layout_adapter.cpp",
]
deps = [
"$ace_root/frameworks/core/components/theme:build_theme_code",
"//foundation/arkui/napi:ace_napi",
"//third_party/googletest:gmock_main",
]
@ -529,8 +574,12 @@ ohos_source_set("ace_components_pattern") {
"$ace_root/frameworks/core/components_ng/pattern/flex/flex_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/flex/flex_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/flex/wrap_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/folder_stack/control_parts_stack_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/folder_stack/folder_stack_group_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/folder_stack/folder_stack_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/folder_stack/folder_stack_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/folder_stack/folder_stack_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/folder_stack/hover_stack_node.cpp",
"$ace_root/frameworks/core/components_ng/pattern/form_link/form_link_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/form_link/form_link_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/gauge/gauge_accessibility_property.cpp",
@ -722,7 +771,6 @@ ohos_source_set("ace_components_pattern") {
"$ace_root/frameworks/core/components_ng/pattern/refresh/refresh_pattern.cpp",
"$ace_root/frameworks/core/components_ng/pattern/relative_container/relative_container_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/relative_container/relative_container_view.cpp",
"$ace_root/frameworks/core/components_ng/pattern/rendering_context/rendering_context_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/rich_editor/paragraph_manager.cpp",
"$ace_root/frameworks/core/components_ng/pattern/rich_editor/rich_editor_content_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/rich_editor/rich_editor_controller.cpp",
@ -928,7 +976,10 @@ ohos_source_set("ace_components_pattern") {
"$ace_root/frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.cpp",
]
deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
deps = [
"$ace_root/frameworks/core/components/theme:build_theme_code",
"//third_party/bounds_checking_function:libsec_static",
]
external_deps = [ "napi:ace_napi" ]
configs = [ ":ace_unittest_config" ]
}

View File

@ -35,10 +35,7 @@ template("ace_unittest") {
ace_external_deps = []
flutter_sources = []
flutter_external_deps = []
ace_unittest_deps = [
"$ace_root/test/unittest:ace_unittest_log",
"//third_party/googletest:gmock",
]
ace_unittest_deps = [ "//third_party/googletest:gmock" ]
# temporary support
if (defined(invoker.external_deps)) {
@ -153,7 +150,7 @@ template("ace_unittest") {
"$ace_root/test/unittest:ace_core_animation",
"$ace_root/test/unittest:ace_core_extra",
]
cflags = [ "-fvisibility=hidden" ]
configs = []
configs = ace_unittest_config
@ -176,6 +173,7 @@ template("ace_unittest") {
"$ace_root/test/unittest:ace_components_event",
"$ace_root/test/unittest:ace_components_gestures",
"$ace_root/test/unittest:ace_components_layout",
"$ace_root/test/unittest:ace_components_manager",
"$ace_root/test/unittest:ace_components_pattern",
"$ace_root/test/unittest:ace_components_property",
"$ace_root/test/unittest:ace_components_render",

View File

@ -44,3 +44,11 @@ group("base_unittest") {
":util_test",
]
}
group("linux_base_unittest") {
testonly = true
deps = [
":geometry_test",
":util_test",
]
}

View File

@ -13,23 +13,23 @@
* limitations under the License.
*/
#include <memory>
#include <atomic>
#include <chrono>
#include <ctime>
#include <memory>
#include <regex>
#include <sys/time.h>
#include "gtest/gtest.h"
#include "base/log/log.h"
#include "base/utils/base_id.h"
#include "base/utils/date_util.h"
#include "base/log/log.h"
#include "base/utils/utils.h"
#include "base/utils/resource_configuration.h"
#include "base/utils/string_expression.h"
#include "base/utils/string_utils.h"
#include "base/utils/time_util.h"
#include "base/utils/utils.h"
#ifndef WINDOWS_PLATFORM
#include "securec.h"
@ -92,36 +92,10 @@ const std::u16string DEFAULT_USTRING = u"error";
const std::wstring TEST_INPUT_W_STRING = L"THIS IS A STRING";
const std::wstring DEFAULT_WSTRING = L"error";
const char TEST_INPUT_ARGS_ONE[MAX_STRING_SIZE] = "TODAY";
const std::vector<int64_t> RESOURCEHANDLERS = {255};
const std::vector<int64_t> RESOURCEHANDLERS = { 255 };
} // namespace
class BaseUtilsTest : public testing::Test {
public:
static void SetUpTestCase();
static void TearDownTestCase();
void SetUp();
void TearDown();
};
void BaseUtilsTest::SetUpTestCase()
{
GTEST_LOG_(INFO) << "BaseUtilsTest SetUpTestCase";
}
void BaseUtilsTest::TearDownTestCase()
{
GTEST_LOG_(INFO) << "BaseUtilsTest TearDownTestCase";
}
void BaseUtilsTest::SetUp()
{
GTEST_LOG_(INFO) << "BaseUtilsTest SetUp";
}
void BaseUtilsTest::TearDown()
{
GTEST_LOG_(INFO) << "BaseUtilsTest TearDown";
}
class BaseUtilsTest : public testing::Test {};
/**
* @tc.name: BaseUtilsTest001
@ -345,8 +319,9 @@ HWTEST_F(BaseUtilsTest, BaseUtilsTest009, TestSize.Level1)
HWTEST_F(BaseUtilsTest, BaseUtilsTest010, TestSize.Level1)
{
ResourceConfiguration resConfiguration;
ASSERT_EQ(resConfiguration.TestFlag(ResourceConfiguration::COLOR_MODE_UPDATED_FLAG,
ResourceConfiguration::FONT_RATIO_UPDATED_FLAG), false);
ASSERT_EQ(resConfiguration.TestFlag(
ResourceConfiguration::COLOR_MODE_UPDATED_FLAG, ResourceConfiguration::FONT_RATIO_UPDATED_FLAG),
false);
resConfiguration.SetDeviceType(DeviceType::UNKNOWN);
resConfiguration.SetOrientation(DeviceOrientation::ORIENTATION_UNDEFINED);
resConfiguration.SetDensity(CONFIGURATION_OF_DENSITY);

View File

@ -14,6 +14,7 @@
*/
#include <memory>
#include <sys/types.h>
#include "gtest/gtest.h"
@ -105,7 +106,7 @@ HWTEST_F(JsonUtilTest, JsonUtilTest003, TestSize.Level1)
EXPECT_FALSE(intValue->IsNull());
EXPECT_TRUE(intValue->IsNumber());
EXPECT_TRUE(intValue->GetInt() == intNum);
EXPECT_TRUE(intValue->GetUInt() == uintNum);
EXPECT_TRUE(intValue->GetUInt() == uintNum) << "Actual:" << intValue->GetUInt() << " Expected: " << uintNum;
EXPECT_TRUE(NearEqual(intValue->GetDouble(), doubleNum));
}

View File

@ -26,8 +26,108 @@ group("core_unittest") {
"pattern:core_pattern_unittest",
"pipeline:pipeline_context_test_ng",
"property:core_property_unittest",
"render:render_unittest",
"render:core_render_unittest",
"svg:core_svg_unittest",
"syntax:core_syntax_unittest",
]
}
group("linux_core_unittest") {
testonly = true
deps = [
"accessibility:core_accessibility_unittest",
"animation:core_animation_unittest",
"base:core_base_unittest",
"event:click_event_test_ng",
"event:drag_event_test_ng",
"event:event_hub_test_ng",
"event:focus_hub_test_ng",
"event:gesture_event_hub_test_ng",
"event:input_event_hub_test_ng",
"event:long_press_event_test_ng",
"event:pan_event_test_ng",
"event:response_ctrl_test_ng",
"event:scrollable_event_test_ng",
"event:state_style_test_ng",
"event:touch_event_test_ng",
"gestures:gestures_test_ng",
"layout:core_layout_unittest",
"manager:core_manager_unittest",
"pattern/animator:animator_test_ng",
"pattern/app_bar:app_bar_test_ng",
"pattern/badge:badge_test_ng",
"pattern/blank:blank_test_ng",
"pattern/bubble:bubble_test_ng",
"pattern/button:button_test_ng",
"pattern/calendar:calendar_test_ng",
"pattern/calendar_picker:calendar_picker_test_ng",
"pattern/checkbox:checkbox_test_ng",
"pattern/checkboxgroup:checkboxgroup_test_ng",
"pattern/common_view:common_view_test_ng",
"pattern/container_modal:container_modal_test_ng",
"pattern/counter:counter_test_ng",
"pattern/custom:custom_test_ng",
"pattern/data_panel:data_panel_test_ng",
"pattern/dialog:dialog_test_ng",
"pattern/divider:divider_test_ng",
"pattern/flex:flex_test_ng",
"pattern/gauge:gauge_test_ng",
"pattern/grid:grid_test_ng",
"pattern/grid_col:grid_col_test_ng",
"pattern/grid_container:grid_container_test_ng",
"pattern/grid_row:grid_row_test_ng",
"pattern/hyperlink:hyperlink_test_ng",
"pattern/image:image_test_ng",
"pattern/image_animator:image_animator_test_ng",
"pattern/indexer:indexer_test_ng",
"pattern/linear_layout:linear_layout_test_ng",
"pattern/linear_split:linear_split_test_ng",
"pattern/list:list_test_ng",
"pattern/loading_progress:loading_progress_test_ng",
"pattern/marquee:marquee_test_ng",
"pattern/menu:menu_test_ng",
"pattern/navigation:navigation_test_ng",
"pattern/navigator:navigator_test_ng",
"pattern/navrouter:navrouter_test_ng",
"pattern/option:option_test_ng",
"pattern/overlay:overlay_manager_test_ng",
"pattern/panel:panel_test_ng",
"pattern/patternlock:patternlock_test_ng",
"pattern/picker:date_picker_test_ng",
"pattern/progress:progress_test_ng",
"pattern/qrcode:qrcode_test_ng",
"pattern/radio:radio_test_ng",
"pattern/rating:rating_test_ng",
"pattern/recycle_node:recycle_node_test_ng",
"pattern/refresh:refresh_test_ng",
"pattern/relative_container:relative_container_test_ng",
"pattern/rich_editor:rich_editor_test_ng",
"pattern/scroll:scroll_test_ng",
"pattern/scroll_bar:scroll_bar_test_ng",
"pattern/scrollable:scrollable_test_ng",
"pattern/search:search_test_ng",
"pattern/select:select_test_ng",
"pattern/select_overlay:select_overlay_test_ng",
"pattern/side_bar:side_bar_test_ng",
"pattern/slider:slider_test_ng",
"pattern/stack:stack_test_ng",
"pattern/stage:stage_test_ng",
"pattern/stepper:stepper_test_ng",
"pattern/swiper:swiper_test_ng",
"pattern/tabs:tabs_test_ng",
"pattern/text:text_test_ng",
"pattern/text_clock:text_clock_test_ng",
"pattern/text_drag:text_drag_test_ng",
"pattern/text_input:TextInputTest",
"pattern/text_picker:text_picker_test_ng",
"pattern/text_timer:text_timer_test_ng",
"pattern/time_picker:time_picker_test_ng",
"pattern/toggle:toggle_test_ng",
"pattern/video:video_test_ng",
"pattern/waterflow:water_flow_test_ng",
"pattern/xcomponent:xcomponent_test_ng",
"property:core_property_unittest",
"render:core_render_unittest",
"syntax:core_syntax_unittest",
]
}

View File

@ -17,8 +17,6 @@ ace_unittest("accessibility_test_ng") {
type = "new"
module_output = "basic"
sources = [
"$ace_root/frameworks/core/accessibility/accessibility_node.cpp",
"$ace_root/frameworks/core/accessibility/accessibility_utils.cpp",
"accessibility_node_test_ng.cpp",
"accessibility_utils_test_ng.cpp",
]

View File

@ -22,11 +22,7 @@ ace_unittest("view_stack_processor_test_ng") {
ace_unittest("distributed_ui_test_ng") {
type = "new"
module_output = "basic"
sources = [
"$ace_root/frameworks/base/json/node_object.cpp",
"$ace_root/frameworks/base/json/uobject.cpp",
"distributed_ui_test_ng.cpp",
]
sources = [ "distributed_ui_test_ng.cpp" ]
}
ace_unittest("frame_node_test_ng") {
@ -56,11 +52,7 @@ ace_unittest("ui_node_test_ng") {
ace_unittest("view_abstract_test_ng") {
type = "new"
module_output = "basic"
sources = [
"$ace_root/frameworks/core/common/event_manager.cpp",
"$ace_root/frameworks/core/pipeline/base/element.cpp",
"view_abstract_test_ng.cpp",
]
sources = [ "view_abstract_test_ng.cpp" ]
}
ace_unittest("view_full_update_model_ng_test") {
@ -78,10 +70,7 @@ ace_unittest("view_partial_update_model_test_ng") {
ace_unittest("observer_test_ng") {
type = "new"
module_output = "basic"
sources = [
"$ace_root/test/mock/base/mock_mouse_style.cpp",
"observer_test_ng.cpp",
]
sources = [ "observer_test_ng.cpp" ]
}
group("core_base_unittest") {

View File

@ -24,7 +24,6 @@
#define protected public
#define private public
#include "interfaces/inner_api/ace/ui_content.h"
#include "test/mock/base/mock_task_executor.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"

View File

@ -18,7 +18,6 @@ ace_unittest("event_manager_test_ng") {
flutter_skia = true
render = true
sources = [
"$ace_root/frameworks/core/common/event_manager.cpp",
"$ace_root/frameworks/core/event/key_event.cpp",
"$ace_root/frameworks/core/event/mouse_event.cpp",
"$ace_root/frameworks/core/gestures/gesture_referee.cpp",

View File

@ -13,15 +13,17 @@
* limitations under the License.
*/
#include "gtest/gtest.h"
#define private public
#define protected public
#include "gtest/gtest.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
#include "base/memory/ace_type.h"
#include "base/memory/referenced.h"
#include "core/components_ng/event/drag_event.h"
#include "core/components_ng/event/event_hub.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
using namespace testing;
using namespace testing::ext;

View File

@ -16,8 +16,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("gestures_test_ng") {
type = "new"
module_output = "gestures"
sources = [
"$ace_root/frameworks/core/common/event_manager.cpp",
"gestures_test_ng.cpp",
]
sources = [ "gestures_test_ng.cpp" ]
}

View File

@ -26,6 +26,8 @@ ohos_unittest("image_provider_test_ng") {
"$ace_root/frameworks/core/components_ng/image_provider/pixel_map_image_object.cpp",
"$ace_root/frameworks/core/components_ng/image_provider/static_image_object.cpp",
"$ace_root/frameworks/core/components_ng/image_provider/svg_image_object.cpp",
"$ace_root/test/mock/base/mock_ace_performance_check.cpp",
"$ace_root/test/mock/base/mock_engine_helper.cpp",
"$ace_root/test/mock/base/mock_frame_trace_adapter.cpp",
"$ace_root/test/mock/base/mock_localization.cpp",
"$ace_root/test/mock/base/mock_ressched_report.cpp",
@ -33,6 +35,7 @@ ohos_unittest("image_provider_test_ng") {
"$ace_root/test/mock/base/mock_system_properties.cpp",
"$ace_root/test/mock/core/common/mock_ace_application_info.cpp",
"$ace_root/test/mock/core/common/mock_container.cpp",
"$ace_root/test/mock/core/common/mock_scrollable.cpp",
"$ace_root/test/mock/core/image_provider/mock_image_cache.cpp",
"$ace_root/test/mock/core/image_provider/mock_image_decoder.cpp",
"$ace_root/test/mock/core/image_provider/mock_image_loader.cpp",
@ -49,7 +52,6 @@ ohos_unittest("image_provider_test_ng") {
"$ace_root/test/mock/core/render/mock_render_surface_creator.cpp",
"$ace_root/test/mock/core/render/mock_skia_image.cpp",
"$ace_root/test/mock/core/render/mock_svg_canvas_image.cpp",
"$ace_root/test/unittest/core/event/mock_scrollable.cpp",
"image_provider_test_ng.cpp",
]

View File

@ -1,4 +1,4 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Copyright (c) 2022-2023 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
@ -16,10 +16,7 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("drag_drop_manager_test_ng") {
type = "new"
module_output = "manager"
sources = [
"$ace_root/frameworks/core/components_v2/grid/grid_event.cpp",
"drag_drop_manager_test_ng.cpp",
]
sources = [ "drag_drop_manager_test_ng.cpp" ]
}
ace_unittest("drag_drop_proxy_test_ng") {
@ -49,10 +46,7 @@ ace_unittest("select_overlay_proxy_test_ng") {
ace_unittest("shared_overlay_manager_test_ng") {
type = "new"
module_output = "manager"
sources = [
"$ace_root/frameworks/core/components/common/properties/test/mock/mock_motion_path_evaluator.cpp",
"shared_overlay_manager_test_ng.cpp",
]
sources = [ "shared_overlay_manager_test_ng.cpp" ]
}
group("core_manager_unittest") {

View File

@ -14,12 +14,14 @@
*/
#include <optional>
#include "gtest/gtest.h"
#define private public
#define protected public
#include "gtest/gtest.h"
#include "test/mock/base/mock_task_executor.h"
#include "test/mock/core/common/mock_container.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
#include "base/geometry/ng/offset_t.h"
#include "base/geometry/ng/size_t.h"
@ -31,7 +33,6 @@
#include "core/components_ng/pattern/pattern.h"
#include "core/components_ng/pattern/text/text_pattern.h"
#include "core/components_ng/property/property.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
using namespace testing;
using namespace testing::ext;

View File

@ -14,16 +14,20 @@
*/
#include <optional>
#include "gtest/gtest.h"
#define private public
#define protected public
#include "gtest/gtest.h"
#include "test/mock/base/mock_task_executor.h"
#include "test/mock/core/common/mock_container.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
#include "base/geometry/ng/offset_t.h"
#include "base/geometry/ng/rect_t.h"
#include "base/geometry/ng/size_t.h"
#include "base/memory/ace_type.h"
#include "core/common/container.h"
#include "core/components_ng/base/frame_node.h"
#include "core/components_ng/base/geometry_node.h"
#include "core/components_ng/manager/select_overlay/select_overlay_manager.h"
@ -31,8 +35,6 @@
#include "core/components_ng/pattern/pattern.h"
#include "core/components_ng/pattern/select_overlay/select_overlay_pattern.h"
#include "core/components_ng/pattern/select_overlay/select_overlay_property.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
#include "core/common/container.h"
using namespace testing;
using namespace testing::ext;

View File

@ -64,21 +64,20 @@ group("core_pattern_unittest") {
"recycle_node:recycle_node_test_ng",
"refresh:refresh_test_ng",
"relative_container:relative_container_test_ng",
"remote_window:remote_window_test_ng",
"rich_editor:rich_editor_test_ng",
"scroll:scroll_test_ng",
"scroll_bar:scroll_bar_test_ng",
"scrollable:scrollable_test_ng",
"search:search_test_ng",
"security_component:security_component_test_ng",
"select:select_pattern_test_ng",
"select:select_test_ng",
"select_overlay:select_overlay_test_ng",
"shape:shape_test_ng",
"side_bar:side_bar_pattern_test_ng",
"side_bar:side_bar_test_ng",
"slider:slider_test_ng",
"stack:stack_test_ng",
"stage:stage_test_ng",
"stepper:stepper_pattern_test_ng",
"stepper:stepper_test_ng",
"swiper:swiper_test_ng",
"tabs:tabs_test_ng",
"text:text_test_ng",
@ -93,7 +92,5 @@ group("core_pattern_unittest") {
"waterflow:water_flow_test_ng",
"web:web_pattern_unit_test",
"xcomponent:xcomponent_test_ng",
# "plugin:plugin_pattern_test_ng",
]
}

View File

@ -15,9 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("animator_test_ng") {
type = "new"
sources = [
"$ace_root/frameworks/bridge/declarative_frontend/declarative_frontend.cpp",
"animator_test_ng.cpp",
"mock_jsi_animator_model_ng_impl.cpp",
]
sources = [ "animator_test_ng.cpp" ]
}

View File

@ -19,37 +19,25 @@
#include "gtest/gtest.h"
#define private public
#define protected public
#include "base/geometry/dimension.h"
#include "base/memory/ace_type.h"
#include "base/memory/referenced.h"
#include "core/components_ng/base/view_stack_processor.h"
#include "core/components_ng/pattern/animator/animator_model_ng.h"
using namespace testing;
using namespace testing::ext;
using namespace OHOS::Ace::Framework;
namespace OHOS::Ace::Framework {
void AnimatorModelNG::Create(const std::string& animatorId) {}
RefPtr<AnimatorInfo> AnimatorModelNG::GetAnimatorInfo(const std::string& animatorId)
{
auto animatorInfo = AceType::MakeRefPtr<AnimatorInfo>();
auto animator = AceType::MakeRefPtr<Animator>();
animatorInfo->SetAnimator(animator);
return animatorInfo;
}
} // namespace OHOS::Ace::Framework
namespace OHOS::Ace::NG {
namespace {
} // namespace
class AnimatorTestNg : public testing::Test {
public:
static void SetUpTestSuite();
static void TearDownTestSuite();
void SetUp() override;
void TearDown() override;
};
void AnimatorTestNg::SetUpTestSuite() {}
void AnimatorTestNg::TearDownTestSuite() {}
void AnimatorTestNg::SetUp() {}
void AnimatorTestNg::TearDown() {}
class AnimatorTestNg : public testing::Test {};
/**
* @tc.name: Test001
@ -58,21 +46,21 @@ void AnimatorTestNg::TearDown() {}
*/
HWTEST_F(AnimatorTestNg, Test001, TestSize.Level1)
{
AnimatorModelNG aimatorModel;
aimatorModel.AddEventListener(nullptr, EventOperation::START, "-1");
aimatorModel.AddEventListener(nullptr, EventOperation::PAUSE, "-1");
aimatorModel.AddEventListener(nullptr, EventOperation::REPEAT, "-1");
aimatorModel.AddEventListener(nullptr, EventOperation::CANCEL, "-1");
aimatorModel.AddEventListener(nullptr, EventOperation::FINISH, "-1");
aimatorModel.AddEventListener(nullptr, EventOperation::NONE, "-1");
Framework::AnimatorModelNG aimatorModel;
aimatorModel.AddEventListener(nullptr, Framework::EventOperation::START, "-1");
aimatorModel.AddEventListener(nullptr, Framework::EventOperation::PAUSE, "-1");
aimatorModel.AddEventListener(nullptr, Framework::EventOperation::REPEAT, "-1");
aimatorModel.AddEventListener(nullptr, Framework::EventOperation::CANCEL, "-1");
aimatorModel.AddEventListener(nullptr, Framework::EventOperation::FINISH, "-1");
aimatorModel.AddEventListener(nullptr, Framework::EventOperation::NONE, "-1");
auto event = []() {};
aimatorModel.AddEventListener(event, EventOperation::START, "-1");
aimatorModel.AddEventListener(event, EventOperation::PAUSE, "-1");
aimatorModel.AddEventListener(event, EventOperation::REPEAT, "-1");
aimatorModel.AddEventListener(event, EventOperation::CANCEL, "-1");
aimatorModel.AddEventListener(event, EventOperation::FINISH, "-1");
aimatorModel.AddEventListener(event, EventOperation::NONE, "-1");
aimatorModel.AddEventListener(event, Framework::EventOperation::START, "-1");
aimatorModel.AddEventListener(event, Framework::EventOperation::PAUSE, "-1");
aimatorModel.AddEventListener(event, Framework::EventOperation::REPEAT, "-1");
aimatorModel.AddEventListener(event, Framework::EventOperation::CANCEL, "-1");
aimatorModel.AddEventListener(event, Framework::EventOperation::FINISH, "-1");
aimatorModel.AddEventListener(event, Framework::EventOperation::NONE, "-1");
EXPECT_TRUE(true);
}

View File

@ -1,31 +0,0 @@
/*
* Copyright (c) 2023 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 "core/components_ng/pattern/animator/animator_model_ng.h"
namespace OHOS::Ace::Framework {
namespace {
} // namespace
void AnimatorModelNG::Create(const std::string& animatorId) {}
RefPtr<AnimatorInfo> AnimatorModelNG::GetAnimatorInfo(const std::string& animatorId)
{
auto animatorInfo = AceType::MakeRefPtr<AnimatorInfo>();
auto animator = AceType::MakeRefPtr<Animator>();
animatorInfo->SetAnimator(animator);
return animatorInfo;
}
} // namespace OHOS::Ace::Framework

View File

@ -16,8 +16,6 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("app_bar_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/adapter/mock_app_bar_helper_impl.cpp",
"$ace_root/test/mock/core/common/mock_theme_constants.cpp",
"$ace_root/test/mock/core/pattern/mock_ui_extension_model_ng.cpp",
"app_bar_test_ng.cpp",
]

View File

@ -36,7 +36,6 @@
#include "core/components_ng/pattern/text/text_layout_property.h"
#include "core/components_ng/property/calc_length.h"
using namespace testing;
using namespace testing::ext;
@ -47,8 +46,6 @@ class AppBarTestNg : public testing::Test {
public:
static void SetUpTestSuite();
static void TearDownTestSuite();
void SetUp() override;
void TearDown() override;
void ClickBtn(RefPtr<FrameNode> frameNode);
};
@ -67,10 +64,6 @@ void AppBarTestNg::TearDownTestSuite()
MockPipelineContext::TearDown();
}
void AppBarTestNg::SetUp() {}
void AppBarTestNg::TearDown() {}
void AppBarTestNg::ClickBtn(RefPtr<FrameNode> frameNode)
{
auto eventHub = frameNode->GetOrCreateGestureEventHub();

View File

@ -20,21 +20,21 @@
#define private public
#define protected public
#include "bridge/declarative_frontend/view_stack_processor.h"
#include "core/components/common/layout/constants.h"
#include "core/components_ng/base/view_stack_processor.h"
#include "core/components_ng/pattern/linear_layout/linear_layout_pattern.h"
#include "core/components_ng/pattern/text/text_pattern.h"
#include "test/mock/core/common/mock_theme_manager.h"
#include "core/components_v2/inspector/inspector_constants.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
#include "core/components/badge/badge_theme.h"
#include "core/components/common/layout/constants.h"
#include "core/components_ng/base/frame_node.h"
#include "core/components_ng/base/view_stack_processor.h"
#include "core/components_ng/pattern/badge/badge_layout_algorithm.h"
#include "core/components_ng/pattern/badge/badge_layout_property.h"
#include "core/components_ng/pattern/badge/badge_model_ng.h"
#include "core/components_ng/pattern/badge/badge_pattern.h"
#include "core/components_ng/pattern/linear_layout/linear_layout_pattern.h"
#include "core/components_ng/pattern/text/text_layout_property.h"
#include "core/components_ng/pattern/text/text_pattern.h"
#include "core/components_v2/inspector/inspector_constants.h"
#undef private
#undef protected
@ -79,6 +79,7 @@ public:
protected:
std::pair<RefPtr<FrameNode>, RefPtr<LayoutWrapperNode>> CreateChild(const LayoutConstraintF& childLayoutConstraint);
};
void BadgeTestNg::SetUp()
{
MockPipelineContext::SetUp();

View File

@ -14,7 +14,6 @@
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("calendar_test_ng") {
flutter_skia = true
type = "new"
sources = [ "calendar_test_ng.cpp" ]
}

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2023 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.
@ -24,6 +24,9 @@
#define protected public
#include "test/mock/base/mock_task_executor.h"
#include "test/mock/core/common/mock_theme_manager.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
#include "test/mock/core/render/mock_render_context.h"
#include "base/geometry/axis.h"
#include "base/geometry/dimension.h"
@ -61,11 +64,8 @@
#include "core/components_ng/pattern/text/text_pattern.h"
#include "core/components_ng/pattern/text_field/text_field_pattern.h"
#include "core/components_ng/property/measure_property.h"
#include "test/mock/core/render/mock_render_context.h"
#include "test/mock/core/common/mock_theme_manager.h"
#include "core/components_v2/inspector/inspector_constants.h"
#include "core/pipeline/base/element_register.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
#include "core/pipeline_ng/ui_task_scheduler.h"
#undef private
@ -94,18 +94,17 @@ void CalendarPickerTestNg::SetUpTestCase()
{
MockPipelineContext::SetUp();
auto themeManager = AceType::MakeRefPtr<MockThemeManager>();
EXPECT_CALL(*themeManager, GetTheme(_))
.WillRepeatedly([](ThemeType type) -> RefPtr<Theme> {
if (type == CalendarTheme::TypeId()) {
return AceType::MakeRefPtr<CalendarTheme>();
} else if (type == IconTheme::TypeId()) {
return AceType::MakeRefPtr<IconTheme>();
} else if (type == DialogTheme::TypeId()) {
return AceType::MakeRefPtr<DialogTheme>();
} else {
return AceType::MakeRefPtr<PickerTheme>();
}
});
EXPECT_CALL(*themeManager, GetTheme(_)).WillRepeatedly([](ThemeType type) -> RefPtr<Theme> {
if (type == CalendarTheme::TypeId()) {
return AceType::MakeRefPtr<CalendarTheme>();
} else if (type == IconTheme::TypeId()) {
return AceType::MakeRefPtr<IconTheme>();
} else if (type == DialogTheme::TypeId()) {
return AceType::MakeRefPtr<DialogTheme>();
} else {
return AceType::MakeRefPtr<PickerTheme>();
}
});
MockPipelineContext::GetCurrent()->SetThemeManager(themeManager);
}
@ -220,8 +219,8 @@ HWTEST_F(CalendarPickerTestNg, CalendarPickerModelNGTest001, TestSize.Level1)
auto textRenderContext = textFrameNode->GetRenderContext();
ASSERT_NE(textRenderContext, nullptr);
EXPECT_EQ(textRenderContext->GetBackgroundColorValue().ColorToString(),
theme->GetBackgroundHoverColor().ColorToString());
EXPECT_EQ(
textRenderContext->GetBackgroundColorValue().ColorToString(), theme->GetBackgroundHoverColor().ColorToString());
}
/**

View File

@ -21,6 +21,7 @@
#define protected public
#include "test/mock/core/common/mock_container.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
#include "base/memory/ace_type.h"
#include "base/memory/referenced.h"
@ -31,7 +32,6 @@
#include "core/components_ng/pattern/custom_paint/custom_paint_paint_method.h"
#include "core/components_ng/pattern/custom_paint/offscreen_canvas_paint_method.h"
#include "core/components_ng/pattern/custom_paint/offscreen_canvas_pattern.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
using namespace testing;
using namespace testing::ext;

View File

@ -15,10 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("container_modal_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/core/common/mock_theme_constants.cpp",
"$ace_root/test/mock/core/common/mock_theme_utils.cpp",
"container_modal_test_ng.cpp",
"mock_container_modal_utils.cpp",
]
sources = [ "container_modal_test_ng.cpp" ]
}

View File

@ -40,9 +40,6 @@
using namespace testing;
using namespace testing::ext;
namespace OHOS::Ace {
bool SystemProperties::changeTitleStyleEnabled_ = false;
}
namespace OHOS::Ace::NG {
namespace {
constexpr double MOUSE_MOVE_POPUP_DISTANCE = 5.0; // 5.0px

View File

@ -14,8 +14,6 @@
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("dialog_test_ng") {
flutter_skia = true
render = true
type = "new"
sources = [ "dialog_test_ng.cpp" ]
}

View File

@ -19,6 +19,11 @@
#define private public
#define protected public
#include "test/mock/core/common/mock_theme_manager.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
#include "test/mock/core/rosen/mock_canvas.h"
#include "test/mock/core/rosen/testing_canvas.h"
#include "base/geometry/offset.h"
#include "base/log/log_wrapper.h"
#include "core/components/progress/progress_theme.h"
@ -32,10 +37,6 @@
#include "core/components_ng/pattern/gauge/gauge_pattern.h"
#include "core/components_ng/pattern/image/image_pattern.h"
#include "core/components_ng/pattern/text/text_pattern.h"
#include "test/mock/core/rosen/mock_canvas.h"
#include "test/mock/core/rosen/testing_canvas.h"
#include "test/mock/core/common/mock_theme_manager.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
using namespace testing;
using namespace testing::ext;

View File

@ -19,7 +19,6 @@ ace_unittest("grid_test_ng") {
"$ace_root/frameworks/bridge/common/dom/dom_type.cpp",
"$ace_root/frameworks/bridge/common/utils/utils.cpp",
"$ace_root/frameworks/bridge/js_frontend/engine/common/js_constants.cpp",
"$ace_root/frameworks/core/components_v2/grid/grid_event.cpp",
"grid_attr_test_ng.cpp",
"grid_common_test_ng.cpp",
"grid_layout_test_ng.cpp",

View File

@ -15,8 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("grid_row_test_ng") {
type = "new"
sources = [
"$ace_root/frameworks/core/components_v2/grid_layout/grid_container_utils.cpp",
"grid_row_test_ng.cpp",
]
sources = [ "grid_row_test_ng.cpp" ]
}

View File

@ -15,13 +15,15 @@
#include <optional>
#include "gtest/gtest.h"
#define private public
#define protected public
#include "gtest/gtest.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
#include "base/memory/ace_type.h"
#include "base/geometry/dimension.h"
#include "base/memory/ace_type.h"
#include "base/memory/referenced.h"
#include "core/components_ng/base/view_stack_processor.h"
#include "core/components_ng/layout/layout_property.h"
@ -29,7 +31,6 @@
#include "core/components_ng/pattern/grid_col/grid_col_model_ng.h"
#include "core/components_ng/pattern/grid_row/grid_row_layout_pattern.h"
#include "core/components_ng/pattern/grid_row/grid_row_model_ng.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
using namespace testing;
using namespace testing::ext;
@ -169,9 +170,8 @@ testing::AssertionResult GridRowTestNg::TestGridColGeometry(
if (secondColOffset == expectOffset) {
return testing::AssertionSuccess();
}
return testing::AssertionFailure() <<
"secondColOffset: " << secondColOffset.ToString() <<
" But expect offset: " << expectOffset.ToString();
return testing::AssertionFailure() << "secondColOffset: " << secondColOffset.ToString()
<< " But expect offset: " << expectOffset.ToString();
}
OffsetF GridRowTestNg::GetColOffset(RefPtr<LayoutWrapperNode>& layoutWrapper, int32_t index)

View File

@ -14,8 +14,6 @@
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("indexer_test_ng") {
render = true
flutter_skia = true
type = "new"
sources = [ "indexer_test_ng.cpp" ]
}

View File

@ -21,6 +21,11 @@
#define protected public
#define private public
#include "test/mock/core/common/mock_theme_manager.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
#include "test/mock/core/render/mock_paragraph.h"
#include "test/unittest/core/pattern/test_ng.h"
#include "base/memory/ace_type.h"
#include "base/memory/referenced.h"
#include "core/components_ng/base/view_stack_processor.h"
@ -32,10 +37,7 @@
#include "core/components_ng/pattern/indexer/indexer_theme.h"
#include "core/components_ng/pattern/linear_layout/linear_layout_property.h"
#include "core/components_ng/pattern/text/text_layout_property.h"
#include "test/mock/core/common/mock_theme_manager.h"
#include "test/unittest/core/pattern/test_ng.h"
#include "core/pipeline_ng/pipeline_context.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
using namespace testing;
using namespace testing::ext;
@ -116,8 +118,8 @@ void IndexerTestNg::GetInstance()
accessibilityProperty_ = frameNode_->GetAccessibilityProperty<IndexerAccessibilityProperty>();
}
void IndexerTestNg::Create(const std::function<void(IndexerModelNG)>& callback,
std::vector<std::string> arrayValue, int32_t selected)
void IndexerTestNg::Create(
const std::function<void(IndexerModelNG)>& callback, std::vector<std::string> arrayValue, int32_t selected)
{
IndexerModelNG model;
model.Create(arrayValue, selected);
@ -543,12 +545,14 @@ HWTEST_F(IndexerTestNg, IndexerPattern001, TestSize.Level1)
*/
HWTEST_F(IndexerTestNg, IndexerPattern002, TestSize.Level1)
{
Create([](IndexerModelNG model) {
model.SetUsingPopup(true);
model.SetAlignStyle(0);
model.SetPopupUnselectedColor(Color(0x00000000));
model.SetOnRequestPopupData(GetPopupData);
}, CREATE_ARRAY, 2);
Create(
[](IndexerModelNG model) {
model.SetUsingPopup(true);
model.SetAlignStyle(0);
model.SetPopupUnselectedColor(Color(0x00000000));
model.SetOnRequestPopupData(GetPopupData);
},
CREATE_ARRAY, 2);
pattern_->MoveIndexByStep(1);
ASSERT_NE(pattern_->popupNode_, nullptr);
@ -568,11 +572,13 @@ HWTEST_F(IndexerTestNg, IndexerPattern002, TestSize.Level1)
*/
HWTEST_F(IndexerTestNg, IndexerPattern003, TestSize.Level1)
{
Create([](IndexerModelNG model) {
model.SetUsingPopup(true);
model.SetPopupHorizontalSpace(Dimension(50));
model.SetOnRequestPopupData(GetPopupData);
}, CREATE_ARRAY, 2);
Create(
[](IndexerModelNG model) {
model.SetUsingPopup(true);
model.SetPopupHorizontalSpace(Dimension(50));
model.SetOnRequestPopupData(GetPopupData);
},
CREATE_ARRAY, 2);
pattern_->MoveIndexByStep(1);
ASSERT_NE(pattern_->popupNode_, nullptr);
@ -580,12 +586,14 @@ HWTEST_F(IndexerTestNg, IndexerPattern003, TestSize.Level1)
ASSERT_NE(renderContext, nullptr);
auto rightValue = renderContext->GetPosition().value();
Create([](IndexerModelNG model) {
model.SetUsingPopup(true);
model.SetAlignStyle(0);
model.SetPopupHorizontalSpace(Dimension(50));
model.SetOnRequestPopupData(GetPopupData);
}, CREATE_ARRAY, 2);
Create(
[](IndexerModelNG model) {
model.SetUsingPopup(true);
model.SetAlignStyle(0);
model.SetPopupHorizontalSpace(Dimension(50));
model.SetOnRequestPopupData(GetPopupData);
},
CREATE_ARRAY, 2);
pattern_->MoveIndexByStep(1);
ASSERT_NE(pattern_->popupNode_, nullptr);
@ -602,13 +610,15 @@ HWTEST_F(IndexerTestNg, IndexerPattern003, TestSize.Level1)
*/
HWTEST_F(IndexerTestNg, IndexerPattern004, TestSize.Level1)
{
Create([](IndexerModelNG model) {
model.SetUsingPopup(true);
model.SetPopupSelectedColor(Color(0x00000000));
model.SetPopupUnselectedColor(Color(0x00000000));
model.SetPopupItemBackground(Color(0x00000000));
model.SetOnRequestPopupData(GetPopupData);
}, CREATE_ARRAY, 2);
Create(
[](IndexerModelNG model) {
model.SetUsingPopup(true);
model.SetPopupSelectedColor(Color(0x00000000));
model.SetPopupUnselectedColor(Color(0x00000000));
model.SetPopupItemBackground(Color(0x00000000));
model.SetOnRequestPopupData(GetPopupData);
},
CREATE_ARRAY, 2);
pattern_->MoveIndexByStep(1);
ASSERT_NE(pattern_->popupNode_, nullptr);
@ -729,7 +739,7 @@ HWTEST_F(IndexerTestNg, IndexerPopupTouchDown001, TestSize.Level1)
* @tc.steps: step1. ShowBubble
*/
Create([](IndexerModelNG model) { model.SetUsingPopup(true); }); // NeedShowPopupView is true.
pattern_->MoveIndexByStep(1); // ShowBubble
pattern_->MoveIndexByStep(1); // ShowBubble
ASSERT_NE(pattern_->popupNode_, nullptr);
auto gesture = pattern_->popupNode_->GetOrCreateGestureEventHub();
auto onPopupTouchDown = gesture->touchEventActuator_->touchEvents_.front()->GetTouchEventCallback();
@ -760,12 +770,14 @@ HWTEST_F(IndexerTestNg, IndexerPopupTouchDown001, TestSize.Level1)
HWTEST_F(IndexerTestNg, Event001, TestSize.Level1)
{
bool isTrigger = false;
Create([&isTrigger](IndexerModelNG model) {
model.SetUsingPopup(true);
model.SetOnRequestPopupData(GetPopupData);
OnPopupSelectedEvent event = [&isTrigger](int32_t) { isTrigger = true; };
model.SetOnPopupSelected(std::move(event));
}, CREATE_ARRAY, 2);
Create(
[&isTrigger](IndexerModelNG model) {
model.SetUsingPopup(true);
model.SetOnRequestPopupData(GetPopupData);
OnPopupSelectedEvent event = [&isTrigger](int32_t) { isTrigger = true; };
model.SetOnPopupSelected(std::move(event));
},
CREATE_ARRAY, 2);
/**
* @tc.steps: step1. Trigger OnPopupSelected callback.

View File

@ -14,7 +14,6 @@
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("list_test_ng") {
render = true
type = "new"
sources = [
"$ace_root/frameworks/bridge/common/dom/dom_type.cpp",

View File

@ -269,8 +269,8 @@ void ListTestNg::CreateWithSwipeAction(
ViewAbstract::SetHeight(CalcLength(ITEM_HEIGHT));
itemModel.SetSwiperAction(nullptr, nullptr, std::move(onOffsetChange), effect);
itemModel.SetDeleteArea(std::move(item.builderAction), std::move(item.onDelete),
std::move(item.onEnterDeleteArea), std::move(item.onExitDeleteArea),
std::move(item.onStateChange), item.actionAreaDistance, isStartArea);
std::move(item.onEnterDeleteArea), std::move(item.onExitDeleteArea), std::move(item.onStateChange),
item.actionAreaDistance, isStartArea);
{
RowModelNG rowModel;
rowModel.Create(std::nullopt, nullptr, "");
@ -5341,9 +5341,7 @@ HWTEST_F(ListTestNg, ScrollToIndex003, TestSize.Level1)
*/
HWTEST_F(ListTestNg, ScrollToItemInGroup001, TestSize.Level1)
{
Create([](ListModelNG listModelNG) {
CreateGroup(GROUP_NUMBER);
});
Create([](ListModelNG listModelNG) { CreateGroup(GROUP_NUMBER); });
constexpr int32_t indexInGroup = 2;
/**
@ -5403,9 +5401,7 @@ HWTEST_F(ListTestNg, ScrollToItemInGroup001, TestSize.Level1)
*/
HWTEST_F(ListTestNg, ScrollToItemInGroup002, TestSize.Level1)
{
Create([](ListModelNG listModelNG) {
CreateGroup(GROUP_NUMBER);
});
Create([](ListModelNG listModelNG) { CreateGroup(GROUP_NUMBER); });
constexpr int32_t indexInGroup = 2;
/**
@ -6252,8 +6248,8 @@ HWTEST_F(ListTestNg, ListPattern_GetItemRect001, TestSize.Level1)
* @tc.steps: step4. Get valid ListItem Rect.
* @tc.expected: Return actual Rect when input valid index.
*/
EXPECT_TRUE(IsEqual(
pattern_->GetItemRect(1), Rect(0, -ITEM_HEIGHT / 2.0f, FILL_LENGTH.Value() * LIST_WIDTH, ITEM_HEIGHT)));
EXPECT_TRUE(
IsEqual(pattern_->GetItemRect(1), Rect(0, -ITEM_HEIGHT / 2.0f, FILL_LENGTH.Value() * LIST_WIDTH, ITEM_HEIGHT)));
EXPECT_TRUE(IsEqual(pattern_->GetItemRect(3),
Rect(0, -ITEM_HEIGHT / 2.0f + ITEM_HEIGHT * 2, FILL_LENGTH.Value() * LIST_WIDTH, ITEM_HEIGHT)));
EXPECT_TRUE(IsEqual(pattern_->GetItemRect(9),
@ -6338,8 +6334,7 @@ HWTEST_F(ListTestNg, ListLayout_SafeArea001, TestSize.Level1)
EXPECT_CALL(*MockPipelineContext::pipeline_, GetSafeArea)
.Times(1)
.WillOnce(Return(SafeAreaInsets { {}, {}, {}, { .start = 0, .end = 100 } }));
layoutProperty_->UpdateSafeAreaExpandOpts(
{ .type = SAFE_AREA_TYPE_SYSTEM, .edges = SAFE_AREA_EDGE_ALL });
layoutProperty_->UpdateSafeAreaExpandOpts({ .type = SAFE_AREA_TYPE_SYSTEM, .edges = SAFE_AREA_EDGE_ALL });
FlushLayoutTask(frameNode_);
EXPECT_EQ(pattern_->contentEndOffset_, 100);
EXPECT_TRUE(IsEqual(frameNode_->geometryNode_->GetFrameSize(), SizeF(LIST_WIDTH, LIST_HEIGHT)));
@ -6361,8 +6356,7 @@ HWTEST_F(ListTestNg, ListLayout_SafeArea002, TestSize.Level1)
});
EXPECT_CALL(*MockPipelineContext::pipeline_, GetSafeArea).Times(0);
layoutProperty_->UpdateSafeAreaExpandOpts(
{ .type = SAFE_AREA_TYPE_SYSTEM, .edges = SAFE_AREA_EDGE_TOP });
layoutProperty_->UpdateSafeAreaExpandOpts({ .type = SAFE_AREA_TYPE_SYSTEM, .edges = SAFE_AREA_EDGE_TOP });
FlushLayoutTask(frameNode_);
EXPECT_EQ(pattern_->contentEndOffset_, 0);
EXPECT_TRUE(IsEqual(frameNode_->geometryNode_->GetFrameSize(), SizeF(LIST_WIDTH, LIST_HEIGHT)));

View File

@ -15,6 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("marquee_test_ng") {
type = "new"
flutter_skia = true
sources = [ "marquee_test_ng.cpp" ]
}

View File

@ -13,15 +13,14 @@
* limitations under the License.
*/
#include "core/components_ng/pattern/text/text_layout_property.h"
#include "core/pipeline_ng/ui_task_scheduler.h"
#define private public
#define protected public
#include <cstddef>
#include <optional>
#include <string>
#include "gtest/gtest.h"
#define private public
#define protected public
#include "test/mock/core/pipeline/mock_pipeline_context.h"
#include "base/json/json_util.h"
@ -33,6 +32,7 @@
#include "core/components_ng/pattern/marquee/marquee_model_ng.h"
#include "core/components_ng/pattern/marquee/marquee_paint_property.h"
#include "core/components_ng/pattern/marquee/marquee_pattern.h"
#include "core/components_ng/pattern/text/text_layout_property.h"
#include "core/components_ng/pattern/text/text_pattern.h"
#include "core/components_v2/inspector/inspector_constants.h"

View File

@ -15,11 +15,7 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("navigation_test_ng") {
type = "new"
render = true
sources = [
"$ace_root/frameworks/core/components/font/constants_converter.cpp",
"$ace_root/frameworks/core/components/xcomponent/native_interface_xcomponent_impl.cpp",
"$ace_root/test/mock/base/mock_mouse_style.cpp",
"$ace_root/test/mock/core/common/mock_layout_inspector.cpp",
"bar_item_test_ng.cpp",
"nav_bar_test_ng.cpp",

View File

@ -14,11 +14,6 @@
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("navrouter_test_ng") {
render = true
flutter_skia = true
type = "new"
sources = [
"$ace_root/test/mock/base/mock_mouse_style.cpp",
"navrouter_test_ng.cpp",
]
sources = [ "navrouter_test_ng.cpp" ]
}

View File

@ -14,7 +14,6 @@
*/
#include <cstddef>
#include <fortify/fortify.h>
#include <list>
#include <optional>
#include <string>
@ -471,7 +470,6 @@ HWTEST_F(NavrouterTestNg, NavrouterTestNg0010, TestSize.Level1)
auto titleNode = titlePattern->frameNode_.Upgrade();
ASSERT_NE(titleNode, nullptr);
auto list = titleNode->GetChildren();
list.empty();
auto titleBarNode = AceType::MakeRefPtr<TitleBarNode>("TitleBarNode", 66, titlePattern);
auto layoutProperty = AceType::MakeRefPtr<NavDestinationLayoutProperty>();
@ -534,7 +532,6 @@ HWTEST_F(NavrouterTestNg, NavrouterTestNg0011, TestSize.Level1)
auto titleNode = titlePattern->frameNode_.Upgrade();
ASSERT_NE(titleNode, nullptr);
auto list = titleNode->GetChildren();
list.empty();
auto titleBarNode = AceType::MakeRefPtr<TitleBarNode>("TitleBarNode", 66, titlePattern);

View File

@ -14,8 +14,6 @@
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("option_test_ng") {
render = true
flutter_skia = true
type = "new"
sources = [ "option_test_ng.cpp" ]
}

View File

@ -15,8 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("overlay_manager_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/base/mock_measure_util.cpp",
"overlay_manager_test_ng.cpp",
]
sources = [ "overlay_manager_test_ng.cpp" ]
}

View File

@ -14,12 +14,8 @@
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("panel_test_ng") {
flutter_skia = true
render = true
type = "new"
sources = [
"$ace_root/frameworks/core/components/panel/render_sliding_panel.cpp",
"$ace_root/frameworks/core/components/panel/sliding_events.cpp",
"close_icon_pattern_test_ng.cpp",
"dragBar_pattern_test_ng.cpp",
"panel_property_test_ng.cpp",

View File

@ -15,8 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("date_picker_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/base/mock_measure_util.cpp",
"date_picker_test_ng.cpp",
]
sources = [ "date_picker_test_ng.cpp" ]
}

View File

@ -1,27 +0,0 @@
# Copyright (c) 2023 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("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("remote_window_test_ng") {
flutter_skia = true
render = true
type = "new"
sources = [
"$ace_root/frameworks/core/components_ng/pattern/remote_window/remote_window_layout_algorithm.cpp",
"$ace_root/frameworks/core/components_ng/pattern/remote_window/remote_window_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/remote_window/remote_window_pattern.cpp",
"remote_window_test_ng.cpp",
]
external_deps = [ "c_utils:utils" ]
}

View File

@ -1,165 +0,0 @@
/*
* Copyright (c) 2023 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.
*/
#define private public
#include "gtest/gtest.h"
#include "core/components_ng/base/view_stack_processor.h"
#include "core/components_ng/pattern/remote_window/remote_window_pattern.h"
#include "core/components_ng/pattern/remote_window/remote_window_model_ng.h"
#include "core/components_ng/pattern/remote_window/remote_window_layout_algorithm.h"
#include "core/components_v2/inspector/inspector_constants.h"
using namespace testing;
using namespace testing::ext;
namespace OHOS::Ace::NG {
namespace {
const float IDEAL_WIDTH = 300.0f;
const float IDEAL_HEIGHT = 300.0f;
const SizeF IDEAL_SIZE(IDEAL_WIDTH, IDEAL_HEIGHT);
const float MAX_WIDTH = 400.0f;
const float MAX_HEIGHT = 400.0f;
const SizeF MAX_SIZE(MAX_WIDTH, MAX_HEIGHT);
class RemoteWindowTestNg : public testing::Test {
public:
static void SetUpTestCase();
static void TearDownTestCase();
void SetUp() override;
void TearDown() override;
};
void RemoteWindowTestNg::SetUpTestCase()
{
}
void RemoteWindowTestNg::TearDownTestCase()
{
}
void RemoteWindowTestNg::SetUp() {}
void RemoteWindowTestNg::TearDown() {}
/**
* @tc.name: RemoteWindowPatternTest001
* @tc.desc: Test IsMeasureBoundary and IsAtomicNode.
* @tc.type: FUNC
*/
HWTEST_F(RemoteWindowTestNg, RemoteWindowPatternTest001, TestSize.Level1)
{
auto remoteWindowPattern = AceType::MakeRefPtr<RemoteWindowPattern>();
EXPECT_TRUE(remoteWindowPattern->IsMeasureBoundary());
EXPECT_TRUE(remoteWindowPattern->IsAtomicNode());
}
/**
* @tc.name: RemoteWindowPatternTest002
* @tc.desc: Test RemoteWindowPattern::OnAttachToFrameNode
* @tc.type: FUNC
*/
HWTEST_F(RemoteWindowTestNg, RemoteWindowPatternTest002, TestSize.Level1)
{
/**
* @tc.steps: step1. initialize RemoteWindowPattern
* @tc.expected: All pointer is non-null
*/
auto pattern = AceType::MakeRefPtr<RemoteWindowPattern>();
ASSERT_NE(pattern, nullptr);
auto frameNode = FrameNode::CreateFrameNode("Test", 1, pattern);
frameNode->geometryNode_ = AceType::MakeRefPtr<GeometryNode>();
ASSERT_NE(frameNode->geometryNode_, nullptr);
pattern->AttachToFrameNode(frameNode);
/**
* @tc.steps: step2. Get host and check AttachToFrameNode run right
* @tc.expected: Check measure type is MeasureType::MATCH_PARENT set by AttachToFrameNode
*/
auto host = pattern->GetHost();
ASSERT_NE(host, nullptr);
EXPECT_EQ(host->GetLayoutProperty()->GetMeasureType(), MeasureType::MATCH_PARENT);
}
/**
* @tc.name: RemoteWindowModelNgTest001
* @tc.desc: Test RemoteWindowModelNg::Create
* @tc.type: FUNC
*/
HWTEST_F(RemoteWindowTestNg, RemoteWindowModelNgTest001, TestSize.Level1)
{
/**
* @tc.steps: step1. clear stack
*/
auto stack = ViewStackProcessor::GetInstance();
stack->ClearStack();
/**
* @tc.steps: step2. run RemoteWindowModelNg::Create
*/
std::unique_ptr<RemoteWindowModel> instance = nullptr;
instance.reset(new NG::RemoteWindowModelNG());
std::shared_ptr<OHOS::Rosen::RSNode> rsNode = nullptr;
instance->Create(rsNode);
/**
* @tc.expected: check tag of RemoteWindowModelNg
*/
auto frameNode = stack->GetMainFrameNode();
EXPECT_EQ(frameNode->GetTag(), V2::REMOTE_WINDOW_ETS_TAG);
}
/**
* @tc.name: RemoteWindowLayoutAlgorithmTest001
* @tc.desc: Test RemoteWindowLayoutAlgorithm::MeasureContent
* @tc.type: FUNC
*/
HWTEST_F(RemoteWindowTestNg, RemoteWindowLayoutAlgorithmTest001, TestSize.Level1)
{
/**
* @tc.steps: step1. initialize parameters.
* @tc.expected: All pointer is non-null.
*/
auto pattern = AceType::MakeRefPtr<RemoteWindowPattern>();
ASSERT_NE(pattern, nullptr);
auto frameNode = FrameNode::CreateFrameNode("Test", 1, pattern);
ASSERT_NE(frameNode, nullptr);
frameNode->geometryNode_ = AceType::MakeRefPtr<GeometryNode>();
ASSERT_NE(frameNode->geometryNode_, nullptr);
LayoutWrapperNode layoutWrapper =
LayoutWrapperNode(frameNode, frameNode->geometryNode_, frameNode->GetLayoutProperty());
auto layoutAlgorithm = AceType::MakeRefPtr<RemoteWindowLayoutAlgorithm>();
ASSERT_NE(layoutAlgorithm, nullptr);
layoutWrapper.SetLayoutAlgorithm(AceType::MakeRefPtr<LayoutAlgorithmWrapper>(layoutAlgorithm));
/**
* @tc.steps: step2. Call the function MeasureContent without the max size.
* @tc.expected: The return value is equal to MAX_SIZE.
*/
LayoutConstraintF layoutConstraint;
layoutConstraint.maxSize = MAX_SIZE;
auto canvasSize = layoutAlgorithm->MeasureContent(layoutConstraint, &layoutWrapper);
EXPECT_EQ(canvasSize.value_or(SizeF(0.0f, 0.0f)), MAX_SIZE);
/**
* @tc.steps: step3. Call the function MeasureContent with the ideal size.
* @tc.expected: The return value is equal to IDEAL_SIZE.
*/
layoutConstraint.selfIdealSize.SetSize(IDEAL_SIZE);
canvasSize = layoutAlgorithm->MeasureContent(layoutConstraint, &layoutWrapper);
EXPECT_EQ(canvasSize.value_or(SizeF(0.0f, 0.0f)), IDEAL_SIZE);
}
}
} // namespace OHOS::Ace::NG

View File

@ -14,7 +14,6 @@
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("rich_editor_test_ng") {
render = true
type = "new"
sources = [ "rich_editor_test_ng.cpp" ]
}

View File

@ -22,7 +22,12 @@
#include "test/mock/base/mock_task_executor.h"
#include "test/mock/core/common/mock_container.h"
#include "test/mock/core/common/mock_data_detector_mgr.h"
#include "test/mock/core/common/mock_theme_manager.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
#include "test/mock/core/render/mock_paragraph.h"
#include "test/mock/core/render/mock_render_context.h"
#include "test/mock/core/rosen/mock_canvas.h"
#include "base/geometry/dimension.h"
#include "base/geometry/ng/offset_t.h"
@ -52,18 +57,12 @@
#include "core/components_ng/pattern/text/span_node.h"
#include "core/components_ng/pattern/text_field/text_field_manager.h"
#include "core/components_ng/pattern/text_field/text_selector.h"
#include "core/components_ng/render/adapter/txt_paragraph.h"
#include "core/components_ng/render/paragraph.h"
#include "test/mock/core/render/mock_render_context.h"
#include "test/mock/core/rosen/mock_canvas.h"
#include "test/mock/core/common/mock_theme_manager.h"
#include "test/mock/core/common/mock_data_detector_mgr.h"
#include "core/components_v2/inspector/inspector_constants.h"
#include "core/event/key_event.h"
#include "core/event/mouse_event.h"
#include "core/event/touch_event.h"
#include "core/pipeline/base/constants.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
using namespace testing;
using namespace testing::ext;
@ -102,11 +101,11 @@ const std::string IMAGE_VALUE = "image1";
const std::string BUNDLE_NAME = "bundleName";
const std::string MODULE_NAME = "moduleName";
const std::string ROOT_TAG = "root";
const CalcLength CALC_LENGTH_CALC {10.0, DimensionUnit::CALC};
const CalcLength ERROR_CALC_LENGTH_CALC {-10.0, DimensionUnit::CALC};
const Dimension CALC_TEST {10.0, DimensionUnit::CALC};
const Dimension ERROR_CALC_TEST {-10.0, DimensionUnit::CALC};
const Offset MOUSE_GLOBAL_LOCATION = {100, 200};
const CalcLength CALC_LENGTH_CALC { 10.0, DimensionUnit::CALC };
const CalcLength ERROR_CALC_LENGTH_CALC { -10.0, DimensionUnit::CALC };
const Dimension CALC_TEST { 10.0, DimensionUnit::CALC };
const Dimension ERROR_CALC_TEST { -10.0, DimensionUnit::CALC };
const Offset MOUSE_GLOBAL_LOCATION = { 100, 200 };
constexpr int32_t WORD_LIMIT_LEN = 6;
constexpr int32_t WORD_LIMIT_RETURN = 2;
constexpr int32_t BEYOND_LIMIT_RETURN = 4;
@ -221,29 +220,29 @@ void RichEditorTestNg::ClearSpan()
void RichEditorTestNg::InitAdjustObject(MockDataDetectorMgr& mockDataDetectorMgr)
{
EXPECT_CALL(mockDataDetectorMgr, GetCursorPosition(_, _))
.WillRepeatedly([](const std::string &text, int8_t offset) -> int8_t {
if (text.empty()) {
return DEFAULT_RETURN_VALUE;
}
if (text.length() <= WORD_LIMIT_LEN) {
return WORD_LIMIT_RETURN;
} else {
return BEYOND_LIMIT_RETURN;
}
});
.WillRepeatedly([](const std::string& text, int8_t offset) -> int8_t {
if (text.empty()) {
return DEFAULT_RETURN_VALUE;
}
if (text.length() <= WORD_LIMIT_LEN) {
return WORD_LIMIT_RETURN;
} else {
return BEYOND_LIMIT_RETURN;
}
});
EXPECT_CALL(mockDataDetectorMgr, GetWordSelection(_, _))
.WillRepeatedly([](const std::string &text, int8_t offset) -> std::vector<int8_t> {
if (text.empty()) {
return std::vector<int8_t> { -1, -1 };
}
.WillRepeatedly([](const std::string& text, int8_t offset) -> std::vector<int8_t> {
if (text.empty()) {
return std::vector<int8_t> { -1, -1 };
}
if (text.length() <= WORD_LIMIT_LEN) {
return std::vector<int8_t> { 2, 3 };
} else {
return std::vector<int8_t> { 0, 2 };
}
});
if (text.length() <= WORD_LIMIT_LEN) {
return std::vector<int8_t> { 2, 3 };
} else {
return std::vector<int8_t> { 0, 2 };
}
});
}
/**
@ -675,16 +674,16 @@ HWTEST_F(RichEditorTestNg, RichEditorController001, TestSize.Level1)
auto index4 = richEditorPattern->AddImageSpan(options, false, 0);
EXPECT_EQ(index4, 0);
marginProp = {CALC_LENGTH_CALC, CALC_LENGTH_CALC, CALC_LENGTH_CALC, CALC_LENGTH_CALC};
borderRadius = {CALC_TEST, CALC_TEST, CALC_TEST, CALC_TEST};
marginProp = { CALC_LENGTH_CALC, CALC_LENGTH_CALC, CALC_LENGTH_CALC, CALC_LENGTH_CALC };
borderRadius = { CALC_TEST, CALC_TEST, CALC_TEST, CALC_TEST };
imageStyle.marginProp = marginProp;
imageStyle.borderRadius = borderRadius;
options.imageAttribute = imageStyle;
auto index5 = richEditorPattern->AddImageSpan(options, false, 0);
EXPECT_EQ(index5, 0);
marginProp = {ERROR_CALC_LENGTH_CALC, ERROR_CALC_LENGTH_CALC, ERROR_CALC_LENGTH_CALC, ERROR_CALC_LENGTH_CALC};
borderRadius = {ERROR_CALC_TEST, ERROR_CALC_TEST, ERROR_CALC_TEST, ERROR_CALC_TEST};
marginProp = { ERROR_CALC_LENGTH_CALC, ERROR_CALC_LENGTH_CALC, ERROR_CALC_LENGTH_CALC, ERROR_CALC_LENGTH_CALC };
borderRadius = { ERROR_CALC_TEST, ERROR_CALC_TEST, ERROR_CALC_TEST, ERROR_CALC_TEST };
imageStyle.marginProp = marginProp;
imageStyle.borderRadius = borderRadius;
options.imageAttribute = imageStyle;
@ -2811,17 +2810,17 @@ HWTEST_F(RichEditorTestNg, CheckScrollable, TestSize.Level1)
*/
HWTEST_F(RichEditorTestNg, NeedSoftKeyboard001, TestSize.Level1)
{
/**
* @tc.step: step1. Get frameNode and pattern.
*/
ASSERT_NE(richEditorNode_, nullptr);
auto richEditorPattern = richEditorNode_->GetPattern<RichEditorPattern>();
ASSERT_NE(richEditorPattern, nullptr);
/**
* @tc.step: step1. Get frameNode and pattern.
*/
ASSERT_NE(richEditorNode_, nullptr);
auto richEditorPattern = richEditorNode_->GetPattern<RichEditorPattern>();
ASSERT_NE(richEditorPattern, nullptr);
/**
* @tc.steps: step2. Test whether rich editor need soft keyboard.
*/
EXPECT_TRUE(richEditorPattern->NeedSoftKeyboard());
/**
* @tc.steps: step2. Test whether rich editor need soft keyboard.
*/
EXPECT_TRUE(richEditorPattern->NeedSoftKeyboard());
}
/*
* @tc.name: DoubleHandleClickEvent001
@ -2881,8 +2880,8 @@ HWTEST_F(RichEditorTestNg, AdjustWordCursorAndSelect01, TestSize.Level1)
richEditorPattern->lastClickTimeStamp_ = richEditorPattern->lastAiPosTimeStamp_ + seconds(2);
int32_t spanStart = -1;
std::string content = richEditorPattern->GetPositionSpansText(pos, spanStart);
mockDataDetectorMgr.AdjustCursorPosition(pos, content, richEditorPattern->lastAiPosTimeStamp_,
richEditorPattern->lastClickTimeStamp_);
mockDataDetectorMgr.AdjustCursorPosition(
pos, content, richEditorPattern->lastAiPosTimeStamp_, richEditorPattern->lastClickTimeStamp_);
EXPECT_EQ(pos, 2);
int32_t start = 1;
@ -2894,8 +2893,8 @@ HWTEST_F(RichEditorTestNg, AdjustWordCursorAndSelect01, TestSize.Level1)
AddSpan(INIT_VALUE_2);
pos = 1;
content = richEditorPattern->GetPositionSpansText(pos, spanStart);
mockDataDetectorMgr.AdjustCursorPosition(pos, content, richEditorPattern->lastAiPosTimeStamp_,
richEditorPattern->lastClickTimeStamp_);
mockDataDetectorMgr.AdjustCursorPosition(
pos, content, richEditorPattern->lastAiPosTimeStamp_, richEditorPattern->lastClickTimeStamp_);
EXPECT_EQ(pos, 4);
start = 1;
@ -2907,8 +2906,8 @@ HWTEST_F(RichEditorTestNg, AdjustWordCursorAndSelect01, TestSize.Level1)
ClearSpan();
pos = 2;
content = richEditorPattern->GetPositionSpansText(pos, spanStart);
mockDataDetectorMgr.AdjustCursorPosition(pos, content, richEditorPattern->lastAiPosTimeStamp_,
richEditorPattern->lastClickTimeStamp_);
mockDataDetectorMgr.AdjustCursorPosition(
pos, content, richEditorPattern->lastAiPosTimeStamp_, richEditorPattern->lastClickTimeStamp_);
EXPECT_EQ(pos, -1);
start = 1;

View File

@ -17,7 +17,6 @@
#include <memory>
#include <utility>
#include "gtest/gtest-test-part.h"
#include "gtest/gtest.h"
#include "base/geometry/ng/size_t.h"
@ -3037,20 +3036,12 @@ HWTEST_F(ScrollTestNg, Measure002, TestSize.Level1)
model.SetAxis(Axis::NONE);
CreateContent();
GetInstance();
/**
* @tc.steps: step2. Create the layout wrapper of the scroll frame node and set the flag to inform that it is
* a select scroll.
* @tc.expected: Objects are created successfully.
*/
RefPtr<LayoutWrapperNode> layoutWrapper = frameNode_->CreateLayoutWrapper(false, false);
pattern_->SetIsSelectScroll(true);
FlushLayoutTask(frameNode_);
layoutWrapper->MountToHostOnMainThread();
/**
* @tc.steps: step3. Set the scroll size to be the actual frame size of the scroll.Set the expect size to be the
* size without the scroll, compare them.
* @tc.expected: Two sizes should be not equal.
*/
RefPtr<GridColumnInfo> columnInfo = GridSystemManager::GetInstance().GetInfoByType(GridColumnType::MENU);
columnInfo->GetParent()->BuildColumnWidth();
auto defaultWidth = static_cast<float>(columnInfo->GetWidth(2));
@ -3074,7 +3065,7 @@ HWTEST_F(ScrollTestNg, SelectScroll002, TestSize.Level1)
*/
CreateWithContent();
ASSERT_NE(pattern_, nullptr);
auto ScrollWidth=pattern_->GetSelectScrollWidth();
auto ScrollWidth = pattern_->GetSelectScrollWidth();
ASSERT_NE(ScrollWidth, 0.0);
}

View File

@ -14,7 +14,6 @@
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("scroll_bar_test_ng") {
flutter_skia = true
type = "new"
sources = [
"scroll_bar_accessibility_property_test_ng.cpp",

View File

@ -13,12 +13,13 @@
* limitations under the License.
*/
#include "base/geometry/ng/point_t.h"
#include "gtest/gtest.h"
#define private public
#define protected public
#include "gtest/gtest.h"
#include "test/mock/base/mock_task_executor.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
#include "base/geometry/ng/point_t.h"
#include "base/geometry/ng/size_t.h"
#include "base/memory/ace_type.h"
#include "core/components/scroll/scrollable.h"
@ -32,7 +33,6 @@
#include "core/components_ng/pattern/scroll_bar/scroll_bar_model_ng.h"
#include "core/components_ng/pattern/scroll_bar/scroll_bar_pattern.h"
#include "core/components_v2/inspector/inspector_constants.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
using namespace testing;
using namespace testing::ext;

View File

@ -14,7 +14,6 @@
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("scrollable_test_ng") {
render = true
type = "new"
sources = [ "scrollable_test_ng.cpp" ]
}

View File

@ -15,8 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("search_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/base/mock_mouse_style.cpp",
"search_test_ng.cpp",
]
sources = [ "search_test_ng.cpp" ]
}

View File

@ -33,7 +33,6 @@ ohos_unittest("security_component_test_ng") {
"$ace_root/test/unittest:ace_components_syntax",
"$ace_root/test/unittest:ace_core_animation",
"$ace_root/test/unittest:ace_core_extra",
"$ace_root/test/unittest:ace_unittest_log",
"$cjson_root:cjson_static",
"//third_party/googletest:gmock_main",
]

View File

@ -13,10 +13,7 @@
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("select_pattern_test_ng") {
ace_unittest("select_test_ng") {
type = "new"
sources = [
"$ace_root/frameworks/core/components_v2/inspector/utils.cpp",
"select_pattern_test_ng.cpp",
]
sources = [ "select_test_ng.cpp" ]
}

View File

@ -13,6 +13,7 @@
* limitations under the License.
*/
#include <cstdint>
#include <iostream>
#include <optional>
#include <string>
@ -20,7 +21,6 @@
#define protected public
#define private public
#include <iostream>
#include "test/mock/core/common/mock_theme_manager.h"
#include "test/mock/core/pipeline/mock_pipeline_context.h"
@ -86,7 +86,7 @@ struct TestProperty {
std::optional<std::vector<std::string>> FontFamily = std::nullopt;
std::optional<Color> FontColor = std::nullopt;
};
class SelectPropertyTestNg : public testing::Test {
class SelectTestNg : public testing::Test {
public:
static void SetUpTestCase();
static void TearDownTestCase();
@ -101,7 +101,7 @@ protected:
static RefPtr<FrameNode> CreateSelect(const std::vector<SelectParam>& value, const TestProperty& test);
};
void SelectPropertyTestNg::SetUpTestCase()
void SelectTestNg::SetUpTestCase()
{
MockPipelineContext::SetUp();
auto themeManager = AceType::MakeRefPtr<MockThemeManager>();
@ -109,21 +109,21 @@ void SelectPropertyTestNg::SetUpTestCase()
EXPECT_CALL(*themeManager, GetTheme(_)).WillRepeatedly(Return(AceType::MakeRefPtr<SelectTheme>()));
}
void SelectPropertyTestNg::TearDownTestCase()
void SelectTestNg::TearDownTestCase()
{
MockPipelineContext::TearDown();
}
void SelectPropertyTestNg::SetUp() {}
void SelectTestNg::SetUp() {}
void SelectPropertyTestNg::TearDown()
void SelectTestNg::TearDown()
{
frameNode_ = nullptr;
selectPattern_ = nullptr;
selectAccessibilityProperty_ = nullptr;
}
void SelectPropertyTestNg::InitSelectTestNg()
void SelectTestNg::InitSelectTestNg()
{
frameNode_ = FrameNode::GetOrCreateFrameNode(V2::SELECT_ETS_TAG, ViewStackProcessor::GetInstance()->ClaimNodeId(),
[]() { return AceType::MakeRefPtr<SelectPattern>(); });
@ -136,7 +136,7 @@ void SelectPropertyTestNg::InitSelectTestNg()
ASSERT_NE(selectAccessibilityProperty_, nullptr);
}
RefPtr<FrameNode> SelectPropertyTestNg::CreateSelect(const std::vector<SelectParam>& value, const TestProperty& test)
RefPtr<FrameNode> SelectTestNg::CreateSelect(const std::vector<SelectParam>& value, const TestProperty& test)
{
SelectModelNG selectModelInstance;
selectModelInstance.Create(value);
@ -165,7 +165,7 @@ RefPtr<FrameNode> SelectPropertyTestNg::CreateSelect(const std::vector<SelectPar
* @tc.desc: Create Select.
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectLayoutPropertyTest001, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectLayoutPropertyTest001, TestSize.Level1)
{
SelectModelNG selectModelInstance;
@ -190,7 +190,7 @@ HWTEST_F(SelectPropertyTestNg, SelectLayoutPropertyTest001, TestSize.Level1)
* @tc.desc: Test Select OnDirtyLayoutWrapperSwap.
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectLayoutPropertyTest002, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectLayoutPropertyTest002, TestSize.Level1)
{
SelectModelNG selectModelInstance;
@ -214,7 +214,7 @@ HWTEST_F(SelectPropertyTestNg, SelectLayoutPropertyTest002, TestSize.Level1)
* @tc.desc: Test Select Layout Algorithm MeasureAndGetSize width.
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectLayoutPropertyTest003, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectLayoutPropertyTest003, TestSize.Level1)
{
auto text = FrameNode::CreateFrameNode(V2::TEXT_ETS_TAG, 0, AceType::MakeRefPtr<TextPattern>());
ASSERT_TRUE(text);
@ -244,7 +244,7 @@ HWTEST_F(SelectPropertyTestNg, SelectLayoutPropertyTest003, TestSize.Level1)
* @tc.desc: Test SelectSetMenuAlign
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectSetMenuAlign001, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectSetMenuAlign001, TestSize.Level1)
{
SelectModelNG selectModelInstance;
// create select
@ -276,7 +276,7 @@ HWTEST_F(SelectPropertyTestNg, SelectSetMenuAlign001, TestSize.Level1)
* @tc.desc: Test SelectPattern PlayBgColorAnimation and OnKeyEvent
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectEvent001, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectEvent001, TestSize.Level1)
{
SelectModelNG selectModelInstance;
/**
@ -317,7 +317,7 @@ HWTEST_F(SelectPropertyTestNg, SelectEvent001, TestSize.Level1)
* @tc.desc: Test SelectPattern OnModifyDone
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, OnModifyDone001, TestSize.Level1)
HWTEST_F(SelectTestNg, OnModifyDone001, TestSize.Level1)
{
SelectModelNG selectModelInstance;
/**
@ -346,7 +346,7 @@ HWTEST_F(SelectPropertyTestNg, OnModifyDone001, TestSize.Level1)
* @tc.desc: Test SelectPattern UpdateSelectedProps
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, UpdateSelectedProps001, TestSize.Level1)
HWTEST_F(SelectTestNg, UpdateSelectedProps001, TestSize.Level1)
{
SelectModelNG selectModelInstance;
/**
@ -391,7 +391,7 @@ HWTEST_F(SelectPropertyTestNg, UpdateSelectedProps001, TestSize.Level1)
* @tc.desc: Test SelectPattern UpdateSelectedProps
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, UpdateSelectedProps002, TestSize.Level1)
HWTEST_F(SelectTestNg, UpdateSelectedProps002, TestSize.Level1)
{
/**
* @tc.steps: step1. Initialize testProperty and Create select frameNode.
@ -430,7 +430,7 @@ HWTEST_F(SelectPropertyTestNg, UpdateSelectedProps002, TestSize.Level1)
* @tc.desc: Test SetSelectOptionFont.
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectLayoutPropertyTest004, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectLayoutPropertyTest004, TestSize.Level1)
{
/**
* @tc.steps: step1. Get frameNode and pattern.
@ -477,7 +477,7 @@ HWTEST_F(SelectPropertyTestNg, SelectLayoutPropertyTest004, TestSize.Level1)
* @tc.desc: Test SelectPattern ShowSelectMenu.
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, ShowSelectMenuTest001, TestSize.Level1)
HWTEST_F(SelectTestNg, ShowSelectMenuTest001, TestSize.Level1)
{
/**
* @tc.steps: step1. Get frameNode and pattern.
@ -501,7 +501,7 @@ HWTEST_F(SelectPropertyTestNg, ShowSelectMenuTest001, TestSize.Level1)
* @tc.desc: Test Select Layout Algorithm Measure.
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectLayoutPropertyTest005, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectLayoutPropertyTest005, TestSize.Level1)
{
/**
* @tc.steps: step1. Get frameNode and geometryNode.
@ -528,7 +528,7 @@ HWTEST_F(SelectPropertyTestNg, SelectLayoutPropertyTest005, TestSize.Level1)
* @tc.desc: Test the distributed capability of Select.
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectDistributedTest001, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectDistributedTest001, TestSize.Level1)
{
/**
* @tc.steps: step1. Initialize select node
@ -567,7 +567,7 @@ HWTEST_F(SelectPropertyTestNg, SelectDistributedTest001, TestSize.Level1)
* @tc.desc: Test GetCurrentIndex of select.
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectAccessibilityPropertyGetCurrentIndex001, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectAccessibilityPropertyGetCurrentIndex001, TestSize.Level1)
{
InitSelectTestNg();
@ -582,7 +582,7 @@ HWTEST_F(SelectPropertyTestNg, SelectAccessibilityPropertyGetCurrentIndex001, Te
* @tc.desc: Test GetBeginIndex of select.
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectAccessibilityPropertyGetBeginIndex001, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectAccessibilityPropertyGetBeginIndex001, TestSize.Level1)
{
InitSelectTestNg();
@ -601,7 +601,7 @@ HWTEST_F(SelectPropertyTestNg, SelectAccessibilityPropertyGetBeginIndex001, Test
* @tc.desc: Test GetEndIndex of select.
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectAccessibilityPropertyGetEndIndex001, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectAccessibilityPropertyGetEndIndex001, TestSize.Level1)
{
/**
* @tc.steps: step1. Initialize select and verify default value of its end index.
@ -628,7 +628,7 @@ HWTEST_F(SelectPropertyTestNg, SelectAccessibilityPropertyGetEndIndex001, TestSi
* @tc.desc: Test GetText of select.
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectAccessibilityPropertyGetText001, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectAccessibilityPropertyGetText001, TestSize.Level1)
{
/**
* @tc.steps: step1. Initialize the text and verify its default value.
@ -654,7 +654,7 @@ HWTEST_F(SelectPropertyTestNg, SelectAccessibilityPropertyGetText001, TestSize.L
* @tc.desc: Test GetCollectionItemCounts of select.
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectAccessibilityPropertyGetCollectionItemCounts001, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectAccessibilityPropertyGetCollectionItemCounts001, TestSize.Level1)
{
InitSelectTestNg();
@ -675,7 +675,7 @@ HWTEST_F(SelectPropertyTestNg, SelectAccessibilityPropertyGetCollectionItemCount
* @tc.desc: setSpace
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectSetSpaceTest001, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectSetSpaceTest001, TestSize.Level1)
{
/**
* @tc.steps: step1. Create select model, select frame node and the children node of select frame node.
@ -724,7 +724,7 @@ HWTEST_F(SelectPropertyTestNg, SelectSetSpaceTest001, TestSize.Level1)
* @tc.desc: Test SetArrowPosition
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectSetArrowPositionTest001, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectSetArrowPositionTest001, TestSize.Level1)
{
SelectModelNG selectModelInstance;
@ -770,7 +770,7 @@ HWTEST_F(SelectPropertyTestNg, SelectSetArrowPositionTest001, TestSize.Level1)
* @tc.desc: Test SetArrowPosition
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectSetArrowPositionTest002, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectSetArrowPositionTest002, TestSize.Level1)
{
/**
* @tc.steps: step1. Create select model and parameters of select and call Create() of select model.
@ -797,7 +797,7 @@ HWTEST_F(SelectPropertyTestNg, SelectSetArrowPositionTest002, TestSize.Level1)
* @tc.desc: Test create menu
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, CreateMenu001, TestSize.Level1)
HWTEST_F(SelectTestNg, CreateMenu001, TestSize.Level1)
{
SelectModelNG selectModelInstance;
@ -824,7 +824,7 @@ HWTEST_F(SelectPropertyTestNg, CreateMenu001, TestSize.Level1)
* @tc.desc: Test on color configuration update
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, OnColorConfigurationUpdate001, TestSize.Level1)
HWTEST_F(SelectTestNg, OnColorConfigurationUpdate001, TestSize.Level1)
{
/**
* @tc.steps: step1. Create select model and parameters of select.
@ -872,7 +872,7 @@ HWTEST_F(SelectPropertyTestNg, OnColorConfigurationUpdate001, TestSize.Level1)
* @tc.desc: Test Select Model
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectModel001, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectModel001, TestSize.Level1)
{
/**
* @tc.steps: step1. Create select model and parameters of select.
@ -915,7 +915,7 @@ HWTEST_F(SelectPropertyTestNg, SelectModel001, TestSize.Level1)
* @tc.desc: Test Select Model
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectModel002, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectModel002, TestSize.Level1)
{
/**
* @tc.steps: step1. Create select model and select event.
@ -970,7 +970,7 @@ HWTEST_F(SelectPropertyTestNg, SelectModel002, TestSize.Level1)
* @tc.desc: Test Select Model
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectModel003, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectModel003, TestSize.Level1)
{
/**
* @tc.steps: step1. Create select model and select event.
@ -1004,7 +1004,7 @@ HWTEST_F(SelectPropertyTestNg, SelectModel003, TestSize.Level1)
selectModelInstance.SetPaddingTop(CalcDimension(20.00, DimensionUnit::VP));
selectModelInstance.SetPaddingRight(CalcDimension(20.00, DimensionUnit::VP));
selectModelInstance.SetPaddingBottom(CalcDimension(20.00, DimensionUnit::VP));
/**
/**
* @tc.steps: step4. Get the select frame node, select pattern and menu frame node.
* @tc.expected: Objects are gotten successfully and should not be null.
*/
@ -1020,7 +1020,7 @@ HWTEST_F(SelectPropertyTestNg, SelectModel003, TestSize.Level1)
* @tc.desc: Test Select Model
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectModel004, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectModel004, TestSize.Level1)
{
/**
* @tc.steps: step1. Create selectModelInstance.
@ -1060,7 +1060,7 @@ HWTEST_F(SelectPropertyTestNg, SelectModel004, TestSize.Level1)
* @tc.desc: Test OnColorConfigurationUpdate
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectPattern001, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectPattern001, TestSize.Level1)
{
/**
* @tc.steps: step1. Create pipeline, select theme, select model and parameters of select.
@ -1102,7 +1102,7 @@ HWTEST_F(SelectPropertyTestNg, SelectPattern001, TestSize.Level1)
* @tc.desc: Test SelectModelNG SetOptionWidth.
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectOption001, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectOption001, TestSize.Level1)
{
/**
* @tc.steps: step1. Create select model, select frame node and select pattern, call SetOptionWidth.
@ -1149,7 +1149,7 @@ HWTEST_F(SelectPropertyTestNg, SelectOption001, TestSize.Level1)
* @tc.desc: Test SelectModelNG SetOptionHeight.
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectOption002, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectOption002, TestSize.Level1)
{
/**
* @tc.steps: step1. Create select model and call SetOptionHeight.
@ -1180,7 +1180,7 @@ HWTEST_F(SelectPropertyTestNg, SelectOption002, TestSize.Level1)
* @tc.desc: Test SelectPattern GetFontSize.
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectFont001, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectFont001, TestSize.Level1)
{
auto select = ViewStackProcessor::GetInstance()->GetMainFrameNode();
auto selectPattern = select->GetPattern<SelectPattern>();
@ -1193,7 +1193,7 @@ HWTEST_F(SelectPropertyTestNg, SelectFont001, TestSize.Level1)
* select button.
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, ShowSelectMenuTest002, TestSize.Level1)
HWTEST_F(SelectTestNg, ShowSelectMenuTest002, TestSize.Level1)
{
/**
* @tc.steps: step1. Get select model, select frame node, test property and select pattern. Set the
@ -1223,7 +1223,7 @@ HWTEST_F(SelectPropertyTestNg, ShowSelectMenuTest002, TestSize.Level1)
* @tc.desc: Test SelectPattern SetSelectDefaultTheme to verify the default visual effect of select button.
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SetSelectDefaultThemeTest001, TestSize.Level1)
HWTEST_F(SelectTestNg, SetSelectDefaultThemeTest001, TestSize.Level1)
{
/**
* @tc.steps: step1. Build select frame node, select theme, select pattern.
@ -1261,7 +1261,7 @@ HWTEST_F(SelectPropertyTestNg, SetSelectDefaultThemeTest001, TestSize.Level1)
* @tc.desc: Test SelectPattern GetFontSize.
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, GetFontSizeTest001, TestSize.Level1)
HWTEST_F(SelectTestNg, GetFontSizeTest001, TestSize.Level1)
{
/**
* @tc.steps: step1. Build select frame node, select pattern, pipeline and select theme.
@ -1291,7 +1291,7 @@ HWTEST_F(SelectPropertyTestNg, GetFontSizeTest001, TestSize.Level1)
* @tc.desc: Test Select Default padding
* @tc.type: FUNC
*/
HWTEST_F(SelectPropertyTestNg, SelectPadding001, TestSize.Level1)
HWTEST_F(SelectTestNg, SelectPadding001, TestSize.Level1)
{
SelectModelNG selectModelInstance;
@ -1305,7 +1305,7 @@ HWTEST_F(SelectPropertyTestNg, SelectPadding001, TestSize.Level1)
ASSERT_NE(layoutProps, nullptr);
const auto& padding = layoutProps->GetPaddingProperty();
ASSERT_NE(padding, nullptr);
EXPECT_EQ(padding->left.value().GetDimension().ConvertToVp(), 4.0);
EXPECT_EQ(padding->right.value().GetDimension().ConvertToVp(), 4.0);
}

View File

@ -32,7 +32,6 @@ ace_unittest("shape_test_ng") {
"$ace_root/frameworks/core/components_ng/pattern/shape/shape_model_ng.cpp",
"$ace_root/frameworks/core/components_ng/pattern/shape/shape_overlay_modifier.cpp",
"$ace_root/frameworks/core/components_ng/pattern/shape/shape_paint_property.cpp",
"$ace_root/test/mock/core/render/mock_path_painter.cpp",
"base_polygon_pattern_test_ng.cpp",
"base_shape_pattern_test_ng.cpp",
"circle_pattern_test_ng.cpp",

View File

@ -13,10 +13,9 @@
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("side_bar_pattern_test_ng") {
ace_unittest("side_bar_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/base/mock_mouse_style.cpp",
"side_bar_layout_test_ng.cpp",
"side_bar_pattern_test_ng.cpp",
"side_bar_view_test_ng.cpp",

View File

@ -15,8 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("slider_test_ng") {
type = "new"
sources = [
"$ace_root/test/mock/core/render/mock_path_painter.cpp",
"slider_test_ng.cpp",
]
sources = [ "slider_test_ng.cpp" ]
}

View File

@ -15,8 +15,5 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("stage_test_ng") {
type = "new"
sources = [
"$ace_root/frameworks/core/components/common/properties/test/mock/mock_motion_path_evaluator.cpp",
"stage_test_ng.cpp",
]
sources = [ "stage_test_ng.cpp" ]
}

View File

@ -13,11 +13,7 @@
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
ace_unittest("stepper_pattern_test_ng") {
ace_unittest("stepper_test_ng") {
type = "new"
sources = [
"stepper_accessibility_property_test_ng.cpp",
"stepper_item_pattern_test_ng.cpp",
"stepper_pattern_test_ng.cpp",
]
sources = [ "stepper_test_ng.cpp" ]
}

View File

@ -1,242 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License" << std::endl;
* 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 "gtest/gtest.h"
#include "core/components_v2/inspector/inspector_constants.h"
#define private public
#define protected public
#include "core/components_ng/base/view_stack_processor.h"
#include "core/components_ng/pattern/stepper/stepper_node.h"
#include "core/components_ng/pattern/stepper/stepper_pattern.h"
#include "core/components_ng/pattern/swiper/swiper_pattern.h"
#include "core/components_ng/pattern/swiper_indicator/indicator_common/swiper_indicator_pattern.h"
#undef private
#undef protected
using namespace testing;
using namespace testing::ext;
using namespace OHOS::Ace::Framework;
namespace OHOS::Ace::NG {
namespace {
constexpr int32_t STEPPER_ERROR = -1;
constexpr int32_t INDEX_NUM = 10;
} // namespace
class StepperAccessibilityPropertyTestNg : public testing::Test {
public:
static void SetUpTestCase() {};
static void TearDownTestCase() {};
void SetUp() override;
void TearDown() override;
void InitStepperTestNg();
RefPtr<StepperNode> frameNode_;
RefPtr<StepperPattern> stepperPattern_;
RefPtr<StepperAccessibilityProperty> stepperAccessibilityProperty_;
RefPtr<FrameNode> swiperNode_;
RefPtr<SwiperLayoutProperty> swiperLayoutProperty_;
};
void StepperAccessibilityPropertyTestNg::SetUp() {}
void StepperAccessibilityPropertyTestNg::TearDown()
{
frameNode_ = nullptr;
stepperPattern_ = nullptr;
stepperAccessibilityProperty_ = nullptr;
swiperNode_ = nullptr;
swiperLayoutProperty_ = nullptr;
}
void StepperAccessibilityPropertyTestNg::InitStepperTestNg()
{
frameNode_ = StepperNode::GetOrCreateStepperNode(V2::STEPPER_ETS_TAG,
ViewStackProcessor::GetInstance()->ClaimNodeId(), []() { return AceType::MakeRefPtr<StepperPattern>(); });
ASSERT_NE(frameNode_, nullptr);
stepperPattern_ = frameNode_->GetPattern<StepperPattern>();
ASSERT_NE(stepperPattern_, nullptr);
stepperAccessibilityProperty_ = frameNode_->GetAccessibilityProperty<StepperAccessibilityProperty>();
ASSERT_NE(stepperAccessibilityProperty_, nullptr);
swiperNode_ = FrameNode::GetOrCreateFrameNode(
V2::SWIPER_ETS_TAG, frameNode_->GetSwiperId(), []() { return AceType::MakeRefPtr<SwiperPattern>(); });
ASSERT_NE(swiperNode_, nullptr);
swiperNode_->MountToParent(frameNode_);
swiperLayoutProperty_ = swiperNode_->GetLayoutProperty<SwiperLayoutProperty>();
ASSERT_NE(swiperLayoutProperty_, nullptr);
}
/**
* @tc.name: StepperAccessibilityPropertyGetCurrentIndex001
* @tc.desc: Test GetCurrentIndex of stepper.
* @tc.type: FUNC
*/
HWTEST_F(StepperAccessibilityPropertyTestNg, StepperAccessibilityPropertyGetCurrentIndex001, TestSize.Level1)
{
InitStepperTestNg();
EXPECT_EQ(stepperAccessibilityProperty_->GetCurrentIndex(), STEPPER_ERROR);
for (int i = 0; i <= INDEX_NUM; i++) {
auto indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
ElementRegister::GetInstance()->MakeUniqueId(),
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
ASSERT_NE(indicatorNode, nullptr);
swiperNode_->AddChild(indicatorNode);
}
stepperPattern_->index_ = INDEX_NUM;
swiperLayoutProperty_->UpdateShowIndicator(false);
EXPECT_EQ(stepperAccessibilityProperty_->GetCurrentIndex(), INDEX_NUM);
}
/**
* @tc.name: StepperAccessibilityPropertyGetBeginIndex001
* @tc.desc: Test GetBeginIndex of stepper.
* @tc.type: FUNC
*/
HWTEST_F(StepperAccessibilityPropertyTestNg, StepperAccessibilityPropertyGetBeginIndex001, TestSize.Level1)
{
InitStepperTestNg();
EXPECT_EQ(stepperAccessibilityProperty_->GetBeginIndex(), STEPPER_ERROR);
for (int i = 0; i <= INDEX_NUM; i++) {
auto indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
ElementRegister::GetInstance()->MakeUniqueId(),
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
ASSERT_NE(indicatorNode, nullptr);
swiperNode_->AddChild(indicatorNode);
}
swiperLayoutProperty_->UpdateShowIndicator(false);
EXPECT_EQ(stepperAccessibilityProperty_->GetBeginIndex(), 0);
}
/**
* @tc.name: StepperAccessibilityPropertyGetEndIndex001
* @tc.desc: Test GetEndIndex of stepper.
* @tc.type: FUNC
*/
HWTEST_F(StepperAccessibilityPropertyTestNg, StepperAccessibilityPropertyGetEndIndex001, TestSize.Level1)
{
InitStepperTestNg();
EXPECT_EQ(stepperAccessibilityProperty_->GetEndIndex(), STEPPER_ERROR);
for (int i = 0; i <= INDEX_NUM; i++) {
auto indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
ElementRegister::GetInstance()->MakeUniqueId(),
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
ASSERT_NE(indicatorNode, nullptr);
swiperNode_->AddChild(indicatorNode);
}
swiperLayoutProperty_->UpdateShowIndicator(false);
EXPECT_EQ(stepperAccessibilityProperty_->GetEndIndex(), INDEX_NUM);
}
/**
* @tc.name: StepperAccessibilityPropertyIsScrollable001
* @tc.desc: Test IsScrollable of stepper.
* @tc.type: FUNC
*/
HWTEST_F(StepperAccessibilityPropertyTestNg, StepperAccessibilityPropertyIsScrollable001, TestSize.Level1)
{
InitStepperTestNg();
auto swiperLayoutProperty = swiperNode_->GetLayoutProperty<SwiperLayoutProperty>();
ASSERT_NE(swiperLayoutProperty, nullptr);
swiperLayoutProperty->UpdateLoop(false);
EXPECT_FALSE(stepperAccessibilityProperty_->IsScrollable());
for (int i = 0; i <= INDEX_NUM; i++) {
auto indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
ElementRegister::GetInstance()->MakeUniqueId(),
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
ASSERT_NE(indicatorNode, nullptr);
swiperNode_->AddChild(indicatorNode);
}
swiperLayoutProperty_->UpdateShowIndicator(false);
auto swiperPattern = swiperNode_->GetPattern<SwiperPattern>();
EXPECT_TRUE(stepperAccessibilityProperty_->IsScrollable());
}
/**
* @tc.name: StepperAccessibilityPropertyGetCollectionItemCounts001
* @tc.desc: Test GetCollectionItemCounts of stepper.
* @tc.type: FUNC
*/
HWTEST_F(StepperAccessibilityPropertyTestNg, StepperAccessibilityPropertyGetCollectionItemCounts001, TestSize.Level1)
{
InitStepperTestNg();
EXPECT_EQ(stepperAccessibilityProperty_->GetCollectionItemCounts(), STEPPER_ERROR);
for (int i = 0; i < INDEX_NUM; i++) {
auto indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
ElementRegister::GetInstance()->MakeUniqueId(),
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
ASSERT_NE(indicatorNode, nullptr);
swiperNode_->AddChild(indicatorNode);
}
swiperLayoutProperty_->UpdateShowIndicator(false);
EXPECT_EQ(stepperAccessibilityProperty_->GetCollectionItemCounts(), INDEX_NUM);
}
/**
* @tc.name: StepperAccessibilityPropertyGetSupportAction001
* @tc.desc: Test GetSupportAction of stepper.
* @tc.type: FUNC
*/
HWTEST_F(StepperAccessibilityPropertyTestNg, StepperAccessibilityPropertyGetSupportAction001, TestSize.Level1)
{
InitStepperTestNg();
auto swiperLayoutProperty = swiperNode_->GetLayoutProperty<SwiperLayoutProperty>();
ASSERT_NE(swiperLayoutProperty, nullptr);
swiperLayoutProperty->UpdateLoop(false);
swiperLayoutProperty_->UpdateShowIndicator(false);
for (int index = 0; index <= INDEX_NUM; index++) {
RefPtr<FrameNode> indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
ElementRegister::GetInstance()->MakeUniqueId(),
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
ASSERT_NE(indicatorNode, nullptr);
swiperNode_->AddChild(indicatorNode);
}
stepperPattern_->index_ = 1;
stepperAccessibilityProperty_->ResetSupportAction();
std::unordered_set<AceAction> supportAceActions = stepperAccessibilityProperty_->GetSupportAction();
uint64_t actions = 0, expectActions = 0;
expectActions |= 1UL << static_cast<uint32_t>(AceAction::ACTION_SCROLL_FORWARD);
expectActions |= 1UL << static_cast<uint32_t>(AceAction::ACTION_SCROLL_BACKWARD);
for (auto action : supportAceActions) {
actions |= 1UL << static_cast<uint32_t>(action);
}
EXPECT_EQ(actions, expectActions);
swiperLayoutProperty->UpdateLoop(true);
stepperAccessibilityProperty_->ResetSupportAction();
supportAceActions = stepperAccessibilityProperty_->GetSupportAction();
actions = 0;
for (auto action : supportAceActions) {
actions |= 1UL << static_cast<uint32_t>(action);
}
EXPECT_EQ(actions, expectActions);
}
} // namespace OHOS::Ace::NG

Some files were not shown because too many files have changed in this diff Show More