package de.arxsilex.maptools.converter.desktop

import java.nio.file.Files
import java.util.Locale
import kotlin.test.Test
import kotlin.test.assertEquals

class AppPreferencesTest {
    @Test
    fun `preferences stay in portable application directory and round trip`() {
        val directory = Files.createTempDirectory("maptools-preferences-test")
        val file = AppPreferencesStore.settingsFile(directory)
        assertEquals(directory.resolve("settings").resolve("preferences.properties"), file)

        val expected = AppPreferences(AppLanguage.SWEDISH, MeasurementSystem.IMPERIAL)
        AppPreferencesStore.save(expected, file)
        assertEquals(expected, AppPreferencesStore.load(file, Locale.ENGLISH))
    }
}
