← Back to team overview

uonedb-qt team mailing list archive

[Merge] lp:~kalikiana/u1db-qt/testfixes into lp:u1db-qt

 

Christian Dywan has proposed merging lp:~kalikiana/u1db-qt/testfixes into lp:u1db-qt.

Commit message:
Enable and fix number and defaults behavior

Requested reviews:
  U1DB Qt developers (uonedb-qt)

For more details, see:
https://code.launchpad.net/~kalikiana/u1db-qt/testfixes/+merge/161510

Enable and fix number and defaults behavior
-- 
https://code.launchpad.net/~kalikiana/u1db-qt/testfixes/+merge/161510
Your team U1DB Qt developers is requested to review the proposed merge of lp:~kalikiana/u1db-qt/testfixes into lp:u1db-qt.
=== modified file 'src/query.cpp'
--- src/query.cpp	2013-04-25 14:03:04 +0000
+++ src/query.cpp	2013-04-29 21:48:34 +0000
@@ -164,14 +164,21 @@
 
     QString value_string = value.toString();
     QVariant query = getQuery();
+    // * is the default if query is empty
+    if (!query.isValid())
+        query = QVariant(QString("*"));
     QString typeName = query.typeName();
 
-
     if(typeName == "QString")
     {
         QString query_string = query.toString();
         match = queryString(query_string, value_string);
     }
+    else if(typeName == "int")
+    {
+        QString query_string = query.toString();
+        match = queryString(query_string, value_string);
+    }
     else if(typeName == "QVariantList")
     {
         match = iterateQueryList(query, field, value_string);

=== modified file 'tests/tst_query.qml'
--- tests/tst_query.qml	2013-04-25 13:38:33 +0000
+++ tests/tst_query.qml	2013-04-29 21:48:34 +0000
@@ -133,10 +133,8 @@
 
     function test_1_defaults () {
         // We should get all documents
-        /* FIXME: */ defaultPhone.query = '*'
         workaroundQueryAndWait(defaultPhone)
         compare(defaultPhone.documents, ['1', '_', 'a'], 'uno')
-        console.log(defaultPhone.results)
         compare(defaultPhone.results.length, 5, 'dos')
         // FIXME: compare(defaultPhone.results, [], 'dos')
         // These queries are functionally equivalent
@@ -145,6 +143,7 @@
         workaroundQueryAndWait(allPhoneKeywords)
         // FIXME: compare(defaultPhone.documents, allPhoneKeywords.documents, 'cinco')
         // Results are also equivalent
+        // FIXME: compare(defaultPhone.results.length, allPhoneKeywords.results.length , 'siete')
         // FIXME: compare(defaultPhone.results, allPhoneKeywords.results, 'seis')
     }
 
@@ -152,7 +151,7 @@
         // We should get '1'
         compare(s12345Phone.documents, ['1'], 'uno')
         // It's okay to mix strings and numerical values
-        // FIXME: compare(s12345Phone.documents, i12345Phone.documents, 'dos')
+        compare(s12345Phone.documents, i12345Phone.documents, 'dos')
     }
 
     function test_3_wildcards () {


Follow ups