mirror of
https://github.com/debauchee/barrier.git
synced 2024-11-25 19:22:31 +03:00
gui/test: Remove testing of different QSettings formats
QSettings guarantees are provided regardless of the format and until we use a custom format it does not make sense to verify guarantees provided by Qt.
This commit is contained in:
parent
141f6de2c4
commit
7befd121d4
@ -148,13 +148,13 @@ namespace {
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void doHotkeyLoadSaveTest(const TestHotKey& test_hotkey, QSettings::Format format)
|
||||
void doHotkeyLoadSaveTest(const TestHotKey& test_hotkey)
|
||||
{
|
||||
auto filename = getTemporaryFilename();
|
||||
|
||||
Hotkey hotkey_before, hotkey_after;
|
||||
{
|
||||
QSettings settings(filename, format);
|
||||
QSettings settings(filename, QSettings::NativeFormat);
|
||||
|
||||
hotkey_before = createHotkey(test_hotkey);
|
||||
|
||||
@ -163,7 +163,7 @@ void doHotkeyLoadSaveTest(const TestHotKey& test_hotkey, QSettings::Format forma
|
||||
settings.endGroup();
|
||||
}
|
||||
{
|
||||
QSettings settings(filename, format);
|
||||
QSettings settings(filename, QSettings::NativeFormat);
|
||||
|
||||
settings.beginGroup("test");
|
||||
hotkey_after.loadSettings(settings);
|
||||
@ -198,15 +198,13 @@ void doHotkeyLoadSaveTest(const TestHotKey& test_hotkey, QSettings::Format forma
|
||||
TEST(HotkeyLoadSaveTests, Empty)
|
||||
{
|
||||
TestHotKey hotkey;
|
||||
doHotkeyLoadSaveTest(hotkey, QSettings::NativeFormat);
|
||||
doHotkeyLoadSaveTest(hotkey, QSettings::IniFormat);
|
||||
doHotkeyLoadSaveTest(hotkey);
|
||||
}
|
||||
|
||||
TEST(HotkeyLoadSaveTests, KeysNoActions)
|
||||
{
|
||||
TestHotKey hotkey = {{{Qt::Key_A, Qt::NoModifier}, {Qt::Key_B, Qt::NoModifier}}, {}};
|
||||
doHotkeyLoadSaveTest(hotkey, QSettings::NativeFormat);
|
||||
doHotkeyLoadSaveTest(hotkey, QSettings::IniFormat);
|
||||
doHotkeyLoadSaveTest(hotkey);
|
||||
}
|
||||
|
||||
TEST(HotkeyLoadSaveTests, CommaKeyNoActions)
|
||||
@ -217,8 +215,7 @@ TEST(HotkeyLoadSaveTests, CommaKeyNoActions)
|
||||
{Qt::Key_Comma, Qt::NoModifier},
|
||||
{Qt::Key_B, Qt::NoModifier}
|
||||
}, {}};
|
||||
doHotkeyLoadSaveTest(hotkey, QSettings::NativeFormat);
|
||||
doHotkeyLoadSaveTest(hotkey, QSettings::IniFormat);
|
||||
doHotkeyLoadSaveTest(hotkey);
|
||||
}
|
||||
|
||||
TEST(HotkeyLoadSaveTests, KeysSingleAction)
|
||||
@ -232,8 +229,7 @@ TEST(HotkeyLoadSaveTests, KeysSingleAction)
|
||||
TestAction::createKeyDown({{Qt::Key_Z, Qt::NoModifier}})
|
||||
}
|
||||
};
|
||||
doHotkeyLoadSaveTest(hotkey, QSettings::NativeFormat);
|
||||
doHotkeyLoadSaveTest(hotkey, QSettings::IniFormat);
|
||||
doHotkeyLoadSaveTest(hotkey);
|
||||
}
|
||||
|
||||
TEST(HotkeyLoadSaveTests, KeysMultipleAction)
|
||||
@ -248,6 +244,5 @@ TEST(HotkeyLoadSaveTests, KeysMultipleAction)
|
||||
TestAction::createSwitchToScreen("test_screen")
|
||||
}
|
||||
};
|
||||
doHotkeyLoadSaveTest(hotkey, QSettings::NativeFormat);
|
||||
doHotkeyLoadSaveTest(hotkey, QSettings::IniFormat);
|
||||
doHotkeyLoadSaveTest(hotkey);
|
||||
}
|
||||
|
@ -86,17 +86,16 @@ namespace {
|
||||
} // namespace
|
||||
|
||||
class KeySequenceLoadSaveTestFixture :
|
||||
public ::testing::TestWithParam<std::tr1::tuple<Qt::Key, QSettings::Format>> {};
|
||||
public ::testing::TestWithParam<Qt::Key> {};
|
||||
|
||||
TEST_P(KeySequenceLoadSaveTestFixture, SupportsSpecialSymbols)
|
||||
{
|
||||
int key = std::tr1::get<0>(GetParam());
|
||||
QSettings::Format format = std::tr1::get<1>(GetParam());
|
||||
int key = GetParam();
|
||||
|
||||
auto filename = getTemporaryFilename();
|
||||
|
||||
{
|
||||
QSettings settings(filename, format);
|
||||
QSettings settings(filename, QSettings::NativeFormat);
|
||||
KeySequence sequence;
|
||||
|
||||
sequence.appendKey(key, 0);
|
||||
@ -106,7 +105,7 @@ TEST_P(KeySequenceLoadSaveTestFixture, SupportsSpecialSymbols)
|
||||
settings.endGroup();
|
||||
}
|
||||
{
|
||||
QSettings settings(filename, format);
|
||||
QSettings settings(filename, QSettings::NativeFormat);
|
||||
KeySequence sequence;
|
||||
|
||||
settings.beginGroup("test");
|
||||
@ -125,8 +124,7 @@ TEST_P(KeySequenceLoadSaveTestFixture, SupportsSpecialSymbols)
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
KeySequenceLoadSaveTests,
|
||||
KeySequenceLoadSaveTestFixture,
|
||||
::testing::Combine(::testing::ValuesIn(s_key_sequence_test_keys),
|
||||
::testing::Values(QSettings::NativeFormat, QSettings::IniFormat)));
|
||||
::testing::ValuesIn(s_key_sequence_test_keys));
|
||||
|
||||
TEST(KeySequenceTests, ToString)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user