Merge lp:~kalikiana/dee-qt/deevarianttext into lp:dee-qt/0.2

Proposed by Cris Dywan
Status: Superseded
Proposed branch: lp:~kalikiana/dee-qt/deevarianttext
Merge into: lp:dee-qt/0.2
Prerequisite: lp:~unity-team/dee-qt/qt4-and-qt5
Diff against target: 1252 lines (+589/-260)
29 files modified
.bzrignore (+16/-3)
CMakeLists.txt (+30/-90)
debian/changelog (+13/-0)
debian/control (+9/-7)
debian/libdee-qt-3.install (+3/-3)
debian/libdee-qt-dev.install (+3/-3)
debian/libdee-qt5-3.install (+3/-3)
debian/libdee-qt5-dev.install (+3/-3)
deelistmodel.cpp (+19/-21)
deelistmodel.h (+3/-2)
deeprivate.h (+23/-0)
deevarianttext.cpp (+72/-0)
deevarianttext.h (+49/-0)
libdee-qt.pc.in (+5/-5)
modules/CMakeLists.txt (+1/-0)
modules/Dee/CMakeLists.txt (+46/-0)
modules/Dee/plugin.cpp (+5/-3)
modules/Dee/plugin.h (+1/-1)
modules/Dee/qmldir (+1/-1)
test.cpp (+0/-35)
test.h (+0/-52)
test_qtquick2.qml (+0/-15)
tests/CMakeLists.txt (+57/-0)
tests/conversiontest.cpp (+1/-0)
tests/deevarianttexttest.cpp (+58/-0)
tests/qtquick1plugintest.cpp (+48/-0)
tests/test_qtquick1.qml (+38/-13)
tests/tst_deelistmodel.qml (+22/-0)
tests/tst_deevarianttext.qml (+60/-0)
To merge this branch: bzr merge lp:~kalikiana/dee-qt/deevarianttext
Reviewer Review Type Date Requested Status
Michał Sawicz Pending
Review via email: mp+137918@code.launchpad.net

This proposal has been superseded by a proposal from 2012-12-04.

To post a comment you must log in.
lp:~kalikiana/dee-qt/deevarianttext updated
97. By Cris Dywan

Merge lp:~saviq/dee-qt/rename-libs

98. By Cris Dywan

Fix running deevarianttexttest

99. By Cris Dywan

Add insertRemoveTest (needs improvement)

100. By Cris Dywan

Fixup insertRemoveTest

101. By Cris Dywan

Use QSignalSpy instead of manual callbacks to verify signals

102. By Cris Dywan

Expose append/ remove to QML to allow hosting new models

For now only in test models and no API to set the schema.

103. By Cris Dywan

Emit layoutChanged in addition to countChanged

104. By Cris Dywan

Use SignalSpy in QML - preliminary text delegate testing

105. By Cris Dywan

Use QT_INSTALL_QML (QtQuick2) instead of QT_INSTALL_IMPORTS (QtQuick1)

See http://doc-snapshot.qt-project.org/5.0/qtcore/qlibraryinfo.html#LibraryLocation-enum

106. By Cris Dywan

Drop delegate test, the approach is wrong

107. By Cris Dywan

Drop remaining pieces of delegate approach as well

Unmerged revisions

107. By Cris Dywan

Drop remaining pieces of delegate approach as well

106. By Cris Dywan

Drop delegate test, the approach is wrong

105. By Cris Dywan

Use QT_INSTALL_QML (QtQuick2) instead of QT_INSTALL_IMPORTS (QtQuick1)

See http://doc-snapshot.qt-project.org/5.0/qtcore/qlibraryinfo.html#LibraryLocation-enum

104. By Cris Dywan

Use SignalSpy in QML - preliminary text delegate testing

103. By Cris Dywan

Emit layoutChanged in addition to countChanged

102. By Cris Dywan

Expose append/ remove to QML to allow hosting new models

For now only in test models and no API to set the schema.

101. By Cris Dywan

Use QSignalSpy instead of manual callbacks to verify signals

100. By Cris Dywan

Fixup insertRemoveTest

99. By Cris Dywan

Add insertRemoveTest (needs improvement)

98. By Cris Dywan

