Skip to content
This repository was archived by the owner on Jun 8, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ rpm/harbour-tasklist.spec
*.o
localization
*.qm
build/
.directory
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "third_party/QtDropbox"]
path = third_party/QtDropbox
[submodule "src/third_party/QtDropbox"]
path = src/third_party/QtDropbox
url = https://github.com/lycis/QtDropbox.git
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ Developing
================
Have a look here to prepare your build environment for TaskList: https://github.com/Armadill0/harbour-tasklist/wiki

### Running tests
* Option 1: In the emulator console, just run `/usr/share/tst-harbour-tasklist/runTestsOnDevice.sh` Here are instructions on connecting to the emulator's console - https://sailfishos.org/develop-faq.html

* Option 2: Inside SailfishOS IDE

1. Toolbar -> Projects -> i486 -> Run -> Run Settings -> Run -> Run configuration -> "src (on Mer Device)" -> "Use this command instead"

2. Set "Alternate executable on device:" to `/usr/share/tst-harbour-tasklist/runTestsOnDevice.sh`

3. Run the project again, see test results in the console

Pull-Requests
================
Pull-Requests are always welcome. But please respect the following rules to make the life of the collaborators easier. ;-)
Expand Down
66 changes: 5 additions & 61 deletions harbour-tasklist.pro
Original file line number Diff line number Diff line change
@@ -1,62 +1,6 @@
# The name of your app.
# NOTICE: name defined in TARGET has a corresponding QML filename.
# If name defined in TARGET is changed, following needs to be
# done to match new name:
# - corresponding QML filename must be changed
# - desktop icon filename must be changed
# - desktop filename must be changed
# - icon definition filename in desktop file must be changed
TARGET = harbour-tasklist
TEMPLATE = subdirs
SUBDIRS = src tests

CONFIG += sailfishapp c++11
QT += dbus

SOURCES += src/harbour-tasklist.cpp \
src/tasksexport.cpp

OTHER_FILES += qml/harbour-tasklist.qml \
qml/pages/CoverPage.qml \
rpm/harbour-tasklist.yaml \
harbour-tasklist.desktop \
qml/localdb.js \
qml/pages/AboutPage.qml \
qml/pages/EditPage.qml \
qml/pages/TaskPage.qml \
qml/pages/ListPage.qml \
qml/pages/SettingsPage.qml \
qml/pages/TaskListItem.qml \
qml/pages/ExportPage.qml \
qml/pages/TagPage.qml \
qml/pages/TagDialog.qml \
qml/pages/sync/DropboxAuth.qml \
qml/pages/sync/DropboxSync.qml \
qml/pages/HelpPage.qml

include(third_party/QtDropbox/qtdropbox.pri)

!defined(TASKLIST_DROPBOX_APPKEY, var) {
error("Please provide Dropbox appkey as argument of qmake, e.g. 'qmake TASKLIST_DROPBOX_APPKEY=<your appkey here>'")
}
!defined(TASKLIST_DROPBOX_SHAREDSECRET, var) {
error("Please provide Dropbox shared secret as argument of qmake, e.g. 'qmake TASKLIST_DROPBOX_SHAREDSECRET=<your secret here>'")
}

DEFINES += TASKLIST_DROPBOX_APPKEY=$$TASKLIST_DROPBOX_APPKEY TASKLIST_DROPBOX_SHAREDSECRET=$$TASKLIST_DROPBOX_SHAREDSECRET

localization.files = localization
localization.path = /usr/share/$${TARGET}

INSTALLS += localization

CONFIG += sailfishapp_i18n_idbased

