mirror of
https://gitee.com/openharmony/accessibility
synced 2024-11-27 00:51:07 +00:00
fix compile bug
Signed-off-by: xiaojianfeng <xiaojianfeng3@huawei.com> Change-Id: I67a80ac387f010cdc250fe946c013d09ebd06e19
This commit is contained in:
parent
21c52c9012
commit
9da2a0a3f6
@ -17,71 +17,12 @@
|
||||
#include "windowmanager/utils/include/display_info.h"
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
class Display::Impl : public RefBase {
|
||||
friend class Display;
|
||||
Impl() = default;
|
||||
~Impl() = default;
|
||||
|
||||
private:
|
||||
std::string name_;
|
||||
DisplayId id_ { DISPLAY_ID_INVALD };
|
||||
int32_t width_ { 0 };
|
||||
int32_t height_ { 0 };
|
||||
uint32_t freshRate_ { 0 };
|
||||
class MockDisplay : public Display {
|
||||
public:
|
||||
MockDisplay(const std::string &name, sptr<DisplayInfo> info);
|
||||
};
|
||||
|
||||
Display::Display(const std::string& name, DisplayInfo* info)
|
||||
: pImpl_(new Impl())
|
||||
MockDisplay::MockDisplay(const std::string& name, sptr<DisplayInfo> info) : Display(name, info)
|
||||
{
|
||||
pImpl_->name_ = name;
|
||||
pImpl_->id_ = info->id_;
|
||||
pImpl_->width_ = info->width_;
|
||||
pImpl_->height_ = info->height_;
|
||||
pImpl_->freshRate_ = info->freshRate_;
|
||||
}
|
||||
|
||||
DisplayId Display::GetId() const
|
||||
{
|
||||
return pImpl_->id_;
|
||||
}
|
||||
|
||||
int32_t Display::GetWidth() const
|
||||
{
|
||||
return pImpl_->width_;
|
||||
}
|
||||
|
||||
int32_t Display::GetHeight() const
|
||||
{
|
||||
return pImpl_->height_;
|
||||
}
|
||||
|
||||
uint32_t Display::GetFreshRate() const
|
||||
{
|
||||
return pImpl_->freshRate_;
|
||||
}
|
||||
|
||||
void Display::SetWidth(int32_t width)
|
||||
{
|
||||
pImpl_->width_ = width;
|
||||
}
|
||||
|
||||
void Display::SetHeight(int32_t height)
|
||||
{
|
||||
pImpl_->height_ = height;
|
||||
}
|
||||
|
||||
void Display::SetFreshRate(uint32_t freshRate)
|
||||
{
|
||||
pImpl_->freshRate_ = freshRate;
|
||||
}
|
||||
|
||||
float Display::GetVirtualPixelRatio() const
|
||||
{
|
||||
return 2.0f;
|
||||
}
|
||||
|
||||
void Display::SetId(DisplayId id)
|
||||
{
|
||||
pImpl_->id_ = id;
|
||||
}
|
||||
} // namespace OHOS::Rosen
|
28
services/aams/test/mock/mock_display_info.cpp
Normal file
28
services/aams/test/mock/mock_display_info.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2022 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 "display.h"
|
||||
#include "windowmanager/utils/include/display_info.h"
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
class MockDisplayInfo : public DisplayInfo {
|
||||
public:
|
||||
MockDisplayInfo();
|
||||
};
|
||||
|
||||
MockDisplayInfo::MockDisplayInfo() : DisplayInfo()
|
||||
{
|
||||
}
|
||||
} // namespace OHOS::Rosen
|
@ -23,9 +23,7 @@
|
||||
#include "singleton_delegator.h"
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
|
||||
WM_IMPLEMENT_SINGLE_INSTANCE(DisplayManager)
|
||||
|
||||
class DisplayManager::Impl : public RefBase {
|
||||
friend class DisplayManager;
|
||||
private:
|
||||
@ -79,7 +77,7 @@ DisplayManager::~DisplayManager()
|
||||
|
||||
DisplayId DisplayManager::GetDefaultDisplayId()
|
||||
{
|
||||
DisplayId id{0};
|
||||
DisplayId id {0};
|
||||
return id;
|
||||
}
|
||||
|
||||
@ -101,13 +99,7 @@ std::shared_ptr<Media::PixelMap> DisplayManager::GetScreenshot(DisplayId display
|
||||
|
||||
const sptr<Display> DisplayManager::GetDefaultDisplay()
|
||||
{
|
||||
DisplayInfo info;
|
||||
info.id_ = 1;
|
||||
info.width_ = 1000;
|
||||
info.height_ = 1000;
|
||||
info.freshRate_ = 0;
|
||||
sptr<Display> display = new Display("name", &info);
|
||||
return display;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<DisplayId> DisplayManager::GetAllDisplayIds()
|
||||
|
@ -17,71 +17,13 @@
|
||||
#include "windowmanager/utils/include/display_info.h"
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
class Display::Impl : public RefBase {
|
||||
friend class Display;
|
||||
Impl() = default;
|
||||
~Impl() = default;
|
||||
|
||||
private:
|
||||
std::string name_;
|
||||
DisplayId id_ { DISPLAY_ID_INVALD };
|
||||
int32_t width_ { 0 };
|
||||
int32_t height_ { 0 };
|
||||
uint32_t freshRate_ { 0 };
|
||||
class MockDisplay : public Display {
|
||||
public:
|
||||
MockDisplay(const std::string &name, sptr<DisplayInfo> info);
|
||||
~MockDisplay() = default;
|
||||
};
|
||||
|
||||
Display::Display(const std::string& name, DisplayInfo* info)
|
||||
: pImpl_(new Impl())
|
||||
MockDisplay::MockDisplay(const std::string& name, sptr<DisplayInfo> info) : Display(name, info)
|
||||
{
|
||||
pImpl_->name_ = name;
|
||||
pImpl_->id_ = info->id_;
|
||||
pImpl_->width_ = info->width_;
|
||||
pImpl_->height_ = info->height_;
|
||||
pImpl_->freshRate_ = info->freshRate_;
|
||||
}
|
||||
|
||||
DisplayId Display::GetId() const
|
||||
{
|
||||
return pImpl_->id_;
|
||||
}
|
||||
|
||||
int32_t Display::GetWidth() const
|
||||
{
|
||||
return pImpl_->width_;
|
||||
}
|
||||
|
||||
int32_t Display::GetHeight() const
|
||||
{
|
||||
return pImpl_->height_;
|
||||
}
|
||||
|
||||
uint32_t Display::GetFreshRate() const
|
||||
{
|
||||
return pImpl_->freshRate_;
|
||||
}
|
||||
|
||||
void Display::SetWidth(int32_t width)
|
||||
{
|
||||
pImpl_->width_ = width;
|
||||
}
|
||||
|
||||
void Display::SetHeight(int32_t height)
|
||||
{
|
||||
pImpl_->height_ = height;
|
||||
}
|
||||
|
||||
void Display::SetFreshRate(uint32_t freshRate)
|
||||
{
|
||||
pImpl_->freshRate_ = freshRate;
|
||||
}
|
||||
|
||||
float Display::GetVirtualPixelRatio() const
|
||||
{
|
||||
return 2.0f;
|
||||
}
|
||||
|
||||
void Display::SetId(DisplayId id)
|
||||
{
|
||||
pImpl_->id_ = id;
|
||||
}
|
||||
} // namespace OHOS::Rosen
|
@ -19,16 +19,12 @@
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
// #include "display_manager_adapter.h"
|
||||
#include "display_manager_agent.h"
|
||||
#include "dm_common.h"
|
||||
#include "singleton_delegator.h"
|
||||
// #include "window_manager_hilog.h"
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
|
||||
WM_IMPLEMENT_SINGLE_INSTANCE(DisplayManager)
|
||||
|
||||
class DisplayManager::Impl : public RefBase {
|
||||
friend class DisplayManager;
|
||||
private:
|
||||
@ -82,7 +78,7 @@ DisplayManager::~DisplayManager()
|
||||
|
||||
DisplayId DisplayManager::GetDefaultDisplayId()
|
||||
{
|
||||
DisplayId id{0};
|
||||
DisplayId id {0};
|
||||
return id;
|
||||
}
|
||||
|
||||
@ -104,13 +100,7 @@ std::shared_ptr<Media::PixelMap> DisplayManager::GetScreenshot(DisplayId display
|
||||
|
||||
const sptr<Display> DisplayManager::GetDefaultDisplay()
|
||||
{
|
||||
DisplayInfo info;
|
||||
info.id_ = 1;
|
||||
info.width_ = 0;
|
||||
info.height_ = 0;
|
||||
info.freshRate_ = 0;
|
||||
sptr<Display> display = new Display("name", &info);
|
||||
return display;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<DisplayId> DisplayManager::GetAllDisplayIds()
|
||||
|
Loading…
Reference in New Issue
Block a user