From a3f3e7393018a0d01214a4a0c9386a61fc6cef7f Mon Sep 17 00:00:00 2001 From: YueBiang Date: Thu, 24 Jun 2021 15:57:17 +0800 Subject: [PATCH] fixed 5d227b2 from https://gitee.com/openharmony/graphic_ui/pulls/237 --- frameworks/components/ui_box_progress.cpp | 11 ++++++++++- .../uitest/test_progress_bar/ui_test_box_progress.cpp | 5 +++-- test/uitest/test_slider/ui_test_slider.cpp | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/frameworks/components/ui_box_progress.cpp b/frameworks/components/ui_box_progress.cpp index 506e799..48232b0 100755 --- a/frameworks/components/ui_box_progress.cpp +++ b/frameworks/components/ui_box_progress.cpp @@ -127,7 +127,16 @@ void UIBoxProgress::DrawRoundCap(BufferInfo& gfxDstBuffer, arcInfo.imgPos = imgPos; arcInfo.imgSrc = image; - if (rect.GetWidth() % 2 == 0) { // 2: determine the odd or even number of the width + bool isEvenLen = false; + if (direction_ == Direction::DIR_LEFT_TO_RIGHT || direction_ == Direction::DIR_RIGHT_TO_LEFT) { + if (rect.GetHeight() % 2 == 0) { // 2: determine the odd or even number of the height + isEvenLen = true; + } + } else if (rect.GetWidth() % 2 == 0) { // 2: determine the odd or even number of the width + isEvenLen = true; + } + + if (isEvenLen) { arcInfo.center = leftTop; arcInfo.startAngle = THREE_QUARTER_IN_DEGREE; arcInfo.endAngle = 0; diff --git a/test/uitest/test_progress_bar/ui_test_box_progress.cpp b/test/uitest/test_progress_bar/ui_test_box_progress.cpp index aea51d6..28f6fcf 100755 --- a/test/uitest/test_progress_bar/ui_test_box_progress.cpp +++ b/test/uitest/test_progress_bar/ui_test_box_progress.cpp @@ -388,8 +388,9 @@ bool UITestBoxProgress::OnClick(UIView& view, const ClickEvent& event) style.bgColor_ = Color::Blue(); boxProgress_->SetForegroundStyle(style); } else if (&view == getStyleBtn_) { - boxProgress_->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, Color::Red().full); - boxProgress_->SetForegroundStyle(STYLE_BACKGROUND_COLOR, Color::Yellow().full); + boxProgress_->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, Color::White().full); + boxProgress_->SetBackgroundStyle(STYLE_BACKGROUND_OPA, 128); // 128: opa + boxProgress_->SetForegroundStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full); } else if (&view == roundCapBtn_) { boxProgress_->SetCapType(CapType::CAP_ROUND); } else if (&view == noneCapBtn_) { diff --git a/test/uitest/test_slider/ui_test_slider.cpp b/test/uitest/test_slider/ui_test_slider.cpp index 6e36534..61b9b4b 100755 --- a/test/uitest/test_slider/ui_test_slider.cpp +++ b/test/uitest/test_slider/ui_test_slider.cpp @@ -571,7 +571,7 @@ bool UITestSlider::ExpandClick2(UIView& view, const ClickEvent& event) slider_->SetKnobWidth(0); slider_->SetBackgroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND); slider_->SetBackgroundStyle(STYLE_BACKGROUND_OPA, BACKGROUND_OPA); - slider_->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); + slider_->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, Color::White().full); slider_->SetForegroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND); slider_->SetForegroundStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(FOREGROUND_COLOR_R, FOREGROUND_COLOR_G, FOREGROUND_COLOR_B).full); -- GitLab