mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2024-11-27 09:10:54 +00:00
fix tdd
Signed-off-by: y30066316 <yanglusheng@h-partners.com> Change-Id: I2e2bda09e747e8abad86b6e2677fd469df9fe292
This commit is contained in:
parent
bad486c136
commit
8083a8a04c
@ -214,7 +214,7 @@ ohos_unittest("RSSkpCaptureDFXTest") {
|
||||
}
|
||||
}
|
||||
|
||||
## Build rs_test_common.a {{{
|
||||
## Build rs_test_common.a
|
||||
config("rs_test_common_public_config") {
|
||||
include_dirs = [
|
||||
"$graphic_2d_root/rosen/include",
|
||||
|
@ -121,7 +121,7 @@ HWTEST_F(RSUIFirstSurfaceRenderNodeDrawableTest, GetCacheSurfaceTest, TestSize.L
|
||||
* @tc.name: GetCompletedImage
|
||||
* @tc.desc: Test If GetCompletedImage Can Run
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: #I9NVOG
|
||||
* @tc.require: #IB1MHP
|
||||
*/
|
||||
HWTEST_F(RSUIFirstSurfaceRenderNodeDrawableTest, GetCompletedImageTest, TestSize.Level1)
|
||||
{
|
||||
@ -131,17 +131,17 @@ HWTEST_F(RSUIFirstSurfaceRenderNodeDrawableTest, GetCompletedImageTest, TestSize
|
||||
uint32_t threadIndex = 1;
|
||||
bool isUIFirst = true;
|
||||
|
||||
Drawing::Canvas* drawingCanvas = new Drawing::Canvas(DEFAULT_CANVAS_SIZE, DEFAULT_CANVAS_SIZE);
|
||||
auto rscanvas = static_cast<RSPaintFilterCanvas*>(drawingCanvas);
|
||||
auto result = surfaceDrawable_->GetCompletedImage(*rscanvas, threadIndex, isUIFirst);
|
||||
drawingCanvas_ = std::make_unique<Drawing::Canvas>(DEFAULT_CANVAS_SIZE, DEFAULT_CANVAS_SIZE);
|
||||
auto rscanvas = RSPaintFilterCanvas(drawingCanvas_.get());
|
||||
auto result = surfaceDrawable_->GetCompletedImage(rscanvas, threadIndex, isUIFirst);
|
||||
EXPECT_EQ(result, nullptr);
|
||||
|
||||
isUIFirst = false;
|
||||
result = surfaceDrawable_->GetCompletedImage(*rscanvas, threadIndex, isUIFirst);
|
||||
result = surfaceDrawable_->GetCompletedImage(rscanvas, threadIndex, isUIFirst);
|
||||
ASSERT_EQ(result, nullptr);
|
||||
|
||||
surfaceDrawable_->cacheCompletedSurface_ = std::make_shared<Drawing::Surface>();
|
||||
result = surfaceDrawable_->GetCompletedImage(*rscanvas, threadIndex, isUIFirst);
|
||||
result = surfaceDrawable_->GetCompletedImage(rscanvas, threadIndex, isUIFirst);
|
||||
ASSERT_EQ(result, nullptr);
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ HWTEST_F(RSUIFirstSurfaceRenderNodeDrawableTest, GetCompletedImageTest, TestSize
|
||||
* @tc.name: DrawCacheSurface
|
||||
* @tc.desc: Test If DrawCacheSurface Can Run
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: #I9NVOG
|
||||
* @tc.require: #IB1MHP
|
||||
*/
|
||||
HWTEST_F(RSUIFirstSurfaceRenderNodeDrawableTest, DrawCacheSurfaceTest, TestSize.Level1)
|
||||
{
|
||||
@ -159,17 +159,17 @@ HWTEST_F(RSUIFirstSurfaceRenderNodeDrawableTest, DrawCacheSurfaceTest, TestSize.
|
||||
Vector2f boundSize;
|
||||
uint32_t threadIndex = 1;
|
||||
bool isUIFirst = false;
|
||||
Drawing::Canvas* drawingCanvas = new Drawing::Canvas(DEFAULT_CANVAS_SIZE, DEFAULT_CANVAS_SIZE);
|
||||
auto rscanvas = static_cast<RSPaintFilterCanvas*>(drawingCanvas);
|
||||
auto result = surfaceDrawable_->DrawCacheSurface(*rscanvas, boundSize, threadIndex, isUIFirst);
|
||||
drawingCanvas_ = std::make_unique<Drawing::Canvas>(DEFAULT_CANVAS_SIZE, DEFAULT_CANVAS_SIZE);
|
||||
auto rscanvas = RSPaintFilterCanvas(drawingCanvas_.get());
|
||||
auto result = surfaceDrawable_->DrawCacheSurface(rscanvas, boundSize, threadIndex, isUIFirst);
|
||||
EXPECT_FALSE(result);
|
||||
|
||||
surfaceDrawable_->boundsWidth_ = 1.f;
|
||||
result = surfaceDrawable_->DrawCacheSurface(*rscanvas, boundSize, threadIndex, isUIFirst);
|
||||
result = surfaceDrawable_->DrawCacheSurface(rscanvas, boundSize, threadIndex, isUIFirst);
|
||||
EXPECT_FALSE(result);
|
||||
|
||||
surfaceDrawable_->boundsHeight_ = 1.f;
|
||||
result = surfaceDrawable_->DrawCacheSurface(*rscanvas, boundSize, threadIndex, isUIFirst);
|
||||
result = surfaceDrawable_->DrawCacheSurface(rscanvas, boundSize, threadIndex, isUIFirst);
|
||||
EXPECT_FALSE(result);
|
||||
}
|
||||
|
||||
@ -253,15 +253,15 @@ HWTEST_F(RSUIFirstSurfaceRenderNodeDrawableTest, IsCurFrameStaticTest, TestSize.
|
||||
* @tc.name: SubDraw
|
||||
* @tc.desc: Test If SubDraw Can Run
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: #I9NVOG
|
||||
* @tc.require: #IB1MHP
|
||||
*/
|
||||
HWTEST_F(RSUIFirstSurfaceRenderNodeDrawableTest, SubDrawTest, TestSize.Level1)
|
||||
{
|
||||
if (surfaceDrawable_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
Drawing::Canvas* drawingCanvas = new Drawing::Canvas(DEFAULT_CANVAS_SIZE, DEFAULT_CANVAS_SIZE);
|
||||
surfaceDrawable_->SubDraw(*drawingCanvas);
|
||||
drawingCanvas_ = std::make_unique<Drawing::Canvas>(DEFAULT_CANVAS_SIZE, DEFAULT_CANVAS_SIZE);
|
||||
surfaceDrawable_->SubDraw(*drawingCanvas_.get());
|
||||
EXPECT_TRUE(surfaceDrawable_->uifirstDrawCmdList_.empty());
|
||||
}
|
||||
|
||||
@ -269,25 +269,25 @@ HWTEST_F(RSUIFirstSurfaceRenderNodeDrawableTest, SubDrawTest, TestSize.Level1)
|
||||
* @tc.name: DrawUIFirstCache
|
||||
* @tc.desc: Test If DrawUIFirstCache Can Run
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: #I9NVOG
|
||||
* @tc.require: #IB1MHP
|
||||
*/
|
||||
HWTEST_F(RSUIFirstSurfaceRenderNodeDrawableTest, DrawUIFirstCacheTest, TestSize.Level1)
|
||||
{
|
||||
if (surfaceDrawable_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
Drawing::Canvas* drawingCanvas = new Drawing::Canvas(DEFAULT_CANVAS_SIZE, DEFAULT_CANVAS_SIZE);
|
||||
auto rscanvas = static_cast<RSPaintFilterCanvas*>(drawingCanvas);
|
||||
auto result = surfaceDrawable_->DrawUIFirstCache(*rscanvas, true);
|
||||
drawingCanvas_ = std::make_unique<Drawing::Canvas>(DEFAULT_CANVAS_SIZE, DEFAULT_CANVAS_SIZE);
|
||||
auto rscanvas = RSPaintFilterCanvas(drawingCanvas_.get());
|
||||
auto result = surfaceDrawable_->DrawUIFirstCache(rscanvas, true);
|
||||
EXPECT_EQ(result, false);
|
||||
ASSERT_FALSE(surfaceDrawable_->HasCachedTexture());
|
||||
|
||||
result = surfaceDrawable_->DrawUIFirstCache(*rscanvas, false);
|
||||
result = surfaceDrawable_->DrawUIFirstCache(rscanvas, false);
|
||||
EXPECT_EQ(result, false);
|
||||
|
||||
surfaceDrawable_->isTextureValid_.store(true);
|
||||
ASSERT_TRUE(surfaceDrawable_->HasCachedTexture());
|
||||
result = surfaceDrawable_->DrawUIFirstCache(*rscanvas, false);
|
||||
result = surfaceDrawable_->DrawUIFirstCache(rscanvas, false);
|
||||
EXPECT_EQ(result, false);
|
||||
surfaceDrawable_->isTextureValid_.store(false);
|
||||
}
|
||||
@ -296,13 +296,13 @@ HWTEST_F(RSUIFirstSurfaceRenderNodeDrawableTest, DrawUIFirstCacheTest, TestSize.
|
||||
* @tc.name: DrawUIFirstCacheWithStarting
|
||||
* @tc.desc: Test If DrawUIFirstCacheWithStarting Can Run
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issueIAH6OI
|
||||
* @tc.require: #IB1MHP
|
||||
*/
|
||||
HWTEST_F(RSUIFirstSurfaceRenderNodeDrawableTest, DrawUIFirstCacheWithStartingTest, TestSize.Level1)
|
||||
{
|
||||
ASSERT_NE(surfaceDrawable_, nullptr);
|
||||
Drawing::Canvas* drawingCanvas = new Drawing::Canvas(DEFAULT_CANVAS_SIZE, DEFAULT_CANVAS_SIZE);
|
||||
auto rscanvas = static_cast<RSPaintFilterCanvas*>(drawingCanvas);
|
||||
drawingCanvas_ = std::make_unique<Drawing::Canvas>(DEFAULT_CANVAS_SIZE, DEFAULT_CANVAS_SIZE);
|
||||
auto rscanvas = static_cast<RSPaintFilterCanvas*>(drawingCanvas_.get());
|
||||
NodeId id = 0;
|
||||
auto result = surfaceDrawable_->DrawUIFirstCacheWithStarting(*rscanvas, id);
|
||||
ASSERT_FALSE(result);
|
||||
|
@ -30,6 +30,7 @@ group("unittest") {
|
||||
":RSHardwareThreadTest",
|
||||
":RSMainThreadTest",
|
||||
":RSPhysicalScreenProcessorTest",
|
||||
":RSPointerWindowManagerTest",
|
||||
":RSProcessorFactoryTest",
|
||||
":RSRealtimeRefreshRateManagerTest",
|
||||
":RSRenderEngineTest",
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "pipeline/rs_context.h"
|
||||
#include "pipeline/rs_pointer_window_manager.h"
|
||||
#include "pipeline/rs_uni_render_processor.h"
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
@ -60,4 +61,51 @@ HWTEST_F(RSPointerWindowManagerTest, UpdatePointerDirtyToGlobalDirtyTest, TestSi
|
||||
rsPointerWindowManager->UpdatePointerDirtyToGlobalDirty(node, displayNode);
|
||||
ASSERT_NE(rsPointerWindowManager->IsNeedForceCommitByPointer(), true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @tc.name: SetHardCursorNodeInfo001
|
||||
* @tc.desc: Test SetHardCursorNodeInfo
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: #IB1MHP
|
||||
*/
|
||||
HWTEST_F(RSPointerWindowManagerTest, SetHardCursorNodeInfoTest001, TestSize.Level2)
|
||||
{
|
||||
auto surfaceNode = std::make_shared<RSSurfaceRenderNode>(1);
|
||||
auto rsPointerWindowManager = RSPointerWindowManager::Instance();
|
||||
rsPointerWindowManager.SetHardCursorNodeInfo(surfaceNode);
|
||||
ASSERT_EQ(rsPointerWindowManager.hardCursorNodes_, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: SetHardCursorNodeInfo002
|
||||
* @tc.desc: Test SetHardCursorNodeInfo
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: #IB1MHP
|
||||
*/
|
||||
HWTEST_F(RSPointerWindowManagerTest, SetHardCursorNodeInfoTest002, TestSize.Level2)
|
||||
{
|
||||
auto surfaceNode = std::make_shared<RSSurfaceRenderNode>(1);
|
||||
surfaceNode->nodeType_ = RSSurfaceNodeType::SELF_DRAWING_WINDOW_NODE;
|
||||
surfaceNode->name_ = "pointer window";
|
||||
auto& rsPointerWindowManager = RSPointerWindowManager::Instance();
|
||||
rsPointerWindowManager.SetHardCursorNodeInfo(surfaceNode);
|
||||
ASSERT_NE(rsPointerWindowManager.hardCursorNodes_, nullptr);
|
||||
}
|
||||
/**
|
||||
* @tc.name: HardCursorCreateLayerForDirect
|
||||
* @tc.desc: Test HardCursorCreateLayerForDirect
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: #IB1MHP
|
||||
*/
|
||||
HWTEST_F(RSPointerWindowManagerTest, HardCursorCreateLayerForDirectTest, TestSize.Level2)
|
||||
{
|
||||
auto processor = std::make_shared<RSUniRenderProcessor>();
|
||||
ASSERT_NE(processor, nullptr);
|
||||
auto& rsPointerWindowManager = RSPointerWindowManager::Instance();
|
||||
auto& hardCursorNodes = rsPointerWindowManager.GetHardCursorNode();
|
||||
ASSERT_NE(hardCursorNodes, nullptr);
|
||||
hardCursorNodes->stagingRenderParams_ = std::make_unique<RSSurfaceRenderParams>(1);
|
||||
rsPointerWindowManager.HardCursorCreateLayerForDirect(processor);
|
||||
}
|
||||
} // OHOS::Rosen
|
@ -69,24 +69,7 @@ HWTEST_F(RSUniRenderThreadTest, InitGrContext001, TestSize.Level1)
|
||||
{
|
||||
RSUniRenderThread& instance = RSUniRenderThread::Instance();
|
||||
instance.InitGrContext();
|
||||
EXPECT_TRUE(instance.uniRenderEngine_);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: Start001
|
||||
* @tc.desc: Test Start
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issueIAE59W
|
||||
*/
|
||||
HWTEST_F(RSUniRenderThreadTest, Start001, TestSize.Level1)
|
||||
{
|
||||
RSUniRenderThread& instance = RSUniRenderThread::Instance();
|
||||
instance.rootNodeDrawable_ = nullptr;
|
||||
instance.Start();
|
||||
EXPECT_TRUE(instance.rootNodeDrawable_);
|
||||
|
||||
instance.Start();
|
||||
EXPECT_TRUE(instance.handler_);
|
||||
ASSERT_NE(instance.uniRenderEngine_, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,7 +83,7 @@ HWTEST_F(RSUniRenderThreadTest, GetRenderEngine001, TestSize.Level1)
|
||||
RSUniRenderThread& instance = RSUniRenderThread::Instance();
|
||||
instance.uniRenderEngine_ = std::make_shared<RSRenderEngine>();
|
||||
instance.GetRenderEngine();
|
||||
EXPECT_TRUE(instance.uniRenderEngine_);
|
||||
ASSERT_NE(instance.uniRenderEngine_, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -114,11 +97,11 @@ HWTEST_F(RSUniRenderThreadTest, PostTask001, TestSize.Level1)
|
||||
RSUniRenderThread& instance = RSUniRenderThread::Instance();
|
||||
std::function<void()> task = []() {};
|
||||
instance.PostTask(task);
|
||||
EXPECT_TRUE(instance.handler_);
|
||||
ASSERT_EQ(instance.handler_, nullptr);
|
||||
|
||||
instance.handler_ = nullptr;
|
||||
instance.PostTask(task);
|
||||
EXPECT_FALSE(instance.handler_);
|
||||
ASSERT_EQ(instance.handler_, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -155,15 +138,12 @@ HWTEST_F(RSUniRenderThreadTest, PostImageReleaseTask001, TestSize.Level1)
|
||||
EXPECT_TRUE(instance.postImageReleaseTaskFlag_);
|
||||
|
||||
instance.postImageReleaseTaskFlag_ = false;
|
||||
auto product = system::GetParameter("const.build.product", "");
|
||||
system::SetParameter("const.build.product", "ALN");
|
||||
instance.PostImageReleaseTask(task);
|
||||
EXPECT_FALSE(instance.postImageReleaseTaskFlag_);
|
||||
|
||||
instance.tid_ = 0;
|
||||
instance.PostImageReleaseTask(task);
|
||||
EXPECT_FALSE(instance.postImageReleaseTaskFlag_);
|
||||
system::SetParameter("const.build.product", product);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -239,22 +219,6 @@ HWTEST_F(RSUniRenderThreadTest, PostSyncTask001, TestSize.Level1)
|
||||
EXPECT_TRUE(instance.handler_);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: IsIdleAndSync001
|
||||
* @tc.desc: Test IsIdle And Sync
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issueIAE59W
|
||||
*/
|
||||
HWTEST_F(RSUniRenderThreadTest, IsIdleAndSync001, TestSize.Level1)
|
||||
{
|
||||
RSUniRenderThread& instance = RSUniRenderThread::Instance();
|
||||
bool res = instance.IsIdle();
|
||||
EXPECT_TRUE(res);
|
||||
|
||||
RSRenderThreadParamsManager::Instance().renderThreadParams_ = std::make_unique<RSRenderThreadParams>();
|
||||
EXPECT_TRUE(instance.GetRSRenderThreadParams());
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: Render001
|
||||
* @tc.desc: Test Render
|
||||
@ -265,6 +229,9 @@ HWTEST_F(RSUniRenderThreadTest, Render001, TestSize.Level1)
|
||||
{
|
||||
RSUniRenderThread& instance = RSUniRenderThread::Instance();
|
||||
RSMainThread::Instance()->handler_ = std::make_shared<AppExecFwk::EventHandler>(instance.runner_);
|
||||
const std::shared_ptr<RSBaseRenderNode> rootNode = RSMainThread::Instance()->GetContext().GetGlobalRootRenderNode();
|
||||
auto ptr = DrawableV2::RSRenderNodeDrawableAdapter::OnGenerate(rootNode);
|
||||
instance.rootNodeDrawable_ = std::static_pointer_cast<DrawableV2::RSRenderNodeDrawable>(ptr);
|
||||
instance.Render();
|
||||
EXPECT_TRUE(instance.rootNodeDrawable_);
|
||||
|
||||
@ -346,7 +313,7 @@ HWTEST_F(RSUniRenderThreadTest, DefaultClearMemoryCache001, TestSize.Level1)
|
||||
{
|
||||
RSUniRenderThread& instance = RSUniRenderThread::Instance();
|
||||
instance.DefaultClearMemoryCache();
|
||||
EXPECT_TRUE(instance.clearMemoryFinished_);
|
||||
EXPECT_FALSE(instance.clearMemoryFinished_);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -360,7 +327,7 @@ HWTEST_F(RSUniRenderThreadTest, ResetClearMemoryTask001, TestSize.Level1)
|
||||
RSUniRenderThread& instance = RSUniRenderThread::Instance();
|
||||
std::unordered_map<NodeId, bool> ids1;
|
||||
instance.ResetClearMemoryTask(std::move(ids1));
|
||||
EXPECT_TRUE(instance.clearMemoryFinished_);
|
||||
EXPECT_FALSE(instance.clearMemoryFinished_);
|
||||
|
||||
instance.clearMemoryFinished_ = true;
|
||||
std::unordered_map<NodeId, bool> ids2;
|
||||
@ -488,13 +455,12 @@ HWTEST_F(RSUniRenderThreadTest, GetRefreshRate001, TestSize.Level1)
|
||||
HWTEST_F(RSUniRenderThreadTest, ReleaseSelfDrawingNodeBuffer001, TestSize.Level1)
|
||||
{
|
||||
RSUniRenderThread& instance = RSUniRenderThread::Instance();
|
||||
auto surfaceRenderNode = std::make_shared<RSSurfaceRenderNode>(0);
|
||||
std::shared_ptr<const RSRenderNode> node = std::make_shared<const RSRenderNode>(0);
|
||||
surfaceRenderNode->renderDrawable_ = std::make_shared<RSRenderNodeDrawable>(std::move(node));
|
||||
surfaceRenderNode->renderDrawable_->renderParams_ = std::make_unique<RSSurfaceRenderParams>(0);
|
||||
auto surfaceDrawable =
|
||||
std::static_pointer_cast<DrawableV2::RSSurfaceRenderNodeDrawable>(surfaceRenderNode->renderDrawable_);
|
||||
surfaceDrawable->consumerOnDraw_ = IConsumerSurface::Create();
|
||||
auto surfaceRenderNode = std::make_shared<RSSurfaceRenderNode>(1);
|
||||
auto adapter = std::static_pointer_cast<DrawableV2::RSSurfaceRenderNodeDrawable>(
|
||||
DrawableV2::RSRenderNodeDrawableAdapter::OnGenerate(surfaceRenderNode));
|
||||
|
||||
adapter->consumerOnDraw_ = IConsumerSurface::Create();
|
||||
RSRenderThreadParamsManager::Instance().renderThreadParams_ = std::make_unique<RSRenderThreadParams>();
|
||||
instance.GetRSRenderThreadParams()->selfDrawables_.push_back(surfaceRenderNode->renderDrawable_);
|
||||
auto params = static_cast<RSSurfaceRenderParams*>(surfaceRenderNode->GetRenderParams().get());
|
||||
instance.ReleaseSelfDrawingNodeBuffer();
|
||||
|
Loading…
Reference in New Issue
Block a user