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
|
} // namespace
|
||||||
|
|
||||||
void doHotkeyLoadSaveTest(const TestHotKey& test_hotkey, QSettings::Format format)
|
void doHotkeyLoadSaveTest(const TestHotKey& test_hotkey)
|
||||||
{
|
{
|
||||||
auto filename = getTemporaryFilename();
|
auto filename = getTemporaryFilename();
|
||||||
|
|
||||||
Hotkey hotkey_before, hotkey_after;
|
Hotkey hotkey_before, hotkey_after;
|
||||||
{
|
{
|
||||||
QSettings settings(filename, format);
|
QSettings settings(filename, QSettings::NativeFormat);
|
||||||
|
|
||||||
hotkey_before = createHotkey(test_hotkey);
|
hotkey_before = createHotkey(test_hotkey);
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ void doHotkeyLoadSaveTest(const TestHotKey& test_hotkey, QSettings::Format forma
|
|||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QSettings settings(filename, format);
|
QSettings settings(filename, QSettings::NativeFormat);
|
||||||
|
|
||||||
settings.beginGroup("test");
|
settings.beginGroup("test");
|
||||||
hotkey_after.loadSettings(settings);
|
hotkey_after.loadSettings(settings);
|
||||||
@ -198,15 +198,13 @@ void doHotkeyLoadSaveTest(const TestHotKey& test_hotkey, QSettings::Format forma
|
|||||||
TEST(HotkeyLoadSaveTests, Empty)
|
TEST(HotkeyLoadSaveTests, Empty)
|
||||||
{
|
{
|
||||||
TestHotKey hotkey;
|
TestHotKey hotkey;
|
||||||
doHotkeyLoadSaveTest(hotkey, QSettings::NativeFormat);
|
doHotkeyLoadSaveTest(hotkey);
|
||||||
doHotkeyLoadSaveTest(hotkey, QSettings::IniFormat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(HotkeyLoadSaveTests, KeysNoActions)
|
TEST(HotkeyLoadSaveTests, KeysNoActions)
|
||||||
{
|
{
|
||||||
TestHotKey hotkey = {{{Qt::Key_A, Qt::NoModifier}, {Qt::Key_B, Qt::NoModifier}}, {}};
|
TestHotKey hotkey = {{{Qt::Key_A, Qt::NoModifier}, {Qt::Key_B, Qt::NoModifier}}, {}};
|
||||||
doHotkeyLoadSaveTest(hotkey, QSettings::NativeFormat);
|
doHotkeyLoadSaveTest(hotkey);
|
||||||
doHotkeyLoadSaveTest(hotkey, QSettings::IniFormat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(HotkeyLoadSaveTests, CommaKeyNoActions)
|
TEST(HotkeyLoadSaveTests, CommaKeyNoActions)
|
||||||
@ -217,8 +215,7 @@ TEST(HotkeyLoadSaveTests, CommaKeyNoActions)
|
|||||||
{Qt::Key_Comma, Qt::NoModifier},
|
{Qt::Key_Comma, Qt::NoModifier},
|
||||||
{Qt::Key_B, Qt::NoModifier}
|
{Qt::Key_B, Qt::NoModifier}
|
||||||
}, {}};
|
}, {}};
|
||||||
doHotkeyLoadSaveTest(hotkey, QSettings::NativeFormat);
|
doHotkeyLoadSaveTest(hotkey);
|
||||||
doHotkeyLoadSaveTest(hotkey, QSettings::IniFormat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(HotkeyLoadSaveTests, KeysSingleAction)
|
TEST(HotkeyLoadSaveTests, KeysSingleAction)
|
||||||
@ -232,8 +229,7 @@ TEST(HotkeyLoadSaveTests, KeysSingleAction)
|
|||||||
TestAction::createKeyDown({{Qt::Key_Z, Qt::NoModifier}})
|
TestAction::createKeyDown({{Qt::Key_Z, Qt::NoModifier}})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
doHotkeyLoadSaveTest(hotkey, QSettings::NativeFormat);
|
doHotkeyLoadSaveTest(hotkey);
|
||||||
doHotkeyLoadSaveTest(hotkey, QSettings::IniFormat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(HotkeyLoadSaveTests, KeysMultipleAction)
|
TEST(HotkeyLoadSaveTests, KeysMultipleAction)
|
||||||
@ -248,6 +244,5 @@ TEST(HotkeyLoadSaveTests, KeysMultipleAction)
|
|||||||
TestAction::createSwitchToScreen("test_screen")
|
TestAction::createSwitchToScreen("test_screen")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
doHotkeyLoadSaveTest(hotkey, QSettings::NativeFormat);
|
doHotkeyLoadSaveTest(hotkey);
|
||||||
doHotkeyLoadSaveTest(hotkey, QSettings::IniFormat);
|
|
||||||
}
|
}
|
||||||
|
@ -86,17 +86,16 @@ namespace {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
class KeySequenceLoadSaveTestFixture :
|
class KeySequenceLoadSaveTestFixture :
|
||||||
public ::testing::TestWithParam<std::tr1::tuple<Qt::Key, QSettings::Format>> {};
|
public ::testing::TestWithParam<Qt::Key> {};
|
||||||
|
|
||||||
TEST_P(KeySequenceLoadSaveTestFixture, SupportsSpecialSymbols)
|
TEST_P(KeySequenceLoadSaveTestFixture, SupportsSpecialSymbols)
|
||||||
{
|
{
|
||||||
int key = std::tr1::get<0>(GetParam());
|
int key = GetParam();
|
||||||
QSettings::Format format = std::tr1::get<1>(GetParam());
|
|
||||||
|
|
||||||
auto filename = getTemporaryFilename();
|
auto filename = getTemporaryFilename();
|
||||||
|
|
||||||
{
|
{
|
||||||
QSettings settings(filename, format);
|
QSettings settings(filename, QSettings::NativeFormat);
|
||||||
KeySequence sequence;
|
KeySequence sequence;
|
||||||
|
|
||||||
sequence.appendKey(key, 0);
|
sequence.appendKey(key, 0);
|
||||||
@ -106,7 +105,7 @@ TEST_P(KeySequenceLoadSaveTestFixture, SupportsSpecialSymbols)
|
|||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QSettings settings(filename, format);
|
QSettings settings(filename, QSettings::NativeFormat);
|
||||||
KeySequence sequence;
|
KeySequence sequence;
|
||||||
|
|
||||||
settings.beginGroup("test");
|
settings.beginGroup("test");
|
||||||
@ -125,8 +124,7 @@ TEST_P(KeySequenceLoadSaveTestFixture, SupportsSpecialSymbols)
|
|||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
KeySequenceLoadSaveTests,
|
KeySequenceLoadSaveTests,
|
||||||
KeySequenceLoadSaveTestFixture,
|
KeySequenceLoadSaveTestFixture,
|
||||||
::testing::Combine(::testing::ValuesIn(s_key_sequence_test_keys),
|
::testing::ValuesIn(s_key_sequence_test_keys));
|
||||||
::testing::Values(QSettings::NativeFormat, QSettings::IniFormat)));
|
|
||||||
|
|
||||||
TEST(KeySequenceTests, ToString)
|
TEST(KeySequenceTests, ToString)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user