Commit 37abc777 authored by Ahmed Mehfooz's avatar Ahmed Mehfooz Committed by Commit Bot

Fix battery icon regression for tethered device battery

This fix changes the battery icon slightly to match modified specs
(It is 1px shorter).
The spec also standardizes all battery icons to the same size
so the regression for tethered device battery is also fixed.

Bug: 1126674
Change-Id: Ia71972930c51c964e4110ba887f17b0eca027847
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2404417
Commit-Queue: Ahmed Mehfooz <amehfooz@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806521}
parent 0643cbcf
......@@ -3,23 +3,23 @@
// found in the LICENSE file.
CANVAS_DIMENSIONS, 20,
MOVE_TO, 13, 4,
MOVE_TO, 13, 4.5f,
H_LINE_TO, 12,
V_LINE_TO, 2.5f,
V_LINE_TO, 3,
H_LINE_TO, 8,
V_LINE_TO, 4,
V_LINE_TO, 4.5f,
H_LINE_TO, 7,
CUBIC_TO, 6.5f, 4, 6, 4.5f, 6, 5,
CUBIC_TO, 6.5f, 4.5f, 6, 5, 6, 5.5f,
V_LINE_TO, 16,
CUBIC_TO, 6, 16.5f, 6.5f, 17, 7, 17,
H_LINE_TO, 13,
CUBIC_TO, 13.5f, 17, 14, 16.5f, 14, 16,
V_LINE_TO, 5,
CUBIC_TO, 14, 4.5f, 13.5f, 4, 13, 4,
V_LINE_TO, 5.5f,
CUBIC_TO, 14, 5, 13.5f, 4.5f, 13, 4.5f,
CLOSE,
MOVE_TO, 12.5f, 5.5f,
MOVE_TO, 12.5f, 6,
H_LINE_TO, 7.5f,
V_LINE_TO, 15.5f,
H_LINE_TO, 12.5f,
V_LINE_TO, 5.5f,
V_LINE_TO, 6,
CLOSE
\ No newline at end of file
......@@ -60,7 +60,7 @@ namespace ash {
namespace tray {
namespace {
const int kMobileNetworkBatteryIconSize = 14;
const int kMobileNetworkBatteryIconSize = 18;
const int kPowerStatusPaddingRight = 10;
bool IsSecondaryUser() {
......
......@@ -80,7 +80,7 @@ class BatteryImageSource : public gfx::CanvasImageSource {
// case, still draw 1dip of charge.
SkPath path;
gfx::RectF fill_rect = gfx::RectF(8, 6, 6, 12);
gfx::RectF fill_rect = gfx::RectF(8, 6, 6, 11);
fill_rect.Scale(const_scale);
path.addRect(gfx::RectToSkRect(gfx::ToEnclosingRect(fill_rect)));
cc::PaintFlags flags;
......
......@@ -204,17 +204,17 @@ TEST_F(PowerStatusTest, BatteryImageInfoChargeLevel) {
EXPECT_EQ(0, power_status_->GetBatteryImageInfo().charge_percent);
gfx::Image empty_image = get_battery_image();
// 14% and 15% look different.
prop.set_battery_percent(14.0);
// 10% and 20% look different.
prop.set_battery_percent(10.0);
power_status_->SetProtoForTesting(prop);
EXPECT_EQ(14.0, power_status_->GetBatteryImageInfo().charge_percent);
gfx::Image image_14 = get_battery_image();
EXPECT_FALSE(gfx::test::AreImagesEqual(empty_image, image_14));
prop.set_battery_percent(15.0);
EXPECT_EQ(10.0, power_status_->GetBatteryImageInfo().charge_percent);
gfx::Image image_10 = get_battery_image();
EXPECT_FALSE(gfx::test::AreImagesEqual(empty_image, image_10));
prop.set_battery_percent(20.0);
power_status_->SetProtoForTesting(prop);
EXPECT_EQ(15.0, power_status_->GetBatteryImageInfo().charge_percent);
gfx::Image image_15 = get_battery_image();
EXPECT_FALSE(gfx::test::AreImagesEqual(image_14, image_15));
EXPECT_EQ(20.0, power_status_->GetBatteryImageInfo().charge_percent);
gfx::Image image_20 = get_battery_image();
EXPECT_FALSE(gfx::test::AreImagesEqual(image_10, image_20));
// 99% and 100% look different.
prop.set_battery_percent(99.0);
......
......@@ -33,6 +33,7 @@
#include "ui/message_center/message_center.h"
#include "ui/message_center/public/cpp/notification.h"
#include "ui/message_center/public/cpp/notification_delegate.h"
#include "ui/views/border.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/view.h"
......@@ -44,6 +45,8 @@ namespace ash {
namespace tray {
PowerTrayView::PowerTrayView(Shelf* shelf) : TrayItemView(shelf) {
SetBorder(
views::CreateEmptyBorder(0, 0, kUnifiedTrayBatteryBottomPadding, 0));
CreateImageView();
UpdateImage();
UpdateStatus();
......
......@@ -129,6 +129,7 @@ constexpr int kUnifiedTrayTextRightPadding = 1;
constexpr int kUnifiedTrayTimeLeftPadding = 1;
constexpr int kUnifiedTraySpacingBetweenIcons = 6;
constexpr int kUnifiedTrayBatteryWidth = 12;
constexpr int kUnifiedTrayBatteryBottomPadding = 1;
constexpr int kUnifiedTrayCornerRadius = 16;
constexpr int kUnifiedTrayContentPadding = 12;
constexpr int kUnifiedTopShortcutSpacing = 16;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment