Commit 3a529446 authored by Sawyer Blatz's avatar Sawyer Blatz Committed by Jonathan Almeida
Browse files

Fixes #2620: Immediately update site security icon color

parent 3f368711
......@@ -179,7 +179,13 @@ internal class DisplayToolbar(
private val defaultColor = ContextCompat.getColor(context, R.color.photonWhite)
private var currentSiteSecurity = SiteSecurity.INSECURE
internal var securityIconColor = Pair(defaultColor, defaultColor)
set(value) {
field = value
setSiteSecurity(currentSiteSecurity)
}
internal var menuViewColor = defaultColor
set(value) {
......@@ -274,6 +280,8 @@ internal class DisplayToolbar(
setImageResource(image)
setColorFilter(color)
}
currentSiteSecurity = secure
}
/**
......
......@@ -684,7 +684,7 @@ class DisplayToolbarTest {
}
@Test
fun `iconView changes image color filter on update`() {
fun `securityIconColor is set when securityIconColor changes`() {
val toolbar = mock(BrowserToolbar::class.java)
val displayToolbar = DisplayToolbar(RuntimeEnvironment.application, toolbar)
......@@ -694,6 +694,18 @@ class DisplayToolbarTest {
assertEquals(R.color.photonBlue40, displayToolbar.securityIconColor.second)
}
@Test
fun `setSiteSecurity is called when securityIconColor changes`() {
val toolbar = BrowserToolbar(context)
toolbar.displayToolbar
assertNull(toolbar.displayToolbar.siteSecurityIconView.colorFilter)
toolbar.siteSecurityColor = Pair(R.color.photonBlue40, R.color.photonBlue40)
assertNotNull(toolbar.displayToolbar.siteSecurityIconView.colorFilter)
}
@Test
fun `clicking menu button emits fact`() {
CollectionProcessor.withFactCollection { facts ->
......
Supports Markdown
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