mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-23 15:00:12 +00:00
标题栏按钮显示接口变更,支持控制关闭按钮
Signed-off-by: sunyalei <sunyalei@huawei.com>
This commit is contained in:
parent
1aadc171b5
commit
11e97b72ba
@ -1867,9 +1867,11 @@ public:
|
||||
* @param isMaximizeVisible Display maximize button if true, or hide maximize button if false.
|
||||
* @param isMinimizeVisible Display minimize button if true, or hide minimize button if false.
|
||||
* @param isSplitVisible Display split button if true, or hide split button if false.
|
||||
* @param isCloseVisible Display close button if true, or hide close button if false.
|
||||
* @return Errorcode of window.
|
||||
*/
|
||||
virtual WMError SetTitleButtonVisible(bool isMaximizeVisible, bool isMinimizeVisible, bool isSplitVisible)
|
||||
virtual WMError SetTitleButtonVisible(bool isMaximizeVisible, bool isMinimizeVisible, bool isSplitVisible,
|
||||
bool isCloseVisible)
|
||||
{
|
||||
return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
|
||||
}
|
||||
|
@ -47,6 +47,8 @@ constexpr int32_t MAX_DECOR_HEIGHT = 112;
|
||||
constexpr size_t INDEX_ZERO = 0;
|
||||
constexpr size_t INDEX_ONE = 1;
|
||||
constexpr size_t INDEX_TWO = 2;
|
||||
constexpr size_t INDEX_THREE = 3;
|
||||
constexpr size_t FOUR_PARAMES_SIZE = 4;
|
||||
constexpr double MIN_GRAY_SCALE = 0.0;
|
||||
constexpr double MAX_GRAY_SCALE = 1.0;
|
||||
constexpr uint32_t DEFAULT_WINDOW_MAX_WIDTH = 3840;
|
||||
@ -6049,7 +6051,7 @@ napi_value JsWindow::OnSetTitleButtonVisible(napi_env env, napi_callback_info in
|
||||
size_t argc = 4;
|
||||
napi_value argv[4] = {nullptr};
|
||||
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
|
||||
if (argc != 3) { // 3: params num
|
||||
if (argc < 3) { // 3: params num
|
||||
WLOGFE("Argc is invalid: %{public}zu", argc);
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM);
|
||||
}
|
||||
@ -6068,20 +6070,26 @@ napi_value JsWindow::OnSetTitleButtonVisible(napi_env env, napi_callback_info in
|
||||
TLOGE(WmsLogTag::WMS_LAYOUT, "Failed to convert parameter to isSplitVisible");
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM);
|
||||
}
|
||||
bool isCloseVisible = true;
|
||||
if (argc >= FOUR_PARAMES_SIZE && (!ConvertFromJsValue(env, argv[INDEX_THREE], isCloseVisible))) {
|
||||
TLOGE(WmsLogTag::WMS_LAYOUT, "Failed to convert parameter to isCloseVisible");
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM);
|
||||
}
|
||||
if (windowToken_ == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_LAYOUT, "WindowToken_ is nullptr");
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_STATE_ABNORMALLY);
|
||||
}
|
||||
WMError errCode = windowToken_->SetTitleButtonVisible(isMaximizeVisible, isMinimizeVisible, isSplitVisible);
|
||||
WMError errCode = windowToken_->SetTitleButtonVisible(isMaximizeVisible, isMinimizeVisible, isSplitVisible,
|
||||
isCloseVisible);
|
||||
WmErrorCode ret = WM_JS_TO_ERROR_CODE_MAP.at(errCode);
|
||||
if (ret != WmErrorCode::WM_OK) {
|
||||
TLOGE(WmsLogTag::WMS_LAYOUT, "set title button visible failed!");
|
||||
return NapiThrowError(env, ret);
|
||||
}
|
||||
TLOGI(WmsLogTag::WMS_LAYOUT,
|
||||
"Window [%{public}u, %{public}s] set title button visible [%{public}d, %{public}d, %{public}d]",
|
||||
"Window [%{public}u, %{public}s] set title button visible [%{public}d, %{public}d, %{public}d, %{public}d]",
|
||||
windowToken_->GetWindowId(), windowToken_->GetWindowName().c_str(), isMaximizeVisible, isMinimizeVisible,
|
||||
isSplitVisible);
|
||||
isSplitVisible, isCloseVisible);
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
|
||||
|
@ -314,7 +314,8 @@ public:
|
||||
virtual WMError SetSingleFrameComposerEnabled(bool enable) = 0;
|
||||
virtual WMError SetLandscapeMultiWindow(bool isLandscapeMultiWindow) = 0;
|
||||
virtual WMError SetDecorVisible(bool isVisible) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; }
|
||||
virtual WMError SetTitleButtonVisible(bool isMaximizeVisible, bool isMinimizeVisible, bool isSplitVisible)
|
||||
virtual WMError SetTitleButtonVisible(bool isMaximizeVisible, bool isMinimizeVisible, bool isSplitVisible,
|
||||
bool isCloseVisible)
|
||||
{
|
||||
return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
MOCK_METHOD3(UpdateViewportConfig, void(const ViewportConfig& config, OHOS::Rosen::WindowSizeChangeReason reason,
|
||||
const std::shared_ptr<OHOS::Rosen::RSTransaction>& rsTransaction));
|
||||
MOCK_METHOD2(UpdateWindowMode, void(OHOS::Rosen::WindowMode mode, bool hasDeco));
|
||||
MOCK_METHOD3(HideWindowTitleButton, void(bool hideSplit, bool hideMaximize, bool hideMinimize));
|
||||
MOCK_METHOD4(HideWindowTitleButton, void(bool hideSplit, bool hideMaximize, bool hideMinimize, bool hideClose));
|
||||
MOCK_METHOD2(UpdateTitleInTargetPos, void(bool isShow, int32_t height));
|
||||
MOCK_METHOD0(GetBackgroundColor, uint32_t());
|
||||
MOCK_METHOD1(SetBackgroundColor, void(uint32_t color));
|
||||
|
@ -55,6 +55,7 @@ struct WindowTitleVisibleFlags {
|
||||
bool isMaximizeVisible = true;
|
||||
bool isMinimizeVisible = true;
|
||||
bool isSplitVisible = true;
|
||||
bool isCloseVisible = true;
|
||||
};
|
||||
|
||||
class WindowSessionImpl : public Window, public virtual SessionStageStub {
|
||||
@ -176,7 +177,8 @@ public:
|
||||
WMError UnregisterScreenshotListener(const sptr<IScreenshotListener>& listener) override;
|
||||
void SetAceAbilityHandler(const sptr<IAceAbilityHandler>& handler) override;
|
||||
void SetInputEventConsumer(const std::shared_ptr<IInputEventConsumer>& inputEventConsumer) override;
|
||||
WMError SetTitleButtonVisible(bool isMaximizeVisible, bool isMinimizeVisible, bool isSplitVisible) override;
|
||||
WMError SetTitleButtonVisible(bool isMaximizeVisible, bool isMinimizeVisible, bool isSplitVisible,
|
||||
bool isCloseVisible) override;
|
||||
|
||||
WMError SetBackgroundColor(const std::string& color) override;
|
||||
virtual Orientation GetRequestedOrientation() override;
|
||||
@ -421,7 +423,8 @@ private:
|
||||
void NotifyRotationAnimationEnd();
|
||||
void SubmitNoInteractionMonitorTask(int32_t eventId, const IWindowNoInteractionListenerSptr& listener);
|
||||
bool IsUserOrientation(Orientation orientation) const;
|
||||
void GetTitleButtonVisible(bool isPC, bool& hideMaximizeButton, bool& hideMinimizeButton, bool& hideSplitButton);
|
||||
void GetTitleButtonVisible(bool isPC, bool& hideMaximizeButton, bool& hideMinimizeButton, bool& hideSplitButton,
|
||||
bool& hideCloseButton);
|
||||
WMError GetAppForceLandscapeConfig(AppForceLandscapeConfig& config);
|
||||
void SetForceSplitEnable(bool isForceSplit, const std::string& homePage = "");
|
||||
void SetFrameLayoutCallbackEnable(bool enable);
|
||||
|
@ -1148,7 +1148,7 @@ void WindowImpl::UpdateTitleButtonVisibility()
|
||||
(!(modeSupportInfo & WindowModeSupport::WINDOW_MODE_SUPPORT_FLOATING) &&
|
||||
GetMode() == WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
WLOGD("[Client] [hideSplit, hideMaximize]: [%{public}d, %{public}d]", hideSplitButton, hideMaximizeButton);
|
||||
uiContent_->HideWindowTitleButton(hideSplitButton, hideMaximizeButton, false);
|
||||
uiContent_->HideWindowTitleButton(hideSplitButton, hideMaximizeButton, false, false);
|
||||
}
|
||||
|
||||
bool WindowImpl::IsAppMainOrSubOrFloatingWindow()
|
||||
|
@ -692,7 +692,7 @@ void WindowSessionImpl::NotifyRotationAnimationEnd()
|
||||
}
|
||||
|
||||
void WindowSessionImpl::GetTitleButtonVisible(bool isPC, bool& hideMaximizeButton, bool& hideMinimizeButton,
|
||||
bool& hideSplitButton)
|
||||
bool& hideSplitButton, bool& hideCloseButton)
|
||||
{
|
||||
if (!isPC) {
|
||||
return;
|
||||
@ -709,6 +709,10 @@ void WindowSessionImpl::GetTitleButtonVisible(bool isPC, bool& hideMaximizeButto
|
||||
TLOGW(WmsLogTag::WMS_LAYOUT, "isSplitVisible param INVALID");
|
||||
}
|
||||
hideSplitButton = hideSplitButton || (!windowTitleVisibleFlags_.isSplitVisible);
|
||||
if (hideCloseButton > !windowTitleVisibleFlags_.isCloseVisible) {
|
||||
TLOGW(WmsLogTag::WMS_LAYOUT, "isCloseVisible param INVALID");
|
||||
}
|
||||
hideCloseButton = hideCloseButton || (!windowTitleVisibleFlags_.isCloseVisible);
|
||||
}
|
||||
|
||||
void WindowSessionImpl::UpdateDensity()
|
||||
@ -964,7 +968,7 @@ void WindowSessionImpl::UpdateTitleButtonVisibility()
|
||||
bool isDialogWindow = WindowHelper::IsDialogWindow(windowType);
|
||||
if ((isPC || IsFreeMultiWindowMode() || isPcAppInPad) && (isSubWindow || isDialogWindow)) {
|
||||
WLOGFD("hide other buttons except close");
|
||||
uiContent->HideWindowTitleButton(true, true, true);
|
||||
uiContent->HideWindowTitleButton(true, true, true, false);
|
||||
return;
|
||||
}
|
||||
auto modeSupportInfo = property_->GetModeSupportInfo();
|
||||
@ -975,13 +979,15 @@ void WindowSessionImpl::UpdateTitleButtonVisibility()
|
||||
(!(modeSupportInfo & WindowModeSupport::WINDOW_MODE_SUPPORT_FLOATING) &&
|
||||
GetMode() == WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
bool hideMinimizeButton = false;
|
||||
GetTitleButtonVisible(isPC, hideMaximizeButton, hideMinimizeButton, hideSplitButton);
|
||||
TLOGI(WmsLogTag::WMS_LAYOUT, "[hideSplit, hideMaximize, hideMinimizeButton]:[%{public}d, %{public}d, %{public}d]",
|
||||
hideSplitButton, hideMaximizeButton, hideMinimizeButton);
|
||||
bool hideCloseButton = false;
|
||||
GetTitleButtonVisible(isPC, hideMaximizeButton, hideMinimizeButton, hideSplitButton, hideCloseButton);
|
||||
TLOGI(WmsLogTag::WMS_LAYOUT, "[hideSplit, hideMaximize, hideMinimizeButton, hideCloseButton]:"
|
||||
"[%{public}d, %{public}d, %{public}d, %{public}d]",
|
||||
hideSplitButton, hideMaximizeButton, hideMinimizeButton, hideCloseButton);
|
||||
if (property_->GetCompatibleModeInPc()) {
|
||||
uiContent->HideWindowTitleButton(true, false, hideMinimizeButton);
|
||||
uiContent->HideWindowTitleButton(true, false, hideMinimizeButton, hideCloseButton);
|
||||
} else {
|
||||
uiContent->HideWindowTitleButton(hideSplitButton, hideMaximizeButton, hideMinimizeButton);
|
||||
uiContent->HideWindowTitleButton(hideSplitButton, hideMaximizeButton, hideMinimizeButton, hideCloseButton);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2186,7 +2192,8 @@ void WindowSessionImpl::SetInputEventConsumer(const std::shared_ptr<IInputEventC
|
||||
inputEventConsumer_ = inputEventConsumer;
|
||||
}
|
||||
|
||||
WMError WindowSessionImpl::SetTitleButtonVisible(bool isMaximizeVisible, bool isMinimizeVisible, bool isSplitVisible)
|
||||
WMError WindowSessionImpl::SetTitleButtonVisible(bool isMaximizeVisible, bool isMinimizeVisible, bool isSplitVisible,
|
||||
bool isCloseVisible)
|
||||
{
|
||||
if (!WindowHelper::IsMainWindow(GetType())) {
|
||||
return WMError::WM_ERROR_INVALID_CALLING;
|
||||
@ -2198,7 +2205,7 @@ WMError WindowSessionImpl::SetTitleButtonVisible(bool isMaximizeVisible, bool is
|
||||
if (!(windowSystemConfig_.IsPcWindow() || IsFreeMultiWindowMode() || isPcAppInPad)) {
|
||||
return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
|
||||
}
|
||||
windowTitleVisibleFlags_ = { isMaximizeVisible, isMinimizeVisible, isSplitVisible };
|
||||
windowTitleVisibleFlags_ = { isMaximizeVisible, isMinimizeVisible, isSplitVisible, isCloseVisible};
|
||||
UpdateTitleButtonVisibility();
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
|
@ -792,7 +792,7 @@ HWTEST_F(WindowImplTest2, SetWindowMode, Function | SmallTest | Level3)
|
||||
ASSERT_EQ(WMError::WM_OK, window->Create(INVALID_WINDOW_ID));
|
||||
window->uiContent_ = std::make_unique<Ace::UIContentMocker>();
|
||||
Ace::UIContentMocker* content = reinterpret_cast<Ace::UIContentMocker*>(window->uiContent_.get());
|
||||
EXPECT_CALL(*content, HideWindowTitleButton(_, _, _));
|
||||
EXPECT_CALL(*content, HideWindowTitleButton(_, _, _, _));
|
||||
EXPECT_CALL(*content, UpdateWindowMode(_, _));
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN));
|
||||
window->uiContent_ = nullptr;
|
||||
@ -1151,7 +1151,7 @@ HWTEST_F(WindowImplTest2, UpdateTitleButtonVisibility, Function | SmallTest | Le
|
||||
|
||||
window->uiContent_ = std::make_unique<Ace::UIContentMocker>();
|
||||
Ace::UIContentMocker* content = reinterpret_cast<Ace::UIContentMocker*>(window->uiContent_.get());
|
||||
EXPECT_CALL(*content, HideWindowTitleButton(_, _, _));
|
||||
EXPECT_CALL(*content, HideWindowTitleButton(_, _, _, _));
|
||||
window->UpdateTitleButtonVisibility();
|
||||
|
||||
EXPECT_CALL(m->Mock(), DestroyWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
|
@ -1294,7 +1294,7 @@ HWTEST_F(WindowImplTest5, UpdateTitleButtonVisibility02, Function | SmallTest |
|
||||
|
||||
window->uiContent_ = std::make_unique<Ace::UIContentMocker>();
|
||||
Ace::UIContentMocker* content = reinterpret_cast<Ace::UIContentMocker*>(window->uiContent_.get());
|
||||
EXPECT_CALL(*content, HideWindowTitleButton(_, _, _));
|
||||
EXPECT_CALL(*content, HideWindowTitleButton(_, _, _, _));
|
||||
window->windowSystemConfig_.isSystemDecorEnable_ = false;
|
||||
window->UpdateTitleButtonVisibility();
|
||||
|
||||
|
@ -1632,14 +1632,16 @@ HWTEST_F(WindowSceneSessionImplTest2, GetTitleButtonVisible01, Function | SmallT
|
||||
window->property_->SetModeSupportInfo(modeSupportInfo);
|
||||
window->property_->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
// show Maximize, Minimize, Split buttons.
|
||||
window->windowTitleVisibleFlags_ = { false, false, false };
|
||||
window->windowTitleVisibleFlags_ = { false, false, false, false};
|
||||
bool hideMaximizeButton = false;
|
||||
bool hideMinimizeButton = false;
|
||||
bool hideSplitButton = false;
|
||||
window->GetTitleButtonVisible(true, hideMaximizeButton, hideMinimizeButton, hideSplitButton);
|
||||
bool hideCloseButton = false;
|
||||
window->GetTitleButtonVisible(true, hideMaximizeButton, hideMinimizeButton, hideSplitButton, hideCloseButton);
|
||||
ASSERT_EQ(hideMaximizeButton, true);
|
||||
ASSERT_EQ(hideMinimizeButton, true);
|
||||
ASSERT_EQ(hideSplitButton, true);
|
||||
ASSERT_EQ(hideCloseButton, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1658,14 +1660,16 @@ HWTEST_F(WindowSceneSessionImplTest2, GetTitleButtonVisible02, Function | SmallT
|
||||
window->property_->SetModeSupportInfo(modeSupportInfo);
|
||||
window->property_->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
// show Maximize, Minimize, Split buttons.
|
||||
window->windowTitleVisibleFlags_ = { true, true, true };
|
||||
window->windowTitleVisibleFlags_ = { true, true, true, true};
|
||||
bool hideMaximizeButton = false;
|
||||
bool hideMinimizeButton = false;
|
||||
bool hideSplitButton = false;
|
||||
window->GetTitleButtonVisible(true, hideMaximizeButton, hideMinimizeButton, hideSplitButton);
|
||||
bool hideCloseButton = false;
|
||||
window->GetTitleButtonVisible(true, hideMaximizeButton, hideMinimizeButton, hideSplitButton, hideCloseButton);
|
||||
ASSERT_EQ(hideMaximizeButton, false);
|
||||
ASSERT_EQ(hideMinimizeButton, false);
|
||||
ASSERT_EQ(hideSplitButton, false);
|
||||
ASSERT_EQ(hideCloseButton, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1684,14 +1688,16 @@ HWTEST_F(WindowSceneSessionImplTest2, GetTitleButtonVisible03, Function | SmallT
|
||||
window->property_->SetModeSupportInfo(modeSupportInfo);
|
||||
window->property_->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
// show Maximize, Minimize, Split buttons.
|
||||
window->windowTitleVisibleFlags_ = { false, false, false };
|
||||
window->windowTitleVisibleFlags_ = { false, false, false, false};
|
||||
bool hideMaximizeButton = true;
|
||||
bool hideMinimizeButton = true;
|
||||
bool hideSplitButton = true;
|
||||
window->GetTitleButtonVisible(false, hideMaximizeButton, hideMinimizeButton, hideSplitButton);
|
||||
bool hideCloseButton = true;
|
||||
window->GetTitleButtonVisible(false, hideMaximizeButton, hideMinimizeButton, hideSplitButton, hideCloseButton);
|
||||
ASSERT_EQ(hideMaximizeButton, true);
|
||||
ASSERT_EQ(hideMinimizeButton, true);
|
||||
ASSERT_EQ(hideSplitButton, true);
|
||||
ASSERT_EQ(hideCloseButton, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1707,7 +1713,7 @@ HWTEST_F(WindowSceneSessionImplTest2, SetTitleButtonVisible01, Function | SmallT
|
||||
sptr<WindowSessionImpl> window = new (std::nothrow) WindowSceneSessionImpl(option);
|
||||
ASSERT_NE(window, nullptr);
|
||||
window->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
|
||||
window->SetTitleButtonVisible(false, false, false);
|
||||
window->SetTitleButtonVisible(false, false, false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1723,7 +1729,7 @@ HWTEST_F(WindowSceneSessionImplTest2, SetTitleButtonVisible02, Function | SmallT
|
||||
sptr<WindowSessionImpl> window = new (std::nothrow) WindowSceneSessionImpl(option);
|
||||
ASSERT_NE(window, nullptr);
|
||||
window->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
|
||||
WMError res = window->SetTitleButtonVisible(false, false, false);
|
||||
WMError res = window->SetTitleButtonVisible(false, false, false, true);
|
||||
ASSERT_EQ(res, WMError::WM_ERROR_INVALID_WINDOW);
|
||||
}
|
||||
|
||||
@ -1745,10 +1751,10 @@ HWTEST_F(WindowSceneSessionImplTest2, SetTitleButtonVisible03, Function | SmallT
|
||||
window->windowSystemConfig_.freeMultiWindowSupport_ = true;
|
||||
window->windowSystemConfig_.isSystemDecorEnable_ = true;
|
||||
window->windowSystemConfig_.windowUIType_ = WindowUIType::PHONE_WINDOW;
|
||||
WMError res = window->SetTitleButtonVisible(false, false, false);
|
||||
WMError res = window->SetTitleButtonVisible(false, false, false, true);
|
||||
ASSERT_EQ(res, WMError::WM_ERROR_DEVICE_NOT_SUPPORT);
|
||||
window->windowSystemConfig_.windowUIType_ = WindowUIType::PC_WINDOW;
|
||||
res = window->SetTitleButtonVisible(false, false, false);
|
||||
res = window->SetTitleButtonVisible(false, false, false, true);
|
||||
ASSERT_EQ(res, WMError::WM_OK);
|
||||
}
|
||||
|
||||
|
@ -111,25 +111,30 @@ HWTEST_F(WindowSessionImplTest2, GetTitleButtonVisible, Function | SmallTest | L
|
||||
bool isMaximizeVisible = false;
|
||||
bool isMinimizeVisible = false;
|
||||
bool isSplitVisible = false;
|
||||
window->GetTitleButtonVisible(isPC, isMaximizeVisible, isMinimizeVisible, isSplitVisible);
|
||||
bool isCloseVisible = false;
|
||||
window->GetTitleButtonVisible(isPC, isMaximizeVisible, isMinimizeVisible, isSplitVisible, isCloseVisible);
|
||||
ASSERT_FALSE(isSplitVisible);
|
||||
|
||||
isPC = true;
|
||||
window->windowTitleVisibleFlags_.isSplitVisible = false;
|
||||
window->windowTitleVisibleFlags_.isMaximizeVisible = false;
|
||||
window->windowTitleVisibleFlags_.isMinimizeVisible = false;
|
||||
window->GetTitleButtonVisible(isPC, isMaximizeVisible, isMinimizeVisible, isSplitVisible);
|
||||
window->windowTitleVisibleFlags_.isCloseVisible = false;
|
||||
window->GetTitleButtonVisible(isPC, isMaximizeVisible, isMinimizeVisible, isSplitVisible, isCloseVisible);
|
||||
ASSERT_TRUE(isSplitVisible);
|
||||
ASSERT_TRUE(isMaximizeVisible);
|
||||
ASSERT_TRUE(isMinimizeVisible);
|
||||
ASSERT_TRUE(isCloseVisible);
|
||||
|
||||
window->windowTitleVisibleFlags_.isSplitVisible = true;
|
||||
window->windowTitleVisibleFlags_.isMaximizeVisible = true;
|
||||
window->windowTitleVisibleFlags_.isMinimizeVisible = true;
|
||||
window->GetTitleButtonVisible(isPC, isMaximizeVisible, isMinimizeVisible, isSplitVisible);
|
||||
window->windowTitleVisibleFlags_.isCloseVisible = true;
|
||||
window->GetTitleButtonVisible(isPC, isMaximizeVisible, isMinimizeVisible, isSplitVisible, isCloseVisible);
|
||||
ASSERT_TRUE(isSplitVisible);
|
||||
ASSERT_TRUE(isMaximizeVisible);
|
||||
ASSERT_TRUE(isMinimizeVisible);
|
||||
ASSERT_TRUE(isCloseVisible);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -600,14 +600,16 @@ HWTEST_F(WindowSessionImplTest4, SetTitleButtonVisible, Function | SmallTest | L
|
||||
bool isMaximizeVisible = true;
|
||||
bool isMinimizeVisible = true;
|
||||
bool isSplitVisible = true;
|
||||
bool isCloseVisible = true;
|
||||
auto res = window->SetTitleButtonVisible(isMaximizeVisible, isMinimizeVisible,
|
||||
isSplitVisible);
|
||||
isSplitVisible, isCloseVisible);
|
||||
|
||||
bool &hideMaximizeButton = isMaximizeVisible;
|
||||
bool &hideMinimizeButton = isMinimizeVisible;
|
||||
bool &hideSplitButton = isSplitVisible;
|
||||
bool &hideCloseButton = isCloseVisible;
|
||||
window->GetTitleButtonVisible(true, hideMaximizeButton, hideMinimizeButton,
|
||||
hideSplitButton);
|
||||
hideSplitButton, hideCloseButton);
|
||||
ASSERT_EQ(res, WMError::WM_ERROR_INVALID_WINDOW);
|
||||
}
|
||||
|
||||
@ -845,7 +847,7 @@ HWTEST_F(WindowSessionImplTest4, SetTitleButtonVisible01, Function | SmallTest |
|
||||
ASSERT_NE(window, nullptr);
|
||||
ASSERT_NE(window->property_, nullptr);
|
||||
window->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
|
||||
WMError res = window->SetTitleButtonVisible(false, false, false);
|
||||
WMError res = window->SetTitleButtonVisible(false, false, false, true);
|
||||
ASSERT_EQ(res, WMError::WM_ERROR_INVALID_CALLING);
|
||||
GTEST_LOG_(INFO) << "WindowSessionImplTest4: SetTitleButtonVisible01 end";
|
||||
}
|
||||
@ -865,7 +867,7 @@ HWTEST_F(WindowSessionImplTest4, SetTitleButtonVisible02, Function | SmallTest |
|
||||
ASSERT_NE(window, nullptr);
|
||||
ASSERT_NE(window->property_, nullptr);
|
||||
window->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
|
||||
WMError res = window->SetTitleButtonVisible(false, false, false);
|
||||
WMError res = window->SetTitleButtonVisible(false, false, false, true);
|
||||
ASSERT_EQ(res, WMError::WM_ERROR_INVALID_WINDOW);
|
||||
GTEST_LOG_(INFO) << "WindowSessionImplTest4: SetTitleButtonVisible02 end";
|
||||
}
|
||||
@ -890,10 +892,10 @@ HWTEST_F(WindowSessionImplTest4, SetTitleButtonVisible03, Function | SmallTest |
|
||||
window->windowSystemConfig_.freeMultiWindowSupport_ = true;
|
||||
window->windowSystemConfig_.isSystemDecorEnable_ = true;
|
||||
window->windowSystemConfig_.windowUIType_ = WindowUIType::PHONE_WINDOW;
|
||||
WMError res = window->SetTitleButtonVisible(false, false, false);
|
||||
WMError res = window->SetTitleButtonVisible(false, false, false, true);
|
||||
ASSERT_EQ(res, WMError::WM_ERROR_INVALID_WINDOW);
|
||||
window->windowSystemConfig_.windowUIType_ = WindowUIType::PC_WINDOW;
|
||||
res = window->SetTitleButtonVisible(false, false, false);
|
||||
res = window->SetTitleButtonVisible(false, false, false, true);
|
||||
ASSERT_EQ(res, WMError::WM_ERROR_INVALID_WINDOW);
|
||||
GTEST_LOG_(INFO) << "WindowSessionImplTest4: SetTitleButtonVisible03 end";
|
||||
}
|
||||
@ -915,14 +917,17 @@ HWTEST_F(WindowSessionImplTest4, GetTitleButtonVisible01, Function | SmallTest |
|
||||
window->property_->SetModeSupportInfo(modeSupportInfo);
|
||||
window->property_->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
// show Maximize, Minimize, Split buttons.
|
||||
window->windowTitleVisibleFlags_ = { false, false, false };
|
||||
window->windowTitleVisibleFlags_ = { false, false, false, false };
|
||||
bool hideMaximizeButton = false;
|
||||
bool hideMinimizeButton = false;
|
||||
bool hideSplitButton = false;
|
||||
window->GetTitleButtonVisible(true, hideMaximizeButton, hideMinimizeButton, hideSplitButton);
|
||||
bool hideCloseButton = false;
|
||||
window->GetTitleButtonVisible(true, hideMaximizeButton, hideMinimizeButton, hideSplitButton,
|
||||
hideCloseButton);
|
||||
ASSERT_EQ(hideMaximizeButton, true);
|
||||
ASSERT_EQ(hideMinimizeButton, true);
|
||||
ASSERT_EQ(hideSplitButton, true);
|
||||
ASSERT_EQ(hideCloseButton, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -983,14 +988,16 @@ HWTEST_F(WindowSessionImplTest4, GetTitleButtonVisible02, Function | SmallTest |
|
||||
window->property_->SetModeSupportInfo(modeSupportInfo);
|
||||
window->property_->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
// show Maximize, Minimize, Split buttons.
|
||||
window->windowTitleVisibleFlags_ = { true, true, true };
|
||||
window->windowTitleVisibleFlags_ = { true, true, true, true };
|
||||
bool hideMaximizeButton = false;
|
||||
bool hideMinimizeButton = false;
|
||||
bool hideSplitButton = false;
|
||||
window->GetTitleButtonVisible(true, hideMaximizeButton, hideMinimizeButton, hideSplitButton);
|
||||
bool hideCloseButton = false;
|
||||
window->GetTitleButtonVisible(true, hideMaximizeButton, hideMinimizeButton, hideSplitButton, hideCloseButton);
|
||||
ASSERT_EQ(hideMaximizeButton, false);
|
||||
ASSERT_EQ(hideMinimizeButton, false);
|
||||
ASSERT_EQ(hideSplitButton, false);
|
||||
ASSERT_EQ(hideCloseButton, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1013,14 +1020,16 @@ HWTEST_F(WindowSessionImplTest4, GetTitleButtonVisible03, Function | SmallTest |
|
||||
window->property_->SetModeSupportInfo(modeSupportInfo);
|
||||
window->property_->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
|
||||
// show Maximize, Minimize, Split buttons.
|
||||
window->windowTitleVisibleFlags_ = { false, false, false };
|
||||
window->windowTitleVisibleFlags_ = { false, false, false, false };
|
||||
bool hideMaximizeButton = true;
|
||||
bool hideMinimizeButton = true;
|
||||
bool hideSplitButton = true;
|
||||
window->GetTitleButtonVisible(false, hideMaximizeButton, hideMinimizeButton, hideSplitButton);
|
||||
bool hideCloseButton = true;
|
||||
window->GetTitleButtonVisible(false, hideMaximizeButton, hideMinimizeButton, hideSplitButton, hideCloseButton);
|
||||
ASSERT_EQ(hideMaximizeButton, true);
|
||||
ASSERT_EQ(hideMinimizeButton, true);
|
||||
ASSERT_EQ(hideSplitButton, true);
|
||||
ASSERT_EQ(hideCloseButton, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2541,7 +2541,7 @@ HWTEST_F(WindowTest, Test01, Function | SmallTest | Level2)
|
||||
SystemBarProperty prop;
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetSpecificBarProperty(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW, prop));
|
||||
ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->SetDecorVisible(true));
|
||||
ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->SetTitleButtonVisible(true, true, true));
|
||||
ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->SetTitleButtonVisible(true, true, true, true));
|
||||
auto var = 5;
|
||||
ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->SetDecorHeight(var));
|
||||
ASSERT_EQ(WMError::WM_ERROR_DEVICE_NOT_SUPPORT, window->GetDecorHeight(var));
|
||||
@ -2636,21 +2636,21 @@ HWTEST_F(WindowTest, SetTitleButtonVisible, Function | SmallTest | Level2)
|
||||
{
|
||||
sptr<Window> window = new (std::nothrow) Window();
|
||||
ASSERT_NE(window, nullptr);
|
||||
WMError res = window->SetTitleButtonVisible(true, true, true);
|
||||
WMError res = window->SetTitleButtonVisible(true, true, true, true);
|
||||
ASSERT_EQ(res, WMError::WM_ERROR_DEVICE_NOT_SUPPORT);
|
||||
res = window->SetTitleButtonVisible(false, true, true);
|
||||
res = window->SetTitleButtonVisible(false, true, true, true);
|
||||
ASSERT_EQ(res, WMError::WM_ERROR_DEVICE_NOT_SUPPORT);
|
||||
res = window->SetTitleButtonVisible(true, false, true);
|
||||
res = window->SetTitleButtonVisible(true, false, true, true);
|
||||
ASSERT_EQ(res, WMError::WM_ERROR_DEVICE_NOT_SUPPORT);
|
||||
res = window->SetTitleButtonVisible(true, true, false);
|
||||
res = window->SetTitleButtonVisible(true, true, false, true);
|
||||
ASSERT_EQ(res, WMError::WM_ERROR_DEVICE_NOT_SUPPORT);
|
||||
res = window->SetTitleButtonVisible(false, false, true);
|
||||
res = window->SetTitleButtonVisible(false, false, true, true);
|
||||
ASSERT_EQ(res, WMError::WM_ERROR_DEVICE_NOT_SUPPORT);
|
||||
res = window->SetTitleButtonVisible(false, true, false);
|
||||
res = window->SetTitleButtonVisible(false, true, false, true);
|
||||
ASSERT_EQ(res, WMError::WM_ERROR_DEVICE_NOT_SUPPORT);
|
||||
res = window->SetTitleButtonVisible(true, false, false);
|
||||
res = window->SetTitleButtonVisible(true, false, false, true);
|
||||
ASSERT_EQ(res, WMError::WM_ERROR_DEVICE_NOT_SUPPORT);
|
||||
res = window->SetTitleButtonVisible(false, false, false);
|
||||
res = window->SetTitleButtonVisible(false, false, false, true);
|
||||
ASSERT_EQ(res, WMError::WM_ERROR_DEVICE_NOT_SUPPORT);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user