From dc5d42a5d32e58b2285c048c41d67a621d115072 Mon Sep 17 00:00:00 2001 From: lizheng Date: Wed, 22 Dec 2021 14:51:44 +0800 Subject: [PATCH] fix wmtest Change-Id: Id50c70ebfaf88385f0732032d1b802a10cc93f3c Signed-off-by: lizheng --- frameworks/wmtest/frameworks/inative_test.cpp | 5 ++- .../wmtest/test/wmclient_native_test_21.cpp | 42 +------------------ 2 files changed, 6 insertions(+), 41 deletions(-) diff --git a/frameworks/wmtest/frameworks/inative_test.cpp b/frameworks/wmtest/frameworks/inative_test.cpp index c307d28931..a8a1e12506 100644 --- a/frameworks/wmtest/frameworks/inative_test.cpp +++ b/frameworks/wmtest/frameworks/inative_test.cpp @@ -176,8 +176,11 @@ int32_t INativeTest::IPCServerStart() auto sam = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); constexpr int32_t sABegin = 4610; constexpr int32_t sAEnd = 4700; + IncStrongRef(this); for (int32_t i = sABegin; i < sAEnd; i++) { - if (sam->AddSystemAbility(i, this) == ERR_OK) { + GSLOG7SO(DEBUG) << "adding SystemAbility, SAID: " << i; + if (sam->AddSystemAbility(i, AsObject()) == ERR_OK) { + GSLOG7SO(DEBUG) << "AddSystemAbility Success"; said = i; return GSERROR_OK; } diff --git a/frameworks/wmtest/test/wmclient_native_test_21.cpp b/frameworks/wmtest/test/wmclient_native_test_21.cpp index 819e9e8b21..5dd13087ae 100644 --- a/frameworks/wmtest/test/wmclient_native_test_21.cpp +++ b/frameworks/wmtest/test/wmclient_native_test_21.cpp @@ -73,7 +73,7 @@ public: } } g_autoload; -class WMClientNativeTest21Sub0 : public WMClientNativeTest21, public IScreenShotCallback { +class WMClientNativeTest21Sub0 : public WMClientNativeTest21 { public: std::string GetDescription() const override { @@ -88,49 +88,14 @@ public: void Run(int32_t argc, const char **argv) override { - windowManager->ListenNextScreenShot(0, this); - } - - void OnScreenShot(const struct WMImageInfo &info) override - { - if (info.wret) { - GSLOG7SE(ERROR) << "screenshot failed with " << info.wret; - return; - } - GSLOG7SO(INFO) << "screenshot success"; - - auto addr = reinterpret_cast(info.data); - screenshot = std::make_unique(info.width * info.height); - for (uint32_t i = 0; i < info.width * info.height; i++) { - screenshot[i] = addr[i]; - } - screenshotWidth = info.width; - screenshotHeight = info.height; } void Run2() { sptr producer = iface_cast(remoteObject); psurf = Surface::CreateSurfaceAsProducer(producer); - auto func = std::bind(&WMClientNativeTest21Sub0::Draw, this, - std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4); SetVsyncRate(1); - subwindowSync = NativeTestSync::CreateSync(func, psurf); - } - - void Draw(uint32_t *addr, uint32_t width, uint32_t height, uint32_t count) - { - if (screenshot == nullptr) { - return; - } - - uint32_t copyWidth = width < screenshotWidth ? width : screenshotWidth; - uint32_t copyHeight = height < screenshotHeight ? height : screenshotHeight; - for (uint32_t j = 0; j < copyHeight; j++) { - for (uint32_t i = 0; i < copyWidth; i++) { - addr[j * width + i] = screenshot[j * screenshotWidth + i]; - } - } + subwindowSync = NativeTestSync::CreateSync(NativeTestDraw::RainbowDraw, psurf); } void IPCClientOnMessage(int32_t sequence, const std::string &message, const sptr &robj) override @@ -156,9 +121,6 @@ private: sptr remoteObject = nullptr; sptr psurf = nullptr; sptr subwindowSync = nullptr; - std::unique_ptr screenshot = nullptr; - uint32_t screenshotWidth = 0; - uint32_t screenshotHeight = 0; } g_autoload0; class WMClientNativeTest21Sub1 : public WMClientNativeTest21 {