Fix running deevarianttexttest

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2010-11-22 08:03:37 +0000
+++ .bzrignore 2012-12-04 18:48:20 +0000
@@ -2,7 +2,20 @@
2CMakeFiles2CMakeFiles
3Makefile3Makefile
4cmake_install.cmake4cmake_install.cmake
5install_manifest.txt
6libdee-qt.so*
7libdee-qt5.so*
5libQtDee.so*8libQtDee.so*
6moc_*.cxx9moc_*.cpp
7test10*.moc
8install_manifest.txt11*_automoc.cpp
12*.pc
13CTestTestfile.cmake
14*Test.log
15Testing
16conversiontest
17deelistmodeltest
18deevarianttexttest
19plugintest
20test-helper
21*-xunit.xml
922
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2012-12-04 18:48:20 +0000
+++ CMakeLists.txt 2012-12-04 18:48:20 +0000
@@ -1,4 +1,4 @@
1project(libqtdee)1project(dee-qt)
2cmake_minimum_required(VERSION 2.8.6)2cmake_minimum_required(VERSION 2.8.6)
33
4# Instruct CMake to run moc automatically when needed.4# Instruct CMake to run moc automatically when needed.
@@ -10,22 +10,15 @@
10 message("Building Qt5 version")10 message("Building Qt5 version")
1111
12 find_package(Qt5Core REQUIRED)12 find_package(Qt5Core REQUIRED)
13 find_package(Qt5Quick REQUIRED)
14 find_package(Qt5Test REQUIRED)
15 find_package(Qt5DBus REQUIRED)13 find_package(Qt5DBus REQUIRED)
1614
17 add_definitions(-DWITHQT5=1)15 add_definitions(-DWITHQT5=1)
1816
19 set(QTDEE_LIBNAME QtDee-qt5)17 set(DEE_QT_LIBNAME dee-qt5)
20 set(OUR_QT_INCLUDES ${Qt5Core_INCLUDE_DIRS} ${Qt5Quick_INCLUDE_DIRS} ${Qt5Test_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS})18 set(OUR_QT_INCLUDES ${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS})
21 set(OUR_QT_CORE_LIB ${Qt5Core_LIBRARIES})19 set(OUR_QT_CORE_LIB ${Qt5Core_LIBRARIES})
22 set(OUR_QT_TEST_LIB ${Qt5Test_LIBRARIES})
23 set(OUR_QT_QUICK_LIB ${Qt5Quick_LIBRARIES})
24 set(OUR_QT_DBUS_LIB ${Qt5DBus_LIBRARIES})20 set(OUR_QT_DBUS_LIB ${Qt5DBus_LIBRARIES})
25 # FIXME: find a way to deterime that
26 set(IMPORT_INSTALL_DIR /opt/qt5/imports/dee)
27 set(QT_PKGCONFIG_DEPENDENCIES "QtCore QtQuick")21 set(QT_PKGCONFIG_DEPENDENCIES "QtCore QtQuick")
28 set(QT_DEE_PKGCONFIG_FILE libqtdee-qt5.pc)
29else ()22else ()
30 message("Building Qt4 version")23 message("Building Qt4 version")
3124
@@ -33,94 +26,67 @@
3326
34 add_definitions(-DWITHQT5=0)27 add_definitions(-DWITHQT5=0)
3528
36 set(QTDEE_LIBNAME QtDee)29 set(DEE_QT_LIBNAME dee-qt)
37 set(OUR_QT_INCLUDES ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTDECLARATIVE_INCLUDE_DIR} ${QT_QTTEST_INCLUDE_DIR} ${QT_QTDBUS_INCLUDE_DIR})30 set(OUR_QT_INCLUDES ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTDBUS_INCLUDE_DIR})
38 set(OUR_QT_CORE_LIB ${QT_QTCORE_LIBRARIES})31 set(OUR_QT_CORE_LIB ${QT_QTCORE_LIBRARIES})
39 set(OUR_QT_TEST_LIB ${QT_QTTEST_LIBRARIES})
40 set(OUR_QT_QUICK_LIB ${QT_QTDECLARATIVE_LIBRARIES})
41 set(OUR_QT_DBUS_LIB ${QT_QTDBUS_LIBRARIES})32 set(OUR_QT_DBUS_LIB ${QT_QTDBUS_LIBRARIES})
42 set(IMPORT_INSTALL_DIR lib/qt4/imports/dee)33 set(QT_PKGCONFIG_DEPENDENCIES "QtCore QtDBus")
43 set(QT_PKGCONFIG_DEPENDENCIES "QtCore QtDBus QtDeclarative")
44 set(QT_DEE_PKGCONFIG_FILE libqtdee.pc)
45endif ()34endif ()
35
36set(QT_DEE_PKGCONFIG_FILE lib${DEE_QT_LIBNAME}.pc)
37
46pkg_check_modules(DEE REQUIRED dee-1.0)38pkg_check_modules(DEE REQUIRED dee-1.0)
4739
48# Build flags40# Build flags
49set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wundef -std=c++0x")41set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wundef -std=c++0x")
5042
51# Sources43# Sources
52## QtDee44set(DEE_QT_SRCS
53set(QtDee_SRCS
54 deelistmodel.cpp45 deelistmodel.cpp
55 )46 deevarianttext.cpp
5647 )
57set(QtDee_MOC_HDRS
58 deelistmodel.h
59 )
60
6148
62## QtDeeQml49## QtDeeQml
63set(QtDeeQml_SRCS50set(QtDeeQml_SRCS
64 plugin.cpp51 plugin.cpp
65 )52 )
6653
67set(QtDeeQml_MOC_HDRS
68 plugin.h
69 )
70
71# Build54# Build
72add_definitions(-DQT_NO_KEYWORDS)55add_definitions(-DQT_NO_KEYWORDS)
7356
74include_directories(57include_directories(
58 ${CMAKE_CURRENT_SOURCE_DIR}
75 ${CMAKE_CURRENT_BINARY_DIR}59 ${CMAKE_CURRENT_BINARY_DIR}
76 ${OUR_QT_INCLUDES}60 ${OUR_QT_INCLUDES}
77 ${DEE_INCLUDE_DIRS}61 ${DEE_INCLUDE_DIRS}
78 )62 )
7963
80## QtDee64add_library(${DEE_QT_LIBNAME} SHARED ${DEE_QT_SRCS})
81add_library(${QTDEE_LIBNAME} SHARED ${QtDee_SRCS} ${QtDee_MOC_SRCS})65target_link_libraries(${DEE_QT_LIBNAME}
82target_link_libraries(${QTDEE_LIBNAME}
83 ${OUR_QT_CORE_LIB}66 ${OUR_QT_CORE_LIB}
84 ${DEE_LDFLAGS}67 ${DEE_LDFLAGS}
85 )68 )
8669
87set_target_properties(${QTDEE_LIBNAME} PROPERTIES70set_target_properties(${DEE_QT_LIBNAME} PROPERTIES
88 SOVERSION 271 SOVERSION 3
89 VERSION 2.0.072 VERSION 3.0.0
90 )73 )
9174
92## QtDeeQml75# Unit-Test
93add_library(QtDeeQml SHARED ${QtDeeQml_SRCS} ${QtDeeQml_MOC_SRCS})76enable_testing()
9477
95target_link_libraries(QtDeeQml78add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} CTEST_OUTPUT_ON_FAILURE=1)
96 ${QTDEE_LIBNAME}79add_subdirectory(modules)
97 ${OUR_QT_QUICK_LIB}80add_subdirectory(tests)
98 )
99
100## test
101set(test_SRCS
102 test.cpp
103 )
104
105set(test_MOC_HDRS
106 test.h
107 )
108
109add_executable(test ${test_SRCS} ${test_MOC_SRCS})
110set_target_properties(test PROPERTIES COMPILE_FLAGS -fPIC)
111target_link_libraries(test
112 ${QTDEE_LIBNAME}
113 )
11481
115# Install82# Install
116set(INCLUDE_INSTALL_DIR include/QtDee)83set(INCLUDE_INSTALL_DIR include/lib${DEE_QT_LIBNAME})
11784
118## QtDee85install(TARGETS ${DEE_QT_LIBNAME}
119install(TARGETS ${QTDEE_LIBNAME}
120 LIBRARY DESTINATION lib${LIB_SUFFIX}86 LIBRARY DESTINATION lib${LIB_SUFFIX}
121 )87 )
12288
123install(FILES deelistmodel.h89install(FILES deelistmodel.h deevarianttext.h
124 DESTINATION ${INCLUDE_INSTALL_DIR}90 DESTINATION ${INCLUDE_INSTALL_DIR}
125 )91 )
12692
@@ -128,36 +94,10 @@
128set (PREFIX "${CMAKE_INSTALL_PREFIX}")94set (PREFIX "${CMAKE_INSTALL_PREFIX}")
129set (EXEC_PREFIX "${CMAKE_INSTALL_PREFIX}")95set (EXEC_PREFIX "${CMAKE_INSTALL_PREFIX}")
13096
131configure_file (libqtdee.pc.in97configure_file (libdee-qt.pc.in
132 ${CMAKE_CURRENT_BINARY_DIR}/${QT_DEE_PKGCONFIG_FILE} @ONLY)98 ${CMAKE_CURRENT_BINARY_DIR}/${QT_DEE_PKGCONFIG_FILE} @ONLY)
13399
134install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${QT_DEE_PKGCONFIG_FILE}100install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${QT_DEE_PKGCONFIG_FILE}
135 DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig101 DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig
136 )102 )
137103
138## QtDeeQml
139install(TARGETS QtDeeQml
140 LIBRARY DESTINATION ${IMPORT_INSTALL_DIR}
141 )
142
143install(FILES qmldir
144 DESTINATION ${IMPORT_INSTALL_DIR}
145 )
146
147## Unit-Test
148enable_testing()
149add_executable(conversiontest conversiontest.cpp)
150target_link_libraries(conversiontest ${OUR_QT_TEST_LIB} ${QTDEE_LIBNAME})
151set_target_properties(conversiontest PROPERTIES COMPILE_FLAGS -fPIC)
152add_test(NAME conversiontest COMMAND "dbus-test-runner" "--task" "${CMAKE_CURRENT_BINARY_DIR}/conversiontest" "-p" "-xunitxml" "-p" "-o" "-p" "conversiontest-xunit.xml")
153set_property(TEST conversiontest PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=.")
154
155add_executable(test-helper test-helper.cpp)
156target_link_libraries(test-helper ${OUR_QT_CORE_LIB} ${OUR_QT_DBUS_LIB} ${DEE_LDFLAGS})
157set_target_properties(test-helper PROPERTIES COMPILE_FLAGS -fPIC)
158
159add_executable(deelistmodeltest deelistmodeltest.cpp)
160target_link_libraries(deelistmodeltest ${OUR_QT_TEST_LIB} ${OUR_QT_DBUS_LIB} ${QTDEE_LIBNAME})
161set_target_properties(deelistmodeltest PROPERTIES COMPILE_FLAGS -fPIC)
162add_test(NAME deelistmodeltest COMMAND "dbus-test-runner" "--task" "${CMAKE_CURRENT_BINARY_DIR}/test-helper" "--task" "${CMAKE_CURRENT_BINARY_DIR}/deelistmodeltest" "-p" "-xunitxml" "-p" "-o" "-p" "deelistmodeltest-xunit.xml")
163set_property(TEST deelistmodeltest PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=.")
164104
=== modified file 'debian/changelog'
--- debian/changelog 2012-12-04 18:48:20 +0000
+++ debian/changelog 2012-12-04 18:48:20 +0000
@@ -1,3 +1,16 @@
1dee-qt (3.0-0ubuntu1) quantal; urgency=low
2
3 * new release
4 * rename the source package to dee-qt
5 * rename libqtdee to libdee-qt
6 * rename libqtdee-qt5 to libdee-qt5
7 * separate plugin out into "modules" directory
8 * separate tests out
9 * drop obsolete test.cpp
10 * rename dee 0.1 QML plugin to Dee 3.0
11
12 -- Michał Sawicz <michal.sawicz@canonical.com> Fri, 30 Nov 2012 12:32:41 +0100
13
1libqtdee (0.2.4-0ubuntu4) quantal; urgency=low14libqtdee (0.2.4-0ubuntu4) quantal; urgency=low
215
3 * debian/rules16 * debian/rules
417
=== modified file 'debian/control'
--- debian/control 2012-12-04 18:48:20 +0000
+++ debian/control 2012-12-04 18:48:20 +0000
@@ -1,4 +1,4 @@
1Source: libqtdee1Source: dee-qt
2Section: libs2Section: libs
3Priority: optional3Priority: optional
4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
@@ -15,7 +15,7 @@
15# just go ahead. ~unity-team will notice and sync up the code again.15# just go ahead. ~unity-team will notice and sync up the code again.
16Vcs-Bzr: http://bazaar.launchpad.net/~unity-2d-team/dee-qt/trunk16Vcs-Bzr: http://bazaar.launchpad.net/~unity-2d-team/dee-qt/trunk
1717
18Package: libqtdee218Package: libdee-qt-3
19Architecture: any19Architecture: any
20Depends: ${shlibs:Depends},20Depends: ${shlibs:Depends},
21 ${misc:Depends},21 ${misc:Depends},
@@ -24,31 +24,33 @@
24Description: Qt binding and QML plugin for Dee - shared library24Description: Qt binding and QML plugin for Dee - shared library
25 Simple Qt binding and QML plugin for Dee (https://launchpad.net/dee).25 Simple Qt binding and QML plugin for Dee (https://launchpad.net/dee).
2626
27Package: libqtdee-dev27Package: libdee-qt-dev
28Section: libdevel28Section: libdevel
29Architecture: any29Architecture: any
30Depends: ${misc:Depends},30Depends: ${misc:Depends},
31 libqtdee2 (= ${binary:Version}),31 libdee-qt-3 (= ${binary:Version}),
32 libqt4-dev (>= 4.7),32 libqt4-dev (>= 4.7),
33 libdee-dev (>= 1.0.0),
33Description: Qt binding and QML plugin for Dee - development files34Description: Qt binding and QML plugin for Dee - development files
34 Simple Qt binding and QML plugin for Dee (https://launchpad.net/dee).35 Simple Qt binding and QML plugin for Dee (https://launchpad.net/dee).
35 .36 .
36 This package contains the developer headers for the Qt binding for Dee37 This package contains the developer headers for the Qt binding for Dee
3738
38Package: libqtdee-qt539Package: libdee-qt5-3
39Architecture: any40Architecture: any
40Depends: ${shlibs:Depends},41Depends: ${shlibs:Depends},
41 ${misc:Depends},42 ${misc:Depends},
42Description: Qt5 binding and QtQuick2 plugin for Dee - shared library43Description: Qt5 binding and QtQuick2 plugin for Dee - shared library
43 Simple Qt5 binding and QtQuick2 plugin for Dee (https://launchpad.net/dee).44 Simple Qt5 binding and QtQuick2 plugin for Dee (https://launchpad.net/dee).
4445
45Package: libqtdee-qt5-dev46Package: libdee-qt5-dev
46Section: libdevel47Section: libdevel
47Architecture: any48Architecture: any
48Depends: ${misc:Depends},49Depends: ${misc:Depends},
49 libqtdee-qt5 (= ${binary:Version}),50 libdee-qt5-3 (= ${binary:Version}),
50 qtbase,51 qtbase,
51 qtdeclarative,52 qtdeclarative,
53 libdee-dev (>= 1.0.0),
52Description: Qt5 binding and QtQuick2 plugin for Dee - development files54Description: Qt5 binding and QtQuick2 plugin for Dee - development files
53 Simple Qt5 binding and QtQuick2 plugin for Dee (https://launchpad.net/dee).55 Simple Qt5 binding and QtQuick2 plugin for Dee (https://launchpad.net/dee).
54 .56 .
5557
=== renamed file 'debian/libqtdee2.install' => 'debian/libdee-qt-3.install'
--- debian/libqtdee2.install 2011-01-28 05:27:37 +0000
+++ debian/libdee-qt-3.install 2012-12-04 18:48:20 +0000
@@ -1,3 +1,3 @@
1usr/lib/libQtDee.so.*1usr/lib/libdee-qt.so.*
2usr/lib/qt4/imports/dee/libQtDeeQml.so2usr/lib/*/qt4/imports/Dee/libDeePlugin.so
3usr/lib/qt4/imports/dee/qmldir3usr/lib/*/qt4/imports/Dee/qmldir
44
=== renamed file 'debian/libqtdee-dev.install' => 'debian/libdee-qt-dev.install'
--- debian/libqtdee-dev.install 2012-01-05 20:27:31 +0000
+++ debian/libdee-qt-dev.install 2012-12-04 18:48:20 +0000
@@ -1,3 +1,3 @@
1usr/lib/libQtDee.so1usr/lib/libdee-qt.so
2usr/include/QtDee/*.h2usr/include/libdee-qt/*.h
3usr/lib/pkgconfig/libqtdee.pc3usr/lib/pkgconfig/libdee-qt.pc
44
=== renamed file 'debian/libqtdee-qt5.install' => 'debian/libdee-qt5-3.install'
--- debian/libqtdee-qt5.install 2012-12-04 18:48:20 +0000
+++ debian/libdee-qt5-3.install 2012-12-04 18:48:20 +0000
@@ -1,3 +1,3 @@
1usr/lib/libQtDee-qt5.so.*1usr/lib/libdee-qt5.so.*
2opt/qt5/imports/dee/libQtDeeQml.so2opt/qt5/imports/Dee/libDeePlugin.so
3opt/qt5/imports/dee/qmldir3opt/qt5/imports/Dee/qmldir
44
=== renamed file 'debian/libqtdee-qt5-dev.install' => 'debian/libdee-qt5-dev.install'
--- debian/libqtdee-qt5-dev.install 2012-12-04 18:48:20 +0000
+++ debian/libdee-qt5-dev.install 2012-12-04 18:48:20 +0000
@@ -1,3 +1,3 @@
1usr/lib/libQtDee-qt5.so1usr/lib/libdee-qt5.so
2usr/include/QtDee/*.h2usr/include/libdee-qt5/*.h
3usr/lib/pkgconfig/libqtdee-qt5.pc3usr/lib/pkgconfig/libdee-qt5.pc
44
=== modified file 'deelistmodel.cpp'
--- deelistmodel.cpp 2012-11-21 10:30:50 +0000
+++ deelistmodel.cpp 2012-12-04 18:48:20 +0000
@@ -21,13 +21,14 @@
21#include <QtCore/QByteArray>21#include <QtCore/QByteArray>
2222
23#include <dee.h>23#include <dee.h>
24#include <glib-object.h>
2524
26#include "deelistmodel.h"25#include "deelistmodel.h"
26#include "deeprivate.h"
2727
28static QVariant28QVariant
29QVariantFromGVariant(GVariant *value)29QVariantFromGVariant(GVariant *value)
30{30{
31 Q_ASSERT(value);
31 switch (g_variant_classify(value)) {32 switch (g_variant_classify(value)) {
32 case G_VARIANT_CLASS_BOOLEAN:33 case G_VARIANT_CLASS_BOOLEAN:
33 return QVariant((bool) g_variant_get_boolean(value));34 return QVariant((bool) g_variant_get_boolean(value));
@@ -62,13 +63,14 @@
62 }63 }
63 return array;64 return array;
64 }65 }
66 case G_VARIANT_CLASS_VARIANT:
67 return QVariant(QVariantFromGVariant(g_variant_get_variant(value)));
65 default:68 default:
66 /* Fallback on an empty QVariant.69 /* Fallback on an empty QVariant.
67 FIXME: Missing conversion of following GVariant types:70 FIXME: Missing conversion of following GVariant types:
68 - G_VARIANT_CLASS_HANDLE71 - G_VARIANT_CLASS_HANDLE
69 - G_VARIANT_CLASS_OBJECT_PATH72 - G_VARIANT_CLASS_OBJECT_PATH
70 - G_VARIANT_CLASS_SIGNATURE73 - G_VARIANT_CLASS_SIGNATURE
71 - G_VARIANT_CLASS_VARIANT
72 - G_VARIANT_CLASS_MAYBE74 - G_VARIANT_CLASS_MAYBE
73 - G_VARIANT_CLASS_DICT_ENTRY75 - G_VARIANT_CLASS_DICT_ENTRY
74 */76 */
@@ -84,7 +86,6 @@
84 void connectToDeeModel();86 void connectToDeeModel();
85 void connectToDeeModel(DeeModel *model);87 void connectToDeeModel(DeeModel *model);
86 void disconnectFromDeeModel();88 void disconnectFromDeeModel();
87 void createRoles();
88 bool synchronized() const;89 bool synchronized() const;
8990
90 /* GObject signal handlers for m_deeModel */91 /* GObject signal handlers for m_deeModel */
@@ -142,6 +143,7 @@
142void143void
143DeeListModelPrivate::connectToDeeModel(DeeModel *model)144DeeListModelPrivate::connectToDeeModel(DeeModel *model)
144{145{
146 m_parent->beginResetModel();
145 disconnectFromDeeModel();147 disconnectFromDeeModel();
146148
147 m_deeModel = (DeeModel*)g_object_ref (model);149 m_deeModel = (DeeModel*)g_object_ref (model);
@@ -150,15 +152,14 @@
150 g_signal_connect(m_deeModel, "row-changed", G_CALLBACK(onRowChanged), m_parent);152 g_signal_connect(m_deeModel, "row-changed", G_CALLBACK(onRowChanged), m_parent);
151 if (synchronized())153 if (synchronized())
152 {154 {
153 createRoles();
154 m_count = dee_model_get_n_rows(m_deeModel);155 m_count = dee_model_get_n_rows(m_deeModel);
155 m_parent->reset();
156 Q_EMIT m_parent->countChanged();156 Q_EMIT m_parent->countChanged();
157 }157 }
158 else158 else
159 {159 {
160 g_signal_connect(m_deeModel, "notify::synchronized", G_CALLBACK(onSynchronizedChanged), m_parent);160 g_signal_connect(m_deeModel, "notify::synchronized", G_CALLBACK(onSynchronizedChanged), m_parent);
161 }161 }
162 m_parent->endResetModel();
162}163}
163164
164bool165bool
@@ -175,25 +176,24 @@
175 }176 }
176}177}
177178
178void179QHash<int, QByteArray>
179DeeListModelPrivate::createRoles()180DeeListModel::roleNames()
180{181{
181 if (m_deeModel == NULL) {
182 return;
183 }
184
185 QHash<int, QByteArray> roles;182 QHash<int, QByteArray> roles;
183
184 if (d->m_deeModel == NULL) {
185 return roles;
186 }
187
186 QString column;188 QString column;
187 guint n_columns = dee_model_get_n_columns(m_deeModel);189 guint n_columns = dee_model_get_n_columns(d->m_deeModel);
188190
189 for (unsigned int index=0; index<n_columns; index++)191 for (unsigned int index=0; index<n_columns; index++)
190 {192 {
191 column = QString("column_%1").arg(index);193 column = QString("column_%1").arg(index);
192 roles[index] = column.toAscii();194 roles[index] = column.toUtf8();
193 }195 }
194196 return roles;
195 m_parent->setRoleNames(roles);
196 Q_EMIT m_parent->roleNamesChanged(roles);
197}197}
198198
199void199void
@@ -201,11 +201,11 @@
201 GParamSpec *pspec,201 GParamSpec *pspec,
202 DeeListModel *model)202 DeeListModel *model)
203{203{
204 model->d->createRoles();204 model->beginResetModel();
205 model->d->m_count = dee_model_get_n_rows(model->d->m_deeModel);205 model->d->m_count = dee_model_get_n_rows(model->d->m_deeModel);
206 model->synchronizedChanged(model->synchronized());206 model->synchronizedChanged(model->synchronized());
207 model->reset();
208 Q_EMIT model->countChanged();207 Q_EMIT model->countChanged();
208 model->endResetModel();
209}209}
210210
211void211void
@@ -271,8 +271,6 @@
271 Q_EMIT model->dataChanged(index, index);271 Q_EMIT model->dataChanged(index, index);
272}272}
273273
274
275
276DeeListModel::DeeListModel(QObject *parent) :274DeeListModel::DeeListModel(QObject *parent) :
277 QAbstractListModel(parent), d(new DeeListModelPrivate(this))275 QAbstractListModel(parent), d(new DeeListModelPrivate(this))
278{276{
279277
=== modified file 'deelistmodel.h'
--- deelistmodel.h 2012-01-31 17:49:00 +0000
+++ deelistmodel.h 2012-12-04 18:48:20 +0000
@@ -20,11 +20,12 @@
20#ifndef DEELISTMODEL_H20#ifndef DEELISTMODEL_H
21#define DEELISTMODEL_H21#define DEELISTMODEL_H
2222
23#include <QtCore/QObject>
23#include <QtCore/QAbstractListModel>24#include <QtCore/QAbstractListModel>
2425
25class DeeListModelPrivate;26class DeeListModelPrivate;
26typedef struct _DeeModel DeeModel;27typedef struct _DeeModel DeeModel;
27class __attribute__ ((visibility ("default"))) DeeListModel : public QAbstractListModel28class Q_DECL_EXPORT DeeListModel : public QAbstractListModel
28{29{
29 friend class DeeListModelPrivate;30 friend class DeeListModelPrivate;
3031
@@ -52,11 +53,11 @@
52 /* setters */53 /* setters */
53 void setName(const QString& name);54 void setName(const QString& name);
54 void setModel(DeeModel* model);55 void setModel(DeeModel* model);
56 QHash<int, QByteArray> roleNames();
5557
56Q_SIGNALS:58Q_SIGNALS:
57 void nameChanged(const QString&);59 void nameChanged(const QString&);
58 void synchronizedChanged(bool);60 void synchronizedChanged(bool);
59 void roleNamesChanged(const QHash<int,QByteArray> &);
60 void countChanged();61 void countChanged();
6162
62private:63private:
6364
=== added file 'deeprivate.h'
--- deeprivate.h 1970-01-01 00:00:00 +0000
+++ deeprivate.h 2012-12-04 18:48:20 +0000
@@ -0,0 +1,23 @@
1/*
2 * Copyright (C) 2012 Canonical, Ltd.
3 *
4 * Authors:
5 * Christian Dywan <christian.dywan@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <glib-object.h>
21
22QVariant QVariantFromGVariant(GVariant *value);
23
024
=== added file 'deevarianttext.cpp'
--- deevarianttext.cpp 1970-01-01 00:00:00 +0000
+++ deevarianttext.cpp 2012-12-04 18:48:20 +0000
@@ -0,0 +1,72 @@
1/*
2 * Copyright (C) 2012 Canonical, Ltd.
3 *
4 * Authors:
5 * Christian Dywan <christian.dywan@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <QDebug>
21
22#include "deevarianttext.h"
23#include "deeprivate.h"
24
25DeeVariantText::DeeVariantText(QObject *parent) :
26 m_text(""),
27 m_value(QVariant()),
28 m_type("")
29{
30}
31
32void
33DeeVariantText::setText(const QString& text)
34{
35 if (m_text == text)
36 return;
37
38 m_text = text;
39 GVariant *gvariant = g_variant_parse(NULL, text.toUtf8(), NULL, NULL, NULL);
40 if (!gvariant)
41 {
42 qDebug() << "Failed to parse " << text << " to QVariant";
43 m_value = QVariant();
44 m_type = "";
45 }
46 else
47 {
48 m_value = QVariantFromGVariant(gvariant);
49 m_type = g_variant_get_type_string(gvariant);
50 }
51 Q_EMIT textChanged(text);
52 Q_EMIT valueChanged(m_value);
53}
54
55QString
56DeeVariantText::getText()
57{
58 return m_text;
59}
60
61QVariant
62DeeVariantText::getValue()
63{
64 return m_value;
65}
66
67QVariant
68DeeVariantText::getType()
69{
70 return m_type;
71}
72
073
=== added file 'deevarianttext.h'
--- deevarianttext.h 1970-01-01 00:00:00 +0000
+++ deevarianttext.h 2012-12-04 18:48:20 +0000
@@ -0,0 +1,49 @@
1/*
2 * Copyright (C) 2012 Canonical, Ltd.
3 *
4 * Authors:
5 * Christian Dywan <christian.dywan@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef DEEVARIANTTEXT_H
21#define DEEVARIANTTEXT_H
22
23#include <QtCore/QObject>
24#include <QtCore/QVariant>
25
26class Q_DECL_EXPORT DeeVariantText : public QObject {
27 Q_OBJECT
28 Q_PROPERTY(QString text READ getText WRITE setText NOTIFY textChanged)
29 Q_PROPERTY(QVariant value READ getValue NOTIFY valueChanged)
30public:
31 DeeVariantText(QObject* parent = 0);
32 ~DeeVariantText() { }
33
34 QString getText();
35 QVariant getValue();
36 QVariant getType();
37 void setText(const QString& text);
38Q_SIGNALS:
39 void textChanged(const QString& text);
40 void valueChanged(const QVariant& value);
41private:
42 Q_DISABLE_COPY(DeeVariantText)
43 QString m_text;
44 QVariant m_value;
45 QString m_type;
46};
47
48#endif // DEEVARIANTTEXT_H
49
050
=== renamed file 'libqtdee.pc.in' => 'libdee-qt.pc.in'
--- libqtdee.pc.in 2012-12-04 18:48:20 +0000
+++ libdee-qt.pc.in 2012-12-04 18:48:20 +0000
@@ -1,12 +1,12 @@
1prefix=@PREFIX@1prefix=@PREFIX@
2exec_prefix=@EXEC_PREFIX@2exec_prefix=@EXEC_PREFIX@
3libdir=${exec_prefix}/lib3libdir=${exec_prefix}/lib
4includedir=${prefix}/include4includedir=${prefix}/@INCLUDE_INSTALL_DIR@
55
6Name: libqtdee6Name: @DEE_QT_LIBNAME@
7Description: Qt binding and QML plugin for Dee.7Description: Qt binding and QML plugin for Dee.
8Version: 0.28Version: 3.0
99
10Requires: @QT_PKGCONFIG_DEPENDENCIES@ dee-1.010Requires: @QT_PKGCONFIG_DEPENDENCIES@ dee-1.0
11Libs: -L${libdir} -l@QTDEE_LIBNAME@11Libs: -L${libdir} -l@DEE_QT_LIBNAME@
12Cflags: -I${includedir}/QtDee12Cflags: -I${includedir}
1313
=== added directory 'modules'
=== added file 'modules/CMakeLists.txt'
--- modules/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ modules/CMakeLists.txt 2012-12-04 18:48:20 +0000
@@ -0,0 +1,1 @@
1add_subdirectory(Dee)
02
=== added directory 'modules/Dee'
=== added file 'modules/Dee/CMakeLists.txt'
--- modules/Dee/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ modules/Dee/CMakeLists.txt 2012-12-04 18:48:20 +0000
@@ -0,0 +1,46 @@
1
2if (WITHQT5)
3 find_package(Qt5Quick REQUIRED)
4 set(OUR_QT_QUICK_LIB ${Qt5Quick_LIBRARIES})
5
6 get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION)
7 exec_program(${QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_IMPORTS" OUTPUT_VARIABLE QT_IMPORTS_DIR)
8 file(TO_CMAKE_PATH "${QT_IMPORTS_DIR}" QT_IMPORTS_DIR)
9
10 set(OUR_QT_QUICK_INCLUDE ${Qt5Quick_INCLUDE_DIRS})
11 LIST(APPEND QT_PKGCONFIG_DEPENDENCIES "QtQuick")
12else ()
13 set(OUR_QT_QUICK_LIB ${QT_QTDECLARATIVE_LIBRARIES})
14 set(IMPORT_INSTALL_DIR lib/qt4/imports/Dee)
15 set(OUR_QT_QUICK_INCLUDE ${QT_QTDECLARATIVE_INCLUDE_DIR})
16 LIST(APPEND QT_PKGCONFIG_DEPENDENCIES "QtDeclarative")
17endif ()
18
19set(DeePlugin_SRCS
20 plugin.cpp
21 )
22
23add_library(DeePlugin SHARED ${DeePlugin_SRCS})
24
25target_link_libraries(DeePlugin
26 ${DEE_QT_LIBNAME}
27 ${OUR_QT_QUICK_LIB}
28 )
29
30include_directories(
31 ${CMAKE_CURRENT_BINARY_DIR}
32 ${OUR_QT_QUICK_INCLUDE}
33 )
34
35# copy qmldir file into build directory for shadow builds
36file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
37 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
38 )
39
40install(TARGETS DeePlugin
41 LIBRARY DESTINATION ${QT_IMPORTS_DIR}/Dee
42 )
43
44install(FILES qmldir
45 DESTINATION ${QT_IMPORTS_DIR}/Dee
46 )
047
=== renamed file 'plugin.cpp' => 'modules/Dee/plugin.cpp'
--- plugin.cpp 2012-12-04 18:48:20 +0000
+++ modules/Dee/plugin.cpp 2012-12-04 18:48:20 +0000
@@ -18,6 +18,7 @@
18 */18 */
1919
20#include "deelistmodel.h"20#include "deelistmodel.h"
21#include "deevarianttext.h"
21#include "plugin.h"22#include "plugin.h"
22#if WITHQT523#if WITHQT5
23 #include <qqml.h>24 #include <qqml.h>
@@ -25,11 +26,12 @@
25 #include <QtDeclarative/qdeclarative.h>26 #include <QtDeclarative/qdeclarative.h>
26#endif27#endif
2728
28void QtDeePlugin::registerTypes(const char *uri)29void DeePlugin::registerTypes(const char *uri)
29{30{
30 qmlRegisterType<DeeListModel>(uri, 0, 1, "DeeListModel");31 qmlRegisterType<DeeListModel>(uri, 3, 0, "DeeListModel");
32 qmlRegisterType<DeeVariantText>(uri, 3, 0, "DeeVariantText");
31}33}
3234
33#if !WITHQT535#if !WITHQT5
34 Q_EXPORT_PLUGIN2(QtDee, QtDeePlugin);36 Q_EXPORT_PLUGIN2(Dee, DeePlugin);
35#endif37#endif
3638
=== renamed file 'plugin.h' => 'modules/Dee/plugin.h'
--- plugin.h 2012-12-04 18:48:20 +0000
+++ modules/Dee/plugin.h 2012-12-04 18:48:20 +0000
@@ -26,7 +26,7 @@
26 #include <QtDeclarative/QDeclarativeExtensionPlugin>26 #include <QtDeclarative/QDeclarativeExtensionPlugin>
27#endif27#endif
2828
29class QtDeePlugin :29class DeePlugin :
30#if WITHQT530#if WITHQT5
31 public QQmlExtensionPlugin31 public QQmlExtensionPlugin
32#else32#else
3333
=== renamed file 'qmldir' => 'modules/Dee/qmldir'
--- qmldir 2011-01-13 16:05:58 +0000
+++ modules/Dee/qmldir 2012-12-04 18:48:20 +0000
@@ -1,1 +1,1 @@
1plugin QtDeeQml1plugin DeePlugin
22
=== removed file 'test.cpp'
--- test.cpp 2011-01-24 04:05:02 +0000
+++ test.cpp 1970-01-01 00:00:00 +0000
@@ -1,35 +0,0 @@
1/*
2 * Copyright (C) 2010 Canonical, Ltd.
3 *
4 * Authors:
5 * Florian Boucault <florian.boucault@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "test.h"
21#include "deelistmodel.h"
22
23int main(int argc, char *argv[])
24{
25 TestApplication application(argc, argv);
26
27 DeeListModel* model = new DeeListModel;
28
29 QObject::connect(model, SIGNAL(synchronizedChanged(bool)), &application, SLOT(onSynchronizedChanged(bool)));
30 QObject::connect(model, SIGNAL(rowsInserted(QModelIndex, int, int)), &application, SLOT(onRowsInserted()));
31
32 model->setName("com.canonical.Unity.ApplicationsPlace.ResultsModel");
33
34 return application.exec();
35}
360
=== removed file 'test.h'
--- test.h 2012-01-04 23:52:05 +0000
+++ test.h 1970-01-01 00:00:00 +0000
@@ -1,52 +0,0 @@
1/*
2 * Copyright (C) 2011 Canonical, Ltd.
3 *
4 * Authors:
5 * Florian Boucault <florian.boucault@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef TEST_H
21#define TEST_H
22
23#include <QtCore/QCoreApplication>
24#include <QtCore/QDebug>
25
26#include "deelistmodel.h"
27
28class TestApplication : public QCoreApplication
29{
30 Q_OBJECT
31
32public:
33 TestApplication(int& argc, char** argv) : QCoreApplication(argc, argv) {}
34
35public Q_SLOTS:
36 void onSynchronizedChanged(bool synchronized) {
37 DeeListModel* model = (DeeListModel*)sender();
38 qDebug() << "Number of columns:" << model->roleNames().size();
39 qDebug() << "Number of rows:" << model->rowCount();
40
41 for(int i = 0; i < model->rowCount(); ++i) {
42 qDebug() << model->data(model->index(i));
43 }
44 }
45
46 void onRowsInserted() {
47 DeeListModel* model = (DeeListModel*)sender();
48 qDebug() << "Rows added, current number:" << model->rowCount();
49 }
50};
51
52#endif // TEST_H
530
=== removed file 'test_qtquick2.qml'
--- test_qtquick2.qml 2012-12-04 18:48:20 +0000
+++ test_qtquick2.qml 1970-01-01 00:00:00 +0000
@@ -1,15 +0,0 @@
1import QtQuick 2.0
2import dee 0.1
3
4ListView {
5 width: 200
6 height: 200
7 delegate: Text {
8 x: 66
9 y: 93
10 text: column_4
11 }
12 model: DeeListModel {
13 name: "com.canonical.Unity.Lens.applications.T1313498309.Results"
14 }
15}
160
=== added directory 'tests'
=== added file 'tests/CMakeLists.txt'
--- tests/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tests/CMakeLists.txt 2012-12-04 18:48:20 +0000
@@ -0,0 +1,57 @@
1if (WITHQT5)
2 find_package(Qt5Test REQUIRED)
3 set(OUR_QT_TEST_LIB ${Qt5Test_LIBRARIES})
4 set(OUR_QT_TEST_INCLUDES ${Qt5Test_INCLUDE_DIRS})
5else ()
6 set(OUR_QT_TEST_LIB ${QT_QTTEST_LIBRARIES})
7 set(OUR_QT_TEST_INCLUDES ${QT_QTTEST_INCLUDE_DIR})
8 set(OUR_QT_QUICK_LIB ${QT_QTDECLARATIVE_LIBRARIES})
9 set(OUR_QT_QUICK_INCLUDE ${QT_QTDECLARATIVE_INCLUDE_DIR})
10endif ()
11
12if (WITHQT5)
13 add_test(NAME plugintest COMMAND "qmltestrunner" "-import" "../modules" "-xunitxml" "-o" "plugintest-xunit.xml" "-input" "${CMAKE_CURRENT_SOURCE_DIR}")
14else ()
15 add_executable(plugintest qtquick1plugintest.cpp)
16 target_link_libraries(plugintest ${OUR_QT_TEST_LIB} ${OUR_QT_QUICK_LIB})
17 set_target_properties(plugintest PROPERTIES COMPILE_FLAGS -fPIC)
18 add_test(NAME plugintest WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMMAND "dbus-test-runner" "--task" "${CMAKE_CURRENT_BINARY_DIR}/plugintest" "-p" "-xunitxml" "-p" "-o" "-p" "${CMAKE_CURRENT_BINARY_DIR}/plugintest-xunit.xml")
19 set_property(TEST plugintest PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=.")
20 set_property(TEST plugintest PROPERTY ENVIRONMENT "QT_GRAPHICSSYSTEM=raster")
21 set_property(TEST plugintest PROPERTY ENVIRONMENT "QML_IMPORT_PATH=${CMAKE_CURRENT_BINARY_DIR}/../modules")
22 add_dependencies(check plugintest)
23endif ()
24
25include_directories(
26 ${CMAKE_CURRENT_BINARY_DIR}
27 ${OUR_QT_TEST_INCLUDES}
28 ${OUR_QT_QUICK_INCLUDE}
29 )
30
31add_executable(conversiontest conversiontest.cpp)
32target_link_libraries(conversiontest ${OUR_QT_WIDGETS_LIB} ${OUR_QT_TEST_LIB} ${OUR_QT_QUICK_LIB} ${DEE_QT_LIBNAME})
33set_target_properties(conversiontest PROPERTIES COMPILE_FLAGS -fPIC)
34add_test(NAME conversiontest COMMAND "dbus-test-runner" "--task" "${CMAKE_CURRENT_BINARY_DIR}/conversiontest" "-p" "-xunitxml" "-p" "-o" "-p" "conversiontest-xunit.xml")
35set_property(TEST conversiontest PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=.")
36set_property(TEST conversiontest PROPERTY ENVIRONMENT "QT_QPA_PLATFORM=minimal")
37add_dependencies(check conversiontest)
38
39add_executable(test-helper test-helper.cpp)
40target_link_libraries(test-helper ${OUR_QT_CORE_LIB} ${OUR_QT_DBUS_LIB} ${DEE_LDFLAGS})
41set_target_properties(test-helper PROPERTIES COMPILE_FLAGS -fPIC)
42add_dependencies(conversiontest ${DEE_QT_LIBNAME} test-helper)
43
44add_executable(deelistmodeltest deelistmodeltest.cpp)
45target_link_libraries(deelistmodeltest ${OUR_QT_TEST_LIB} ${OUR_QT_DBUS_LIB} ${DEE_QT_LIBNAME})
46set_target_properties(deelistmodeltest PROPERTIES COMPILE_FLAGS -fPIC)
47add_test(NAME deelistmodeltest COMMAND "dbus-test-runner" "--task" "${CMAKE_CURRENT_BINARY_DIR}/test-helper" "--task" "${CMAKE_CURRENT_BINARY_DIR}/deelistmodeltest" "-p" "-xunitxml" "-p" "-o" "-p" "deelistmodeltest-xunit.xml")
48set_property(TEST deelistmodeltest PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=.")
49add_dependencies(check deelistmodeltest)
50
51add_executable(deevarianttexttest deevarianttexttest.cpp)
52target_link_libraries(deevarianttexttest ${OUR_QT_TEST_LIB} ${OUR_QT_DBUS_LIB} ${DEE_QT_LIBNAME})
53set_target_properties(deevarianttexttest PROPERTIES COMPILE_FLAGS -fPIC)
54add_test(NAME deevarianttexttest COMMAND "dbus-test-runner" "--task" "${CMAKE_CURRENT_BINARY_DIR}/test-helper" "--task" "${CMAKE_CURRENT_BINARY_DIR}/deelistmodeltest" "-p" "-xunitxml" "-p" "-o" "-p" "deelistmodeltest-xunit.xml")
55set_property(TEST deevarianttexttest PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=.")
56add_dependencies(check deevarianttexttest)
57
058
=== renamed file 'conversiontest.cpp' => 'tests/conversiontest.cpp'
--- conversiontest.cpp 2012-11-21 12:09:44 +0000
+++ tests/conversiontest.cpp 2012-12-04 18:48:20 +0000
@@ -18,6 +18,7 @@
18#include <QObject>18#include <QObject>
1919
20#include "deelistmodel.h"20#include "deelistmodel.h"
21#include "deevarianttext.h"
2122
22#include <dee.h>23#include <dee.h>
2324
2425
=== renamed file 'deelistmodeltest.cpp' => 'tests/deelistmodeltest.cpp'
=== added file 'tests/deevarianttexttest.cpp'
--- tests/deevarianttexttest.cpp 1970-01-01 00:00:00 +0000
+++ tests/deevarianttexttest.cpp 2012-12-04 18:48:20 +0000
@@ -0,0 +1,58 @@
1/*
2 * Copyright (C) 2012 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <QtTest>
18#include <QObject>
19
20#include "deevarianttext.h"
21
22#include <dee.h>
23
24class DeeVariantTextTest : public QObject
25{
26 Q_OBJECT
27
28private Q_SLOTS:
29 void initTestCase()
30 {
31 g_type_init();
32 }
33
34 void GVariantParseTest()
35 {
36 QHash<QString, QVariant> hash;
37 hash["[[1, 2, 3], [4, 5, 6]]"] = "aai";
38 hash["[[1, 2, 3], [4, 5, 6.0]]"] = "aad";
39 hash["[\"hello\", nothing]"] = "ams";
40 hash["{1: \"one\", 2: \"two\", 3: \"three\"}"] = "a{is}";
41 hash["[just 3, nothing]"] = "ami";
42 // hash["{\"title\": <\"frobit\">, \"enabled\": <true>, width: <800>}"] = "";
43 hash["@ms \"\""] = "ms";
44 QHashIterator<QString, QVariant> i(hash);
45 while (i.hasNext()) {
46 i.next();
47 QString input(i.key());
48 DeeVariantText dvariant;
49 dvariant.setText(input);
50 QCOMPARE(dvariant.getText(), input);
51 QCOMPARE(dvariant.getType(), i.value());
52 }
53 }
54};
55
56QTEST_MAIN(DeeVariantTextTest)
57
58#include "deevarianttexttest.moc"
059
=== added file 'tests/qtquick1plugintest.cpp'
--- tests/qtquick1plugintest.cpp 1970-01-01 00:00:00 +0000
+++ tests/qtquick1plugintest.cpp 2012-12-04 18:48:20 +0000
@@ -0,0 +1,48 @@
1/*
2 * Copyright (C) 2012 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <QtTest>
18#include <QObject>
19#include <QtDeclarative>
20
21class PluginTest : public QObject
22{
23 Q_OBJECT
24
25private Q_SLOTS:
26 void initTestCase()
27 {
28 }
29
30 void GVariantQMLTest()
31 {
32 // Dummy argc/v to avoid GCC confusing int with Display* on some systems
33 int argc = 0;
34 char *argv[0];
35 QApplication app(argc, argv);
36 QDeclarativeView view;
37 view.setSource(QUrl::fromLocalFile("test_qtquick1.qml"));
38 Q_ASSERT(view.errors().empty());
39 QObject *text2 = view.rootObject()->findChild<QObject*>("text2");
40 Q_ASSERT(text2);
41 QVariant text2text(text2->metaObject()->property(text2->metaObject()->indexOfProperty("text")).read(text2));
42 QCOMPARE(text2text.toString(), QString("4,1.1,0.1,0,0.3,3.6"));
43 }
44};
45
46QTEST_MAIN(PluginTest)
47
48#include "qtquick1plugintest.moc"
049
=== renamed file 'test-helper.cpp' => 'tests/test-helper.cpp'
=== renamed file 'test_qtquick1.qml' => 'tests/test_qtquick1.qml'
--- test_qtquick1.qml 2012-02-08 15:02:19 +0000
+++ tests/test_qtquick1.qml 2012-12-04 18:48:20 +0000
@@ -1,15 +1,40 @@
1import QtQuick 1.01import QtQuick 1.0
2import dee 0.12import Dee 3.0
33
4ListView {4Item {
5 width: 2005
6 height: 2006 ListView {
7 delegate: Text {7 width: 200
8 x: 668 height: 200
9 y: 939 delegate: Text {
10 text: column_410 x: 66
11 }11 y: 93
12 model: DeeListModel {12 text: column_4
13 name: "com.canonical.Unity.Lens.applications.T1313498309.Results"13 }
14 }14 model: DeeListModel {
15 name: "com.canonical.Unity.Lens.applications.T1313498309.Results"
16 }
17 }
18
19 DeeVariantText {
20 id: arrayOfInt
21 text: "[[1, 2, 3], [4, 5, 6]]"
22 Component.onCompleted: {
23 arrayOfInt.text = "[[4, 1.1, .1], [0, 0.3, 3.6]]"
24 }
25 onTextChanged: {
26 text2.text = arrayOfInt.value.toString()
27 }
28 }
29
30 Text {
31 text: arrayOfInt.value.toString()
32 }
33
34 Text {
35 id: text2
36 objectName: "text2"
37 }
38
15}39}
40
1641
=== added file 'tests/tst_deelistmodel.qml'
--- tests/tst_deelistmodel.qml 1970-01-01 00:00:00 +0000
+++ tests/tst_deelistmodel.qml 2012-12-04 18:48:20 +0000
@@ -0,0 +1,22 @@
1import QtQuick 2.0
2import QtTest 1.0
3import Dee 3.0
4
5TestCase {
6 name: "DeeListModel"
7
8 ListView {
9 width: 200
10 height: 200
11 delegate: Text {
12 x: 66
13 y: 93
14 text: column_4
15 }
16 model: DeeListModel {
17 name: "com.canonical.Unity.Lens.applications.T1313498309.Results"
18 }
19 }
20
21}
22
023
=== added file 'tests/tst_deevarianttext.qml'
--- tests/tst_deevarianttext.qml 1970-01-01 00:00:00 +0000
+++ tests/tst_deevarianttext.qml 2012-12-04 18:48:20 +0000
@@ -0,0 +1,60 @@
1import QtQuick 2.0
2import QtTest 1.0
3import Dee 3.0
4
5TestCase {
6 name: "DeeVariantText"
7
8 function test_1_initialText () {
9 compare(arrayOfStr.value.toString(),"bar,foo")
10 }
11
12 function test_3_textAssigned () {
13 arrayOfInt.text = "[[4, 1.1, .1], [0, 0.3, 3.6]]"
14 compare(arrayOfInt.value.toString(),"4,1.1,0.1,0,0.3,3.6")
15 }
16
17 function test_4_textChanged () {
18 arrayOfInt.didChange = false
19 arrayOfInt.text = "@ams [nothing]"
20 compare(arrayOfInt.didChange,true)
21 }
22
23 function test_5_textNotChanged () {
24 arrayOfInt.text = "@ams [nothing]"
25 arrayOfInt.didChange = false
26 arrayOfInt.text = "@ams [nothing]"
27 compare(arrayOfInt.didChange,false)
28 }
29
30 function test_6_invalid () {
31 arrayOfInt.text = "[nothing]"
32 compare(arrayOfInt.value,undefined)
33 }
34
35 function test_7_unicode () {
36 arrayOfStr.text = "[\"١٢٣٤٥٦٧٨٩٠\", \"道具箱\", \"Котята\"]"
37 compare(arrayOfStr.value.toString(),"١٢٣٤٥٦٧٨٩٠,道具箱,Котята")
38 }
39
40 function test_8_gvariant () {
41 arrayOfStr.text = "[<\"test\">, <\"test2\">]"
42 compare(arrayOfStr.value.toString(), "test,test2")
43 }
44
45 DeeVariantText {
46 id: arrayOfStr
47 text: "[\"bar\", \"foo\"]"
48 }
49
50 DeeVariantText {
51 id: arrayOfInt
52 text: "[[1, 2, 3], [4, 5, 6]]"
53 property bool didChange: false
54 onTextChanged: {
55 didChange = true
56 }
57 }
58
59}
60

Subscribers

People subscribed via source and target branches