summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qt4/tests/manager-file.cpp43
-rw-r--r--qt4/tests/telepathy/managers/test-manager-file.manager61
2 files changed, 102 insertions, 2 deletions
diff --git a/qt4/tests/manager-file.cpp b/qt4/tests/manager-file.cpp
index 93efef793..6343c68e1 100644
--- a/qt4/tests/manager-file.cpp
+++ b/qt4/tests/manager-file.cpp
@@ -27,8 +27,10 @@ void TestManagerFile::testManagerFile()
ManagerFile managerFile("test-manager-file");
QCOMPARE(managerFile.isValid(), true);
- QCOMPARE(managerFile.protocols(),
- QStringList() << "foo" << "bar");
+ QStringList protocols = managerFile.protocols();
+ protocols.sort();
+ QCOMPARE(protocols,
+ QStringList() << "bar" << "foo" << "somewhat-pathological");
ParamSpecList params = managerFile.parameters("foo");
QCOMPARE(containsParam(params, "account"), true);
@@ -49,6 +51,43 @@ void TestManagerFile::testManagerFile()
param = getParam(params, "encryption-key");
QCOMPARE(param->flags, (uint) ConnMgrParamFlagSecret);
QCOMPARE(param->signature, QString("s"));
+
+ params = managerFile.parameters("somewhat-pathological");
+ QCOMPARE(containsParam(params, "foo"), true);
+ QCOMPARE(containsParam(params, "semicolons"), true);
+ QCOMPARE(containsParam(params, "list"), true);
+ QCOMPARE(containsParam(params, "unterminated-list"), true);
+ QCOMPARE(containsParam(params, "spaces-in-list"), true);
+ QCOMPARE(containsParam(params, "escaped-semicolon-in-list"), true);
+ QCOMPARE(containsParam(params, "doubly-escaped-semicolon-in-list"), true);
+ QCOMPARE(containsParam(params, "triply-escaped-semicolon-in-list"), true);
+ QCOMPARE(containsParam(params, "empty-list"), true);
+ QCOMPARE(containsParam(params, "escaped-semicolon"), true);
+ QCOMPARE(containsParam(params, "object"), true);
+ QCOMPARE(containsParam(params, "non-existant"), false);
+
+ param = getParam(params, "foo");
+ QCOMPARE(param->flags, (uint) ConnMgrParamFlagRequired | ConnMgrParamFlagHasDefault);
+ QCOMPARE(param->signature, QString("s"));
+ param = getParam(params, "semicolons");
+ QCOMPARE(param->flags, (uint) ConnMgrParamFlagSecret | ConnMgrParamFlagHasDefault);
+ QCOMPARE(param->signature, QString("s"));
+ param = getParam(params, "list");
+ QCOMPARE(param->signature, QString("as"));
+ QCOMPARE(param->defaultValue.variant().toStringList(),
+ QStringList() << "list" << "of" << "misc");
+ param = getParam(params, "escaped-semicolon-in-list");
+ QCOMPARE(param->signature, QString("as"));
+ QCOMPARE(param->defaultValue.variant().toStringList(),
+ QStringList() << "list;of" << "misc");
+ param = getParam(params, "doubly-escaped-semicolon-in-list");
+ QCOMPARE(param->signature, QString("as"));
+ QCOMPARE(param->defaultValue.variant().toStringList(),
+ QStringList() << "list\\" << "of" << "misc");
+ param = getParam(params, "triply-escaped-semicolon-in-list");
+ QCOMPARE(param->signature, QString("as"));
+ QCOMPARE(param->defaultValue.variant().toStringList(),
+ QStringList() << "list\\;of" << "misc");
}
bool containsParam(const ParamSpecList &params, const char *name)
diff --git a/qt4/tests/telepathy/managers/test-manager-file.manager b/qt4/tests/telepathy/managers/test-manager-file.manager
index 9029e9533..e06c1d9ce 100644
--- a/qt4/tests/telepathy/managers/test-manager-file.manager
+++ b/qt4/tests/telepathy/managers/test-manager-file.manager
@@ -19,3 +19,64 @@ param-server-list = as
default-account = bar@default
default-port = 4321
default-server-list = bar;foo;
+
+[Protocol somewhat-pathological]
+# the value is "hello world"
+param-foo = s required
+default-foo = hello world
+
+# the value is "list;of;misc;" (it's not parsed as a list)
+param-semicolons=s secret
+default-semicolons=list;of;misc;
+
+# the values is a list ["list", "of", "misc"]
+param-list = as
+default-list = list;of;misc;
+
+# the spec says this is invalid but we should probably be permissive
+param-unterminated-list = as
+default-unterminated-list = list;of;misc
+
+# the value is a list ["list", " of", " misc "] (spaces significant)
+param-spaces-in-list = as
+default-spaces-in-list = list; of; misc ;
+
+# the value is a list ["list;of", "misc"]
+param-escaped-semicolon-in-list = as
+default-escaped-semicolon-in-list = list\;of;misc;
+
+# the value is a list ["list\", "of", "misc"]
+param-doubly-escaped-semicolon-in-list = as
+default-doubly-escaped-semicolon-in-list = list\\;of;misc;
+
+# the value is a list ["list\;of", "misc"]
+param-triply-escaped-semicolon-in-list = as
+default-triply-escaped-semicolon-in-list = list\\\;of;misc;
+
+# the value is an empty list
+param-empty-list = as
+default-empty-list = ;
+
+# this is probably technically a Desktop Entry spec violation?
+# we should be permissive, interpreting this as either "foo\;bar" or "foo;bar"
+# seems reasonable
+param-escaped-semicolon = s
+default-escaped-semicolon = foo\;bar
+
+# all the other types
+param-object = o
+default-object = /misc
+param-q = q
+default-q = 42
+param-u = u
+default-u = 42
+param-t = t
+default-t = 42
+param-n = n
+default-n = -42
+param-i = i
+default-i = -42
+param-x = x
+default-x = -42
+param-d = 42.0
+default-d = 42.0