Merge "Set bolt and plus colors together" into oc-dr1-dev

am: c86a5dbee4

Change-Id: I16ac7e9a14a00573beef6db44390720b3bf5530d
This commit is contained in:
Evan Laird
2017-06-27 21:47:58 +00:00
committed by android-build-merger
2 changed files with 15 additions and 0 deletions

View File

@@ -281,6 +281,7 @@ public class BatteryMeterDrawableBase extends Drawable {
mIconTint = fillColor;
mFramePaint.setColor(backgroundColor);
mBoltPaint.setColor(fillColor);
mPlusPaint.setColor(fillColor);
mChargeColor = fillColor;
invalidateSelf();
}

View File

@@ -13,6 +13,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import static com.google.common.truth.Truth.assertThat;
import static junit.framework.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyFloat;
import static org.mockito.Matchers.anyString;
@@ -101,4 +102,17 @@ public class BatteryMeterDrawableBaseTest {
private boolean isRectZero(Rect r) {
return r.left == 0 && r.top == 0 && r.right == 0 && r.bottom == 0;
}
@Test
public void testPlusPaint_isEqualToBoltPaint() {
// Before setting color
assertTrue(mBatteryDrawable.mPlusPaint.hasEqualAttributes(mBatteryDrawable.mBoltPaint));
final int fakeFillColor = 123;
final int fakeBackgrundColor = 456;
// After
mBatteryDrawable.setColors(fakeFillColor, fakeBackgrundColor);
assertTrue(mBatteryDrawable.mPlusPaint.hasEqualAttributes(mBatteryDrawable.mBoltPaint));
}
}