lupdate_only {
SOURCES = qml/*.qml \
qml/*.js \
qml/pages/*.qml \
qml/pages/sync/*.qml
TRANSLATIONS = localization-sources/*.ts
}

HEADERS += \
src/tasksexport.h
# ordered makes sure projects are built in the order specified in SUBDIRS.
# Usually it makes sense to build tests only if main component can be built
CONFIG += ordered
25 changes: 24 additions & 1 deletion rpm/harbour-tasklist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Configure: none
# The qtc5 builder inserts macros to allow QtCreator to have fine
# control over qmake/make execution
Builder: qtc5
QMakeOptions:
- VERSION=%{version}
- RELEASE=%{release}

# This section specifies build dependencies that are resolved using pkgconfig.
# This is the preferred way of specifying build dependencies for your package.
Expand All @@ -36,10 +39,30 @@ Requires:

# All installed files
Files:
- '%{_bindir}'
# Do not include whole %{_datadir}/applications as that would include tests too
- '%defattr(0644,root,root,0755)'
- '%{_datadir}/%{name}'
- '%{_datadir}/applications/%{name}.desktop'
- '%{_datadir}/icons/hicolor/86x86/apps/%{name}.png'
- '%attr(0755,-,-) %{_bindir}/%{name}'

SubPackages:
- Name: harbour-tasklist-test
Summary: harbour-tasklist tests
Group: Qt/Qt
Description: |-
Tests for the harbour-tasklist package
AutoDepend: true
PkgConfigBR:
- Qt5QuickTest
Requires:
- qt5-qtdeclarative-import-qttest
Files:
- '%{_bindir}/tst-harbour-tasklist'
- '%{_datadir}/tst-harbour-tasklist/*.qml'
# Script for starting tests on emulator and device
- '%attr(0755,-,-) %{_datadir}/tst-harbour-tasklist/*.sh'


# For more information about yaml and what's supported in Sailfish OS
# build system, please see https://wiki.merproject.org/wiki/Spectacle
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
5 changes: 5 additions & 0 deletions src/qml/TestCases.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import QtQuick 2.0

Item {

}
7 changes: 7 additions & 0 deletions src/qml/common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

//trim objects if they provide a trim() function (e. g. strings), else just the original object
function trimmed(obj) {
if(obj.trim)
return obj.trim()
return obj
}
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions qml/pages/EditPage.qml → src/qml/pages/EditPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import QtQuick 2.1
import Sailfish.Silica 1.0
import "../localdb.js" as DB
import "../common.js" as Common
import "."

Dialog {
Expand Down Expand Up @@ -59,7 +60,7 @@ Dialog {
function checkContent() {
var ok = true
var listId = listModel.get(list.currentIndex).id
var name = task.text
var name = Common.trimmed(task.text)
var count = DB.checkTask(listId, name)

// if task already exists in target list, display warning
Expand Down Expand Up @@ -115,7 +116,7 @@ Dialog {

onAccepted: {
var ok = DB.updateTask(params.taskid, listModel.get(list.currentIndex).id,
task.text, taskListWindow.statusOpen(status.checked) ? 1 : 0,
Common.trimmed(task.text), taskListWindow.statusOpen(status.checked) ? 1 : 0,
params.dueDate, 0, priorityBox.selectedPriority(), notes.text,
DB.REPETITION_VARIANTS[repeat.currentIndex].key)
if (ok)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion qml/pages/TaskPage.qml → src/qml/pages/TaskPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import QtQuick 2.1
import Sailfish.Silica 1.0
import "../localdb.js" as DB
import "../common.js" as Common
import "."

Page {
Expand Down Expand Up @@ -310,7 +311,7 @@ Page {
EnterKey.enabled: text.length > 0

function addTask(newTask) {
var taskNew = (typeof newTask !== 'undefined') ? newTask : taskAdd.text
var taskNew = Common.trimmed((typeof newTask !== 'undefined') ? newTask : taskAdd.text)
if (taskNew.length > 0) {
// add task to db and tasklist
var result = DB.writeTask(listid, taskNew, 1, 0, 0, DB.PRIORITY_DEFAULT, "")
Expand Down
69 changes: 69 additions & 0 deletions src/src.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# The name of your app.
# NOTICE: name defined in TARGET has a corresponding QML filename.
# If name defined in TARGET is changed, following needs to be
# done to match new name:
# - corresponding QML filename must be changed
# - desktop icon filename must be changed
# - desktop filename must be changed
# - icon definition filename in desktop file must be changed
TARGET = harbour-tasklist

CONFIG += sailfishapp c++11
QT += dbus

DEFINES += APP_VERSION=\\\"$$VERSION\\\"
DEFINES += APP_BUILDNUM=\\\"$$RELEASE\\\"

SOURCES += harbour-tasklist.cpp \
tasksexport.cpp

OTHER_FILES += qml/harbour-tasklist.qml \
qml/pages/CoverPage.qml \
harbour-tasklist.desktop \
qml/localdb.js \
qml/pages/AboutPage.qml \
qml/pages/EditPage.qml \
qml/pages/TaskPage.qml \
qml/pages/ListPage.qml \
qml/pages/SettingsPage.qml \
qml/pages/TaskListItem.qml \
qml/pages/ExportPage.qml \
qml/pages/TagPage.qml \
qml/pages/TagDialog.qml \
qml/pages/sync/DropboxAuth.qml \
qml/pages/sync/DropboxSync.qml \
qml/pages/HelpPage.qml
# You DO NOT want .yaml be listed here as Qt Creator's editor is completely not ready for multi package .yaml's
#
# Also Qt Creator as of Nov 2013 will anyway try to rewrite your .yaml whenever you change your .pro
# Well, you will just have to restore .yaml from version control again and again unless you figure out
# how to kill this particular Creator's plugin

include(third_party/QtDropbox/qtdropbox.pri)

!defined(TASKLIST_DROPBOX_APPKEY, var) {
error("Please provide Dropbox appkey as argument of qmake, e.g. 'qmake TASKLIST_DROPBOX_APPKEY=<your appkey here>'")
}
!defined(TASKLIST_DROPBOX_SHAREDSECRET, var) {
error("Please provide Dropbox shared secret as argument of qmake, e.g. 'qmake TASKLIST_DROPBOX_SHAREDSECRET=<your secret here>'")
}

DEFINES += TASKLIST_DROPBOX_APPKEY=$$TASKLIST_DROPBOX_APPKEY TASKLIST_DROPBOX_SHAREDSECRET=$$TASKLIST_DROPBOX_SHAREDSECRET

localization.files = localization
localization.path = /usr/share/$${TARGET}

INSTALLS += localization

CONFIG += sailfishapp_i18n_idbased

lupdate_only {
SOURCES = qml/*.qml \
qml/*.js \
qml/pages/*.qml \
qml/pages/sync/*.qml
TRANSLATIONS = localization-sources/*.ts
}

HEADERS += \
tasksexport.h
1 change: 1 addition & 0 deletions src/third_party/QtDropbox
Submodule QtDropbox added at 17ad00
4 changes: 4 additions & 0 deletions tests/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include <QtQuickTest/quicktest.h>

// SailCalcTestSet is just a convenient name for reports - not linked to any of the main project entities
QUICK_TEST_MAIN(TasklistTestSet)
7 changes: 7 additions & 0 deletions tests/runTestsOnDevice.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Script for running tests. That's for specifying just one argument in QtCreator's configuration
/usr/bin/tst-harbour-tasklist -input /usr/share/tst-harbour-tasklist

# When you'll get some QML components in the main app, you'll need to import them to the test run
# /usr/bin/tst-harbour-tasklist -input /usr/share/tst-harbour-tasklist -import /usr/share/harbour-tasklist/qml/components
37 changes: 37 additions & 0 deletions tests/tests.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
TEMPLATE = app

# The name of your app
TARGET = tst-harbour-tasklist

CONFIG += qmltestcase

TARGETPATH = /usr/bin
target.path = $$TARGETPATH

DEPLOYMENT_PATH = /usr/share/$$TARGET
qml.path = $$DEPLOYMENT_PATH

extra.path = $$DEPLOYMENT_PATH
extra.files = runTestsOnDevice.sh

# defining QUICK_TEST_SOURCE_DIR here doesn't work QtCreator keeps injecting another definition to command line (from CONFIG += qmltestcase ?)
#DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"\"$${DEPLOYMENT_PATH}/\"\\\"\"
DEFINES += DEPLOYMENT_PATH=\"\\\"\"$${DEPLOYMENT_PATH}/\"\\\"\"

# C++ sources
SOURCES += main.cpp

# C++ headers
HEADERS +=

INSTALLS += target qml extra

# QML files and folders
qml.files = *.qml

OTHER_FILES += \
tst_RealUiTest.qml \
tst_NonUiTests.qml



29 changes: 29 additions & 0 deletions tests/tst_NonUiTests.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Tests that operate with instantiated QML components, yet don't really need Application Window to be created
* That will produce a lot of warnings, UI utilities such as mouseClick won't work, but the test code becomes simpler
* and runs faster
* And if you do want to operate on the muse level, you can get almost there via e.g. triggering clicked(null) signal handler
*
*/

import QtQuick 2.0
import QtTest 1.0

// At runtime proper folder to import is "../harbour-tasklist/qml/pages"
// You can check the main app deployment folder from it's DEPLOYMENT_PATH qmake var in .pro
// Faster to check from .spec file, however

// At design-time I uncomment import "../src/qml/pages" so that QtCreator auto-completion would work

//import "../src/qml/pages"
import "../harbour-tasklist/qml/pages"

TestCase {
name: "footest"

function test_fail() {
fail()
}
}


1 change: 0 additions & 1 deletion third_party/QtDropbox
Submodule QtDropbox deleted from 8f0955