ui: added smart search box
This change switches the search box in the search view from QLineEdit to the derived QtSmartSearchBox implementation, which is capeable of displaying tokens of the query as selectable button elements in different colors. It allows for all the usual mouse and keyboard interactions that the QLineEdit offers. fortune cookie message = Good news from someone dear is coming soon.
This commit is contained in:
@@ -77,14 +77,14 @@ public:
|
||||
void test_command_query()
|
||||
{
|
||||
TS_ASSERT_EQUALS(
|
||||
printedFilteredTestGraph("method"),
|
||||
printedFilteredTestGraph("'method'"),
|
||||
|
||||
"5 nodes: method:A::A method:A::A method:A::getCount method:A::process method:B::process\n"
|
||||
"0 edges:\n"
|
||||
);
|
||||
|
||||
TS_ASSERT_EQUALS(
|
||||
printedFilteredTestGraph("class"),
|
||||
printedFilteredTestGraph("'class'"),
|
||||
|
||||
"2 nodes: class:A class:B\n"
|
||||
"0 edges:\n"
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
void test_operator_not()
|
||||
{
|
||||
TS_ASSERT_EQUALS(
|
||||
printedFilteredTestGraph("!method"),
|
||||
printedFilteredTestGraph("!'method'"),
|
||||
|
||||
"7 nodes: "
|
||||
"class:A field:A::count undefined_type:int undefined_type:void class:B function:main "
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
void test_operator_sub()
|
||||
{
|
||||
TS_ASSERT_EQUALS(
|
||||
printedFilteredTestGraph("class.base"),
|
||||
printedFilteredTestGraph("'class'.'base'"),
|
||||
|
||||
"1 nodes: class:A\n"
|
||||
"0 edges:\n"
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
void test_operator_has()
|
||||
{
|
||||
TS_ASSERT_EQUALS(
|
||||
printedFilteredTestGraph("\"A\":field"),
|
||||
printedFilteredTestGraph("\"A\">'field'"),
|
||||
|
||||
"1 nodes: field:A::count\n"
|
||||
"0 edges:\n"
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
void test_operator_or()
|
||||
{
|
||||
TS_ASSERT_EQUALS(
|
||||
printedFilteredTestGraph("(static|const)"),
|
||||
printedFilteredTestGraph("('static'|'const')"),
|
||||
|
||||
"4 nodes: field:A::count method:A::getCount method:A::process method:B::process\n"
|
||||
"0 edges:\n"
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
void test_operator_group()
|
||||
{
|
||||
TS_ASSERT_EQUALS(
|
||||
printedFilteredTestGraph("(static|const).public"),
|
||||
printedFilteredTestGraph("('static'|'const').'public'"),
|
||||
|
||||
"1 nodes: method:A::getCount\n"
|
||||
"0 edges:\n"
|
||||
|
||||
@@ -20,16 +20,17 @@ public:
|
||||
printedQueryTree(" -"),
|
||||
|
||||
"- INVALID\n"
|
||||
"\"-\"\n"
|
||||
);
|
||||
}
|
||||
|
||||
void test_command_query()
|
||||
{
|
||||
TS_ASSERT_EQUALS(
|
||||
printedQueryTree("class"),
|
||||
printedQueryTree("'class'"),
|
||||
|
||||
"class\n"
|
||||
"class\n"
|
||||
"'class'\n"
|
||||
"'class'\n"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -39,6 +40,7 @@ public:
|
||||
printedQueryTree("banana"),
|
||||
|
||||
"banana INVALID\n"
|
||||
"\"banana\"\n"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -58,18 +60,23 @@ public:
|
||||
printedQueryTree("\"A"),
|
||||
|
||||
"\"A INVALID\n"
|
||||
"\"A\"\n"
|
||||
);
|
||||
|
||||
TS_ASSERT_EQUALS(
|
||||
printedQueryTree("\"\""),
|
||||
|
||||
"\"\" INVALID\n"
|
||||
"\"\"\n"
|
||||
);
|
||||
|
||||
TS_ASSERT_EQUALS(
|
||||
printedQueryTree("A\""),
|
||||
|
||||
"A \" INVALID\n"
|
||||
" \"A\"\n"
|
||||
". IMPLICIT\n"
|
||||
" \"\"\n"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -96,20 +103,20 @@ public:
|
||||
void test_operator_not_query()
|
||||
{
|
||||
TS_ASSERT_EQUALS(
|
||||
printedQueryTree("!field"),
|
||||
printedQueryTree("!'field'"),
|
||||
|
||||
"! field\n"
|
||||
"! 'field'\n"
|
||||
"!\n"
|
||||
" field\n"
|
||||
" 'field'\n"
|
||||
);
|
||||
|
||||
TS_ASSERT_EQUALS(
|
||||
printedQueryTree("!!field"),
|
||||
printedQueryTree("!!'field'"),
|
||||
|
||||
"! ! field\n"
|
||||
"! ! 'field'\n"
|
||||
"!\n"
|
||||
" !\n"
|
||||
" field\n"
|
||||
" 'field'\n"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -123,10 +130,10 @@ public:
|
||||
);
|
||||
|
||||
TS_ASSERT_EQUALS(
|
||||
printedQueryTree("field!"),
|
||||
printedQueryTree("'field'!"),
|
||||
|
||||
"field ! INVALID\n"
|
||||
" field\n"
|
||||
"'field' ! INVALID\n"
|
||||
" 'field'\n"
|
||||
"! INVALID\n"
|
||||
);
|
||||
}
|
||||
@@ -182,11 +189,11 @@ public:
|
||||
void test_operator_has_query()
|
||||
{
|
||||
TS_ASSERT_EQUALS(
|
||||
printedQueryTree("\"A\":\"B\""),
|
||||
printedQueryTree("\"A\">\"B\""),
|
||||
|
||||
"\"A\" : \"B\"\n"
|
||||
"\"A\" > \"B\"\n"
|
||||
" \"A\"\n"
|
||||
":\n"
|
||||
">\n"
|
||||
" \"B\"\n"
|
||||
);
|
||||
}
|
||||
@@ -269,7 +276,7 @@ public:
|
||||
|
||||
"\"A\" ( \"B\" )\n"
|
||||
" \"A\"\n"
|
||||
".\n"
|
||||
". IMPLICIT\n"
|
||||
" (\"B\")\n"
|
||||
);
|
||||
}
|
||||
@@ -277,85 +284,85 @@ public:
|
||||
void test_operator_precedence_not_before_sub()
|
||||
{
|
||||
TS_ASSERT_EQUALS(
|
||||
printedQueryTree("!method.!const"),
|
||||
printedQueryTree("!'method'.!'const'"),
|
||||
|
||||
"! method . ! const\n"
|
||||
"! 'method' . ! 'const'\n"
|
||||
" !\n"
|
||||
" method\n"
|
||||
" 'method'\n"
|
||||
".\n"
|
||||
" !\n"
|
||||
" const\n"
|
||||
" 'const'\n"
|
||||
);
|
||||
}
|
||||
|
||||
void test_operator_precedence_sub_before_has()
|
||||
{
|
||||
TS_ASSERT_EQUALS(
|
||||
printedQueryTree("namespace.class:method"),
|
||||
printedQueryTree("'namespace'.'class'>'method'"),
|
||||
|
||||
"namespace . class : method\n"
|
||||
" namespace\n"
|
||||
"'namespace' . 'class' > 'method'\n"
|
||||
" 'namespace'\n"
|
||||
" .\n"
|
||||
" class\n"
|
||||
":\n"
|
||||
" method\n"
|
||||
" 'class'\n"
|
||||
">\n"
|
||||
" 'method'\n"
|
||||
);
|
||||
}
|
||||
|
||||
void test_operator_precedence_has_before_or()
|
||||
{
|
||||
TS_ASSERT_EQUALS(
|
||||
printedQueryTree("class:method|field"),
|
||||
printedQueryTree("'class'>'method'|'field'"),
|
||||
|
||||
"class : method | field\n"
|
||||
" class\n"
|
||||
" :\n"
|
||||
" method\n"
|
||||
"'class' > 'method' | 'field'\n"
|
||||
" 'class'\n"
|
||||
" >\n"
|
||||
" 'method'\n"
|
||||
"|\n"
|
||||
" field\n"
|
||||
" 'field'\n"
|
||||
);
|
||||
}
|
||||
|
||||
void test_operator_precedence_respects_groups()
|
||||
{
|
||||
TS_ASSERT_EQUALS(
|
||||
printedQueryTree("namespace.(class:method)"),
|
||||
printedQueryTree("'namespace'.('class'>'method')"),
|
||||
|
||||
"namespace . ( class : method )\n"
|
||||
" namespace\n"
|
||||
"'namespace' . ( 'class' > 'method' )\n"
|
||||
" 'namespace'\n"
|
||||
".\n"
|
||||
" class\n"
|
||||
" (:)\n"
|
||||
" method\n"
|
||||
" 'class'\n"
|
||||
" (>)\n"
|
||||
" 'method'\n"
|
||||
);
|
||||
|
||||
TS_ASSERT_EQUALS(
|
||||
printedQueryTree("class:(method|field)"),
|
||||
printedQueryTree("'class'>('method'|'field')"),
|
||||
|
||||
"class : ( method | field )\n"
|
||||
" class\n"
|
||||
":\n"
|
||||
" method\n"
|
||||
"'class' > ( 'method' | 'field' )\n"
|
||||
" 'class'\n"
|
||||
">\n"
|
||||
" 'method'\n"
|
||||
" (|)\n"
|
||||
" field\n"
|
||||
" 'field'\n"
|
||||
);
|
||||
}
|
||||
|
||||
void test_spaces_get_stripped_out_of_query()
|
||||
{
|
||||
TS_ASSERT_EQUALS(
|
||||
printedQueryTree(" \"Field \":(method | field) .const | public "),
|
||||
printedQueryTree(" \"Field \">('method' | 'field') .'const' | 'public' "),
|
||||
|
||||
"\"Field\" : ( method | field ) . const | public\n"
|
||||
"\"Field\" > ( 'method' | 'field' ) . 'const' | 'public'\n"
|
||||
" \"Field\"\n"
|
||||
" :\n"
|
||||
" method\n"
|
||||
" >\n"
|
||||
" 'method'\n"
|
||||
" (|)\n"
|
||||
" field\n"
|
||||
" 'field'\n"
|
||||
" .\n"
|
||||
" const\n"
|
||||
" 'const'\n"
|
||||
"|\n"
|
||||
" public\n"
|
||||
" 'public'\n"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -211,4 +211,29 @@ public:
|
||||
TS_ASSERT(!utility::isPrefix(foo, bar));
|
||||
TS_ASSERT(!utility::isPrefix(bar, foo));
|
||||
}
|
||||
|
||||
void test_equals_case_insensitive_with_different_cases()
|
||||
{
|
||||
const std::string foo = "FooBar";
|
||||
const std::string foo2 = "foobar";
|
||||
|
||||
TS_ASSERT(utility::equalsCaseInsensitive(foo, foo2));
|
||||
}
|
||||
|
||||
void test_equals_case_insensitive_with_same_cases()
|
||||
{
|
||||
const std::string foo = "foobar";
|
||||
const std::string foo2 = "foobar";
|
||||
|
||||
TS_ASSERT(utility::equalsCaseInsensitive(foo, foo2));
|
||||
}
|
||||
|
||||
void test_equals_case_insensitive_with_different_strings()
|
||||
{
|
||||
const std::string foo = "foo";
|
||||
const std::string foo2 = "foobar";
|
||||
|
||||
TS_ASSERT(!utility::equalsCaseInsensitive(foo, foo2));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user