2020-08-12 13:16:25 +02:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
2022-09-02 16:19:18 +02:00
|
|
|
"strings"
|
2020-08-12 13:16:25 +02:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
2022-04-06 17:46:41 +02:00
|
|
|
func TestConfig_RawEnabled(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
|
|
|
|
assert.NotEqual(t, c.DisableRaw(), c.RawEnabled())
|
|
|
|
}
|
|
|
|
|
2020-08-12 13:16:25 +02:00
|
|
|
func TestConfig_RawtherapeeBin(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
|
2022-09-02 16:19:18 +02:00
|
|
|
assert.True(t, strings.Contains(c.RawtherapeeBin(), "/bin/rawtherapee-cli"))
|
2020-08-12 13:16:25 +02:00
|
|
|
}
|
|
|
|
|
2021-09-21 15:33:46 +02:00
|
|
|
func TestConfig_RawtherapeeBlacklist(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
|
|
|
|
c.options.RawtherapeeBlacklist = "foo,bar"
|
|
|
|
assert.Equal(t, "foo,bar", c.RawtherapeeBlacklist())
|
|
|
|
c.options.RawtherapeeBlacklist = ""
|
|
|
|
assert.Equal(t, "", c.RawtherapeeBlacklist())
|
|
|
|
}
|
|
|
|
|
2021-08-25 13:41:51 +02:00
|
|
|
func TestConfig_RawtherapeeEnabled(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
assert.True(t, c.RawtherapeeEnabled())
|
|
|
|
|
|
|
|
c.options.DisableRawtherapee = true
|
|
|
|
assert.False(t, c.RawtherapeeEnabled())
|
|
|
|
}
|
|
|
|
|
2020-08-12 13:16:25 +02:00
|
|
|
func TestConfig_DarktableBin(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
|
2022-09-02 16:19:18 +02:00
|
|
|
assert.True(t, strings.Contains(c.DarktableBin(), "/bin/darktable-cli"))
|
2020-08-12 13:16:25 +02:00
|
|
|
}
|
|
|
|
|
2021-09-21 15:33:46 +02:00
|
|
|
func TestConfig_DarktableBlacklist(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
|
|
|
|
assert.Equal(t, "raf,cr3", c.DarktableBlacklist())
|
|
|
|
}
|
|
|
|
|
2020-08-12 13:16:25 +02:00
|
|
|
func TestConfig_DarktablePresets(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
|
2021-05-01 10:25:34 +02:00
|
|
|
assert.False(t, c.RawPresets())
|
2020-08-12 13:16:25 +02:00
|
|
|
}
|
|
|
|
|
2021-08-25 13:41:51 +02:00
|
|
|
func TestConfig_DarktableEnabled(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
assert.True(t, c.DarktableEnabled())
|
|
|
|
|
|
|
|
c.options.DisableDarktable = true
|
|
|
|
assert.False(t, c.DarktableEnabled())
|
|
|
|
}
|
|
|
|
|
2020-08-12 13:16:25 +02:00
|
|
|
func TestConfig_SipsBin(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
|
|
|
|
bin := c.SipsBin()
|
|
|
|
assert.Equal(t, "", bin)
|
|
|
|
}
|
|
|
|
|
2021-08-25 13:41:51 +02:00
|
|
|
func TestConfig_SipsEnabled(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
2022-04-06 17:46:41 +02:00
|
|
|
assert.NotEqual(t, c.DisableSips(), c.SipsEnabled())
|
2021-08-25 13:41:51 +02:00
|
|
|
}
|
|
|
|
|
2020-08-12 13:16:25 +02:00
|
|
|
func TestConfig_HeifConvertBin(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
|
|
|
|
bin := c.HeifConvertBin()
|
2021-02-22 21:09:50 +01:00
|
|
|
assert.Contains(t, bin, "/bin/heif-convert")
|
2020-08-12 13:16:25 +02:00
|
|
|
}
|
2021-08-25 13:41:51 +02:00
|
|
|
|
|
|
|
func TestConfig_HeifConvertEnabled(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
assert.True(t, c.HeifConvertEnabled())
|
|
|
|
|
|
|
|
c.options.DisableHeifConvert = true
|
|
|
|
assert.False(t, c.HeifConvertEnabled())
|
|
|
|
}
|