summaryrefslogtreecommitdiff
path: root/app/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/test')
-rw-r--r--app/src/test/java/org/terst/feedreader/data/SettingsTest.kt32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/src/test/java/org/terst/feedreader/data/SettingsTest.kt b/app/src/test/java/org/terst/feedreader/data/SettingsTest.kt
new file mode 100644
index 0000000..5b2048b
--- /dev/null
+++ b/app/src/test/java/org/terst/feedreader/data/SettingsTest.kt
@@ -0,0 +1,32 @@
+package org.terst.feedreader.data
+
+import org.junit.Assert.assertEquals
+import org.junit.Test
+
+class SettingsTest {
+
+ @Test
+ fun `pinch zoom with scale factor of 1 leaves the font size unchanged`() {
+ assertEquals(18, pinchZoomFontSizePx(18, 1.0f))
+ }
+
+ @Test
+ fun `pinching out scales the font size up, rounded to the nearest pixel`() {
+ assertEquals(22, pinchZoomFontSizePx(20, 1.1f))
+ }
+
+ @Test
+ fun `pinching in scales the font size down, rounded to the nearest pixel`() {
+ assertEquals(16, pinchZoomFontSizePx(20, 0.8f))
+ }
+
+ @Test
+ fun `pinch zoom result is clamped to the minimum reader font size`() {
+ assertEquals(READER_FONT_SIZE_RANGE_PX.first, pinchZoomFontSizePx(14, 0.3f))
+ }
+
+ @Test
+ fun `pinch zoom result is clamped to the maximum reader font size`() {
+ assertEquals(READER_FONT_SIZE_RANGE_PX.last, pinchZoomFontSizePx(28, 3.0f))
+ }
+}