This commit is contained in:
parent
dbe6dbb18c
commit
d5cb9c599c
|
@ -10,9 +10,9 @@ import androidx.test.uiautomator.UiDevice
|
||||||
import okhttp3.mockwebserver.MockWebServer
|
import okhttp3.mockwebserver.MockWebServer
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
|
import org.junit.Ignore
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.Ignore
|
|
||||||
import org.mozilla.fenix.FenixApplication
|
import org.mozilla.fenix.FenixApplication
|
||||||
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
|
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
|
||||||
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
|
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
|
||||||
|
@ -85,7 +85,7 @@ class SettingsBasicsTest {
|
||||||
verifyThemes()
|
verifyThemes()
|
||||||
}.goBack {
|
}.goBack {
|
||||||
}.openAccessibilitySubMenu {
|
}.openAccessibilitySubMenu {
|
||||||
verifyMenuItems()
|
verifyAutomaticFontSizingMenuItems()
|
||||||
}.goBack {
|
}.goBack {
|
||||||
// drill down to submenu
|
// drill down to submenu
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ class SettingsBasicsTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun changeAccessibilitySettings() {
|
fun changeAccessibiltySettings() {
|
||||||
// Goes through the settings and changes the default text on a webpage, then verifies if the text has changed.
|
// Goes through the settings and changes the default text on a webpage, then verifies if the text has changed.
|
||||||
val fenixApp = activityIntentTestRule.activity.applicationContext as FenixApplication
|
val fenixApp = activityIntentTestRule.activity.applicationContext as FenixApplication
|
||||||
val webpage = getLoremIpsumAsset(mockWebServer).url
|
val webpage = getLoremIpsumAsset(mockWebServer).url
|
||||||
|
@ -193,7 +193,8 @@ class SettingsBasicsTest {
|
||||||
}.openThreeDotMenu {
|
}.openThreeDotMenu {
|
||||||
}.openSettings {
|
}.openSettings {
|
||||||
}.openAccessibilitySubMenu {
|
}.openAccessibilitySubMenu {
|
||||||
verifyMenuItems()
|
clickFontSizingSwitch()
|
||||||
|
verifyEnabledMenuItems()
|
||||||
changeTextSizeSlider(textSizePercentage)
|
changeTextSizeSlider(textSizePercentage)
|
||||||
verifyTextSizePercentage(textSizePercentage)
|
verifyTextSizePercentage(textSizePercentage)
|
||||||
}.goBack {
|
}.goBack {
|
||||||
|
@ -201,6 +202,14 @@ class SettingsBasicsTest {
|
||||||
}.openNavigationToolbar {
|
}.openNavigationToolbar {
|
||||||
}.enterURLAndEnterToBrowser(webpage) {
|
}.enterURLAndEnterToBrowser(webpage) {
|
||||||
checkTextSizeOnWebsite(textSizePercentage, fenixApp.components)
|
checkTextSizeOnWebsite(textSizePercentage, fenixApp.components)
|
||||||
|
}.openTabDrawer {
|
||||||
|
}.openNewTab {
|
||||||
|
}.dismiss {
|
||||||
|
}.openThreeDotMenu {
|
||||||
|
}.openSettings {
|
||||||
|
}.openAccessibilitySubMenu {
|
||||||
|
clickFontSizingSwitch()
|
||||||
|
verifyMenuItemsAreDisabled()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,30 +6,32 @@
|
||||||
|
|
||||||
package org.mozilla.fenix.ui.robots
|
package org.mozilla.fenix.ui.robots
|
||||||
|
|
||||||
import androidx.test.espresso.Espresso.onView
|
|
||||||
import androidx.test.espresso.action.ViewActions.click
|
|
||||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
|
||||||
import androidx.test.platform.app.InstrumentationRegistry
|
|
||||||
import androidx.test.uiautomator.UiDevice
|
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
import android.view.KeyEvent.KEYCODE_DPAD_RIGHT
|
|
||||||
import android.view.KeyEvent.KEYCODE_DPAD_LEFT
|
|
||||||
import android.view.KeyEvent.ACTION_DOWN
|
import android.view.KeyEvent.ACTION_DOWN
|
||||||
|
import android.view.KeyEvent.KEYCODE_DPAD_LEFT
|
||||||
|
import android.view.KeyEvent.KEYCODE_DPAD_RIGHT
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.SeekBar
|
import android.widget.SeekBar
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.test.espresso.Espresso.onView
|
||||||
import androidx.test.espresso.UiController
|
import androidx.test.espresso.UiController
|
||||||
import androidx.test.espresso.ViewAction
|
import androidx.test.espresso.ViewAction
|
||||||
import androidx.test.espresso.ViewAssertion
|
import androidx.test.espresso.ViewAssertion
|
||||||
import org.hamcrest.CoreMatchers.allOf
|
import androidx.test.espresso.action.ViewActions.click
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
|
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.Visibility
|
import androidx.test.espresso.matcher.ViewMatchers.Visibility
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom
|
import androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom
|
||||||
|
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
|
||||||
|
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
||||||
|
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||||
|
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
|
import androidx.test.uiautomator.UiDevice
|
||||||
|
import org.hamcrest.CoreMatchers.allOf
|
||||||
import org.hamcrest.Matcher
|
import org.hamcrest.Matcher
|
||||||
import org.mozilla.fenix.components.Components
|
import org.mozilla.fenix.components.Components
|
||||||
|
import org.mozilla.fenix.helpers.assertIsEnabled
|
||||||
|
import org.mozilla.fenix.helpers.isEnabled
|
||||||
import org.mozilla.fenix.ui.robots.SettingsSubMenuAccessibilityRobot.Companion.DECIMAL_CONVERSION
|
import org.mozilla.fenix.ui.robots.SettingsSubMenuAccessibilityRobot.Companion.DECIMAL_CONVERSION
|
||||||
import org.mozilla.fenix.ui.robots.SettingsSubMenuAccessibilityRobot.Companion.MIN_VALUE
|
import org.mozilla.fenix.ui.robots.SettingsSubMenuAccessibilityRobot.Companion.MIN_VALUE
|
||||||
import org.mozilla.fenix.ui.robots.SettingsSubMenuAccessibilityRobot.Companion.STEP_SIZE
|
import org.mozilla.fenix.ui.robots.SettingsSubMenuAccessibilityRobot.Companion.STEP_SIZE
|
||||||
|
@ -48,7 +50,13 @@ class SettingsSubMenuAccessibilityRobot {
|
||||||
const val TEXT_SIZE = 16f
|
const val TEXT_SIZE = 16f
|
||||||
}
|
}
|
||||||
|
|
||||||
fun verifyMenuItems() = assertMenuItems()
|
fun verifyAutomaticFontSizingMenuItems() = assertAutomaticFontSizingMenuItems()
|
||||||
|
|
||||||
|
fun clickFontSizingSwitch() = toggleFontSizingSwitch()
|
||||||
|
|
||||||
|
fun verifyEnabledMenuItems() = assertEnabledMenuItems()
|
||||||
|
|
||||||
|
fun verifyMenuItemsAreDisabled() = assertMenuItemsAreDisabled()
|
||||||
|
|
||||||
fun changeTextSizeSlider(seekBarPercentage: Int) = adjustTextSizeSlider(seekBarPercentage)
|
fun changeTextSizeSlider(seekBarPercentage: Int) = adjustTextSizeSlider(seekBarPercentage)
|
||||||
|
|
||||||
|
@ -69,7 +77,22 @@ class SettingsSubMenuAccessibilityRobot {
|
||||||
|
|
||||||
val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
||||||
|
|
||||||
private fun assertMenuItems() {
|
private fun assertAutomaticFontSizingMenuItems() {
|
||||||
|
onView(withText("Automatic font sizing"))
|
||||||
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||||
|
val strFont = "Font size will match your Android settings. Disable to manage font size here."
|
||||||
|
onView(withText(strFont))
|
||||||
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun toggleFontSizingSwitch() {
|
||||||
|
// Toggle font size to off
|
||||||
|
onView(withText("Automatic font sizing"))
|
||||||
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||||
|
.perform(click())
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun assertEnabledMenuItems() {
|
||||||
assertFontSize()
|
assertFontSize()
|
||||||
assertSliderBar()
|
assertSliderBar()
|
||||||
}
|
}
|
||||||
|
@ -77,9 +100,11 @@ private fun assertMenuItems() {
|
||||||
private fun assertFontSize() {
|
private fun assertFontSize() {
|
||||||
val view = onView(withText("Font Size"))
|
val view = onView(withText("Font Size"))
|
||||||
view.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
view.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||||
|
.check(matches(isEnabled(true)))
|
||||||
val strFont = "Make text on websites larger or smaller"
|
val strFont = "Make text on websites larger or smaller"
|
||||||
onView(withText(strFont))
|
onView(withText(strFont))
|
||||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||||
|
.check(matches(isEnabled(true)))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun assertSliderBar() {
|
private fun assertSliderBar() {
|
||||||
|
@ -103,6 +128,20 @@ private fun assertTextSizePercentage(textSize: Int) {
|
||||||
.check(textSizePercentageEquals(textSize))
|
.check(textSizePercentageEquals(textSize))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun assertMenuItemsAreDisabled() {
|
||||||
|
onView(withText("Font Size")).assertIsEnabled(false)
|
||||||
|
|
||||||
|
val strFont = "Make text on websites larger or smaller"
|
||||||
|
|
||||||
|
onView(withText(strFont)).assertIsEnabled(false)
|
||||||
|
|
||||||
|
onView(withId(org.mozilla.fenix.R.id.sampleText)).assertIsEnabled(false)
|
||||||
|
|
||||||
|
onView(withId(org.mozilla.fenix.R.id.seekbar_value)).assertIsEnabled(false)
|
||||||
|
|
||||||
|
onView(withId(org.mozilla.fenix.R.id.seekbar)).assertIsEnabled(false)
|
||||||
|
}
|
||||||
|
|
||||||
private fun goBackButton() =
|
private fun goBackButton() =
|
||||||
onView(allOf(withContentDescription("Navigate up")))
|
onView(allOf(withContentDescription("Navigate up")))
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ object GeckoProvider {
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
val settings = context.components.settings
|
val settings = context.components.settings
|
||||||
if (!settings.shouldUseAutoSize()) {
|
if (!settings.shouldUseAutoSize) {
|
||||||
runtimeSettings.automaticFontSizeAdjustment = false
|
runtimeSettings.automaticFontSizeAdjustment = false
|
||||||
val fontSize = settings.fontSizeFactor
|
val fontSize = settings.fontSizeFactor
|
||||||
runtimeSettings.fontSizeFactor = fontSize
|
runtimeSettings.fontSizeFactor = fontSize
|
||||||
|
|
|
@ -47,7 +47,7 @@ object GeckoProvider {
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
val settings = context.components.settings
|
val settings = context.components.settings
|
||||||
if (!settings.shouldUseAutoSize()) {
|
if (!settings.shouldUseAutoSize) {
|
||||||
runtimeSettings.automaticFontSizeAdjustment = false
|
runtimeSettings.automaticFontSizeAdjustment = false
|
||||||
val fontSize = settings.fontSizeFactor
|
val fontSize = settings.fontSizeFactor
|
||||||
runtimeSettings.fontSizeFactor = fontSize
|
runtimeSettings.fontSizeFactor = fontSize
|
||||||
|
|
|
@ -57,7 +57,7 @@ object GeckoProvider {
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
val settings = context.components.settings
|
val settings = context.components.settings
|
||||||
if (!settings.shouldUseAutoSize()) {
|
if (!settings.shouldUseAutoSize) {
|
||||||
runtimeSettings.automaticFontSizeAdjustment = false
|
runtimeSettings.automaticFontSizeAdjustment = false
|
||||||
val fontSize = settings.fontSizeFactor
|
val fontSize = settings.fontSizeFactor
|
||||||
runtimeSettings.fontSizeFactor = fontSize
|
runtimeSettings.fontSizeFactor = fontSize
|
||||||
|
|
|
@ -97,8 +97,8 @@ class Core(
|
||||||
trackingProtectionPolicy = trackingProtectionPolicyFactory.createTrackingProtectionPolicy(),
|
trackingProtectionPolicy = trackingProtectionPolicyFactory.createTrackingProtectionPolicy(),
|
||||||
historyTrackingDelegate = HistoryDelegate(lazyHistoryStorage),
|
historyTrackingDelegate = HistoryDelegate(lazyHistoryStorage),
|
||||||
preferredColorScheme = getPreferredColorScheme(),
|
preferredColorScheme = getPreferredColorScheme(),
|
||||||
automaticFontSizeAdjustment = context.settings().shouldUseAutoSize(),
|
automaticFontSizeAdjustment = context.settings().shouldUseAutoSize,
|
||||||
fontInflationEnabled = context.settings().shouldUseAutoSize(),
|
fontInflationEnabled = context.settings().shouldUseAutoSize,
|
||||||
suspendMediaWhenInactive = false,
|
suspendMediaWhenInactive = false,
|
||||||
forceUserScalableContent = context.settings().forceEnableZoom,
|
forceUserScalableContent = context.settings().forceEnableZoom,
|
||||||
loginAutofillEnabled = context.settings().shouldAutofillLogins
|
loginAutofillEnabled = context.settings().shouldAutofillLogins
|
||||||
|
|
|
@ -48,18 +48,35 @@ class AccessibilityFragment : PreferenceFragmentCompat() {
|
||||||
val newTextScale =
|
val newTextScale =
|
||||||
((newTextSize * STEP_SIZE) + MIN_SCALE_VALUE).toFloat() / PERCENT_TO_DECIMAL
|
((newTextSize * STEP_SIZE) + MIN_SCALE_VALUE).toFloat() / PERCENT_TO_DECIMAL
|
||||||
|
|
||||||
|
// Save new text scale value. We assume auto sizing is off if this change listener was called.
|
||||||
settings.fontSizeFactor = newTextScale
|
settings.fontSizeFactor = newTextScale
|
||||||
|
components.core.engine.settings.fontSizeFactor = newTextScale
|
||||||
|
|
||||||
// If scale is 100%, use the automatic font size adjustment
|
// Reload the current session to reflect the new text scale
|
||||||
val useAutoSize = newTextScale == 1F
|
components.useCases.sessionUseCases.reload()
|
||||||
|
true
|
||||||
|
}
|
||||||
|
textSizePreference.isEnabled = !requireContext().settings().shouldUseAutoSize
|
||||||
|
|
||||||
|
val useAutoSizePreference =
|
||||||
|
requirePreference<SwitchPreference>(R.string.pref_key_accessibility_auto_size)
|
||||||
|
useAutoSizePreference.setOnPreferenceChangeListener<Boolean> { preference, useAutoSize ->
|
||||||
|
val settings = preference.context.settings()
|
||||||
|
val components = preference.context.components
|
||||||
|
|
||||||
|
// Save the new setting value
|
||||||
|
settings.shouldUseAutoSize = useAutoSize
|
||||||
components.core.engine.settings.automaticFontSizeAdjustment = useAutoSize
|
components.core.engine.settings.automaticFontSizeAdjustment = useAutoSize
|
||||||
components.core.engine.settings.fontInflationEnabled = useAutoSize
|
components.core.engine.settings.fontInflationEnabled = useAutoSize
|
||||||
|
|
||||||
// If using manual sizing, update the engine settings with the new scale
|
// If using manual sizing, update the engine settings with the local saved setting
|
||||||
if (!useAutoSize) {
|
if (!useAutoSize) {
|
||||||
components.core.engine.settings.fontSizeFactor = newTextScale
|
components.core.engine.settings.fontSizeFactor = settings.fontSizeFactor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable the manual sizing controls if automatic sizing is turned off.
|
||||||
|
textSizePreference.isEnabled = !useAutoSize
|
||||||
|
|
||||||
// Reload the current session to reflect the new text scale
|
// Reload the current session to reflect the new text scale
|
||||||
components.useCases.sessionUseCases.reload()
|
components.useCases.sessionUseCases.reload()
|
||||||
true
|
true
|
||||||
|
|
|
@ -67,30 +67,37 @@ class TextPercentageSeekBarPreference @JvmOverloads constructor(
|
||||||
) : Preference(context, attrs, defStyleAttr, defStyleRes) {
|
) : Preference(context, attrs, defStyleAttr, defStyleRes) {
|
||||||
/* synthetic access */
|
/* synthetic access */
|
||||||
internal var mSeekBarValue: Int = 0
|
internal var mSeekBarValue: Int = 0
|
||||||
|
|
||||||
/* synthetic access */
|
/* synthetic access */
|
||||||
internal var mMin: Int = 0
|
internal var mMin: Int = 0
|
||||||
private var mMax: Int = 0
|
private var mMax: Int = 0
|
||||||
private var mSeekBarIncrement: Int = 0
|
private var mSeekBarIncrement: Int = 0
|
||||||
|
|
||||||
/* synthetic access */
|
/* synthetic access */
|
||||||
internal var mTrackingTouch: Boolean = false
|
internal var mTrackingTouch: Boolean = false
|
||||||
|
|
||||||
/* synthetic access */
|
/* synthetic access */
|
||||||
internal var mSeekBar: SeekBar? = null
|
internal var mSeekBar: SeekBar? = null
|
||||||
private var mSeekBarValueTextView: TextView? = null
|
private var mSeekBarValueTextView: TextView? = null
|
||||||
private var mExampleTextTextView: TextView? = null
|
private var mExampleTextTextView: TextView? = null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the SeekBar should respond to the left/right keys
|
* Whether the SeekBar should respond to the left/right keys
|
||||||
*/
|
*/
|
||||||
/* synthetic access */
|
/* synthetic access */
|
||||||
var isAdjustable: Boolean = false
|
var isAdjustable: Boolean = false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to show the SeekBar value TextView next to the bar
|
* Whether to show the SeekBar value TextView next to the bar
|
||||||
*/
|
*/
|
||||||
private var mShowSeekBarValue: Boolean = false
|
private var mShowSeekBarValue: Boolean = false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the SeekBarPreference should continuously save the Seekbar value while it is being dragged.
|
* Whether the SeekBarPreference should continuously save the Seekbar value while it is being dragged.
|
||||||
*/
|
*/
|
||||||
/* synthetic access */
|
/* synthetic access */
|
||||||
var updatesContinuously: Boolean = false
|
var updatesContinuously: Boolean = false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listener reacting to the [SeekBar] changing value by the user
|
* Listener reacting to the [SeekBar] changing value by the user
|
||||||
*/
|
*/
|
||||||
|
@ -273,6 +280,8 @@ class TextPercentageSeekBarPreference @JvmOverloads constructor(
|
||||||
updateExampleTextValue(mSeekBarValue)
|
updateExampleTextValue(mSeekBarValue)
|
||||||
updateLabelValue(mSeekBarValue)
|
updateLabelValue(mSeekBarValue)
|
||||||
mSeekBar?.isEnabled = isEnabled
|
mSeekBar?.isEnabled = isEnabled
|
||||||
|
mSeekBarValueTextView?.alpha = if (isEnabled) 1F else HALF_ALPHA
|
||||||
|
mExampleTextTextView?.alpha = if (isEnabled) 1F else HALF_ALPHA
|
||||||
mSeekBar?.let {
|
mSeekBar?.let {
|
||||||
it.thumbOffset = it.thumb.intrinsicWidth.div(2 * PI).roundToInt()
|
it.thumbOffset = it.thumb.intrinsicWidth.div(2 * PI).roundToInt()
|
||||||
}
|
}
|
||||||
|
@ -461,6 +470,7 @@ class TextPercentageSeekBarPreference @JvmOverloads constructor(
|
||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "SeekBarPreference"
|
private const val TAG = "SeekBarPreference"
|
||||||
private const val STEP_SIZE = 5
|
private const val STEP_SIZE = 5
|
||||||
|
private const val HALF_ALPHA = 0.5F
|
||||||
private const val MIN_VALUE = 50
|
private const val MIN_VALUE = 50
|
||||||
private const val DECIMAL_CONVERSION = 100f
|
private const val DECIMAL_CONVERSION = 100f
|
||||||
private const val TEXT_SIZE = 16f
|
private const val TEXT_SIZE = 16f
|
||||||
|
|
|
@ -315,13 +315,16 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
val shouldShowSecurityPinWarning: Boolean
|
val shouldShowSecurityPinWarning: Boolean
|
||||||
get() = loginsSecureWarningCount.underMaxCount()
|
get() = loginsSecureWarningCount.underMaxCount()
|
||||||
|
|
||||||
fun shouldUseAutoSize() = fontSizeFactor == 1F
|
|
||||||
|
|
||||||
var shouldUseLightTheme by booleanPreference(
|
var shouldUseLightTheme by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_light_theme),
|
appContext.getPreferenceKey(R.string.pref_key_light_theme),
|
||||||
default = false
|
default = false
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var shouldUseAutoSize by booleanPreference(
|
||||||
|
appContext.getPreferenceKey(R.string.pref_key_accessibility_auto_size),
|
||||||
|
default = true
|
||||||
|
)
|
||||||
|
|
||||||
var fontSizeFactor by floatPreference(
|
var fontSizeFactor by floatPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_accessibility_font_scale),
|
appContext.getPreferenceKey(R.string.pref_key_accessibility_font_scale),
|
||||||
default = 1f
|
default = 1f
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
<string name="pref_key_site_permissions" translatable="false">pref_key_site_permissions</string>
|
<string name="pref_key_site_permissions" translatable="false">pref_key_site_permissions</string>
|
||||||
<string name="pref_key_add_private_browsing_shortcut" translatable="false">pref_key_add_private_browsing_shortcut</string>
|
<string name="pref_key_add_private_browsing_shortcut" translatable="false">pref_key_add_private_browsing_shortcut</string>
|
||||||
<string name="pref_key_accessibility" translatable="false">pref_key_accessibility</string>
|
<string name="pref_key_accessibility" translatable="false">pref_key_accessibility</string>
|
||||||
|
<string name="pref_key_accessibility_auto_size" translatable="false">pref_key_accessibility_auto_size</string>
|
||||||
<string name="pref_key_accessibility_font_scale" translatable="false">pref_key_accessibility_font_scale</string>
|
<string name="pref_key_accessibility_font_scale" translatable="false">pref_key_accessibility_font_scale</string>
|
||||||
<string name="pref_key_accessibility_force_enable_zoom" translatable="false">pref_key_accessibility_force_enable_zoom</string>
|
<string name="pref_key_accessibility_force_enable_zoom" translatable="false">pref_key_accessibility_force_enable_zoom</string>
|
||||||
<string name="pref_key_advanced" translatable="false">pref_key_advanced</string>
|
<string name="pref_key_advanced" translatable="false">pref_key_advanced</string>
|
||||||
|
|
|
@ -4,6 +4,11 @@
|
||||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="@string/pref_key_accessibility_auto_size"
|
||||||
|
android:summary="@string/preference_accessibility_auto_size_summary"
|
||||||
|
android:title="@string/preference_accessibility_auto_size_2" />
|
||||||
<!-- Custom Preference that scales from 50-200% by steps of 5 represented by 0-30 in steps of 1-->
|
<!-- Custom Preference that scales from 50-200% by steps of 5 represented by 0-30 in steps of 1-->
|
||||||
<org.mozilla.fenix.settings.TextPercentageSeekBarPreference
|
<org.mozilla.fenix.settings.TextPercentageSeekBarPreference
|
||||||
android:defaultValue="10"
|
android:defaultValue="10"
|
||||||
|
@ -13,6 +18,7 @@
|
||||||
android:summary="@string/preference_accessibility_text_size_summary"
|
android:summary="@string/preference_accessibility_text_size_summary"
|
||||||
android:title="@string/preference_accessibility_font_size_title"
|
android:title="@string/preference_accessibility_font_size_title"
|
||||||
app:adjustable="true"
|
app:adjustable="true"
|
||||||
|
app:enabled="false"
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
app:min="0"
|
app:min="0"
|
||||||
app:seekBarIncrement="1"
|
app:seekBarIncrement="1"
|
||||||
|
|
|
@ -43,6 +43,9 @@ class ExtensionsTest {
|
||||||
every {
|
every {
|
||||||
fragment.getString(R.string.pref_key_accessibility_force_enable_zoom)
|
fragment.getString(R.string.pref_key_accessibility_force_enable_zoom)
|
||||||
} returns "pref_key_accessibility_force_enable_zoom"
|
} returns "pref_key_accessibility_force_enable_zoom"
|
||||||
|
every {
|
||||||
|
fragment.getString(R.string.pref_key_accessibility_auto_size)
|
||||||
|
} returns "pref_key_accessibility_auto_size"
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -75,6 +78,11 @@ class ExtensionsTest {
|
||||||
every {
|
every {
|
||||||
fragment.findPreference<SwitchPreference>("pref_key_accessibility_auto_size")
|
fragment.findPreference<SwitchPreference>("pref_key_accessibility_auto_size")
|
||||||
} returns switchPreference
|
} returns switchPreference
|
||||||
|
|
||||||
|
assertEquals(
|
||||||
|
switchPreference,
|
||||||
|
fragment.requirePreference<SwitchPreference>(R.string.pref_key_accessibility_auto_size)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -258,6 +258,19 @@ class SettingsTest {
|
||||||
assertEquals(settings.getTabTimeout(), Settings.ONE_MONTH_MS)
|
assertEquals(settings.getTabTimeout(), Settings.ONE_MONTH_MS)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun shouldUseAutoSize() {
|
||||||
|
// When just created
|
||||||
|
// Then
|
||||||
|
assertTrue(settings.shouldUseAutoSize)
|
||||||
|
|
||||||
|
// When
|
||||||
|
settings.shouldUseAutoSize = false
|
||||||
|
|
||||||
|
// Then
|
||||||
|
assertFalse(settings.shouldUseAutoSize)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun shouldAutofill() {
|
fun shouldAutofill() {
|
||||||
// When just created
|
// When just created
|
||||||
|
|
Loading…
Reference in New Issue