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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
// libraries
#include <gtest/gtest.h>
// local
#include <XdgUtils/DesktopEntry/DesktopEntryExecValue.h>
using namespace XdgUtils::DesktopEntry;
TEST(TestDesktopDesktopEntryExecValue, create) {
DesktopEntryExecValue value("fooview %F");
}
TEST(TestDesktopDesktopEntryExecValue, size) {
ASSERT_EQ(DesktopEntryExecValue("fooview %F").size(), 2);
ASSERT_EQ(DesktopEntryExecValue("\"spaced dir/run\" %F").size(), 2);
}
TEST(TestDesktopDesktopEntryExecValue, access) {
DesktopEntryExecValue value("\"spaced dir/run\" %F");
std::vector<std::string> expected = {"spaced dir/run", "%F"};
ASSERT_EQ(value.size(), expected.size());
for (int i = 0; i < value.size(); ++i)
ASSERT_EQ(value[i], expected[i]);
}
TEST(TestDesktopDesktopEntryExecValue, dump) {
const auto str = "\"spaced dir/run\" %F";
DesktopEntryExecValue value(str);
ASSERT_EQ(value.dump(), str);
}
TEST(TestDesktopDesktopEntryExecValue, set) {
const auto str = "\"spaced dir/run\" %F";
DesktopEntryExecValue value(str);
value[0] = "random/$PWD/bin";
ASSERT_EQ(value.dump(), "\"random/\\$PWD/bin\" %F");
}
TEST(TestDesktopDesktopEntryExecValue, append) {
DesktopEntryExecValue stringList;
stringList.append("1");
ASSERT_EQ(stringList.size(), 1);
ASSERT_EQ(stringList[0], "1");
}
TEST(TestDesktopDesktopEntryExecValue, remove) {
DesktopEntryExecValue stringList("1 2");
stringList.remove(0);
ASSERT_EQ(stringList.size(), 1);
ASSERT_EQ(stringList[0], "2");
}
|