summaryrefslogtreecommitdiff
path: root/app/src/test/java/org/terst/feedreader/data/SettingsTest.kt
blob: 5b2048bd9d02465698d8e14c593cb7dbf5f8a74c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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))
    }
}