Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sociald] Improve unit test coverage. Contributes to JB#13730
- Loading branch information
Showing
35 changed files
with
1,174 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
TEMPLATE = subdirs | ||
SUBDIRS = src tests | ||
|
||
tests.depends = src | ||
|
||
OTHER_FILES += rpm/sociald.spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,3 @@ SocialImage { | |
visible: image.status !== Image.Ready | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
TEMPLATE = aux | ||
|
||
OTHER_FILES += \ | ||
../*.xml \ | ||
*.qml | ||
|
||
unittest.files = *.qml | ||
unittest.path = /opt/tests/sociald/auto | ||
|
||
shared.files = ../../src/eventfeed/*.qml | ||
shared.path = /opt/tests/sociald/auto/eventfeed/shared | ||
|
||
twitter.files = ../../src/twitter/eventfeed/*.qml | ||
twitter.path = /opt/tests/sociald/auto/eventfeed | ||
|
||
INSTALLS += unittest shared twitter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/**************************************************************************************** | ||
** | ||
** Copyright (C) 2013 Jolla Ltd. | ||
** Contact: Antti Seppälä <antti.seppala@jollamobile.com> | ||
** All rights reserved. | ||
** | ||
** This file is part of sociald package. | ||
** | ||
****************************************************************************************/ | ||
|
||
import QtTest 1.0 | ||
import QtQuick 2.0 | ||
import Sailfish.Silica 1.0 | ||
import "eventfeed/shared" | ||
|
||
ApplicationWindow { | ||
id: window | ||
deviceOrientation: Orientation.Portrait | ||
initialPage: accountPage | ||
|
||
SocialAccountPage { | ||
id: accountPage | ||
accounts: createAccounts() | ||
|
||
function createAccounts() { | ||
var accArray = new Array | ||
for (var i = 0; i < 100; i++) { | ||
accArray.push({"name": "Account" + i}) | ||
} | ||
return accArray | ||
} | ||
} | ||
|
||
SignalSpy { | ||
id: clickedSpy | ||
target: accountPage | ||
signalName: "indexSelected" | ||
} | ||
TestEvent { id: testEvent } | ||
|
||
TestCase { | ||
name: "SocialAccountPage" | ||
when: windowShown | ||
|
||
function test_accountPage() { | ||
verify(accountPage === pageStack.currentPage) | ||
compare(accountPage.currentIndex, 0) | ||
verify(accountPage.accounts !== null) | ||
compare(accountPage.headerText, "") | ||
|
||
clickedSpy.clear() | ||
testEvent.mouseClick(accountPage, accountPage.width / 2, accountPage.height / 2, Qt.LeftButton, 0, 0) | ||
compare(clickedSpy.count, 1) | ||
verify(accountPage.currentIndex > 0) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/**************************************************************************************** | ||
** | ||
** Copyright (C) 2013 Jolla Ltd. | ||
** Contact: Antti Seppälä <antti.seppala@jollamobile.com> | ||
** All rights reserved. | ||
** | ||
** This file is part of sociald package. | ||
** | ||
****************************************************************************************/ | ||
|
||
import QtTest 1.0 | ||
import QtQuick 2.0 | ||
import Sailfish.Silica 1.0 | ||
import "eventfeed/shared" | ||
|
||
ApplicationWindow { | ||
id: window | ||
deviceOrientation: Orientation.Portrait | ||
|
||
Page { | ||
id: page | ||
|
||
SilicaListView { | ||
id: listView | ||
anchors.fill: parent | ||
model: ListModel {} | ||
|
||
Item { | ||
id: subviewModel | ||
|
||
function accountList(idString) { | ||
var result = new Array | ||
result.push({"identifier": 2, "displayName": "Test account"}) | ||
return result | ||
} | ||
} | ||
|
||
SocialAccountPullDownMenu { | ||
id: pullDownMenu | ||
pageContainer: page | ||
accountString: "Account %1" | ||
|
||
property QtObject model: QtObject { | ||
property QtObject accounts: QtObject { | ||
function indexOf(what) { | ||
if (what === 2) { | ||
return 0 | ||
} | ||
return -1 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
initialPage: page | ||
|
||
TestCase { | ||
name: "SocialAccountPullDownMenu" | ||
when: windowShown | ||
|
||
function test_pullDownMenu() { | ||
compare(pullDownMenu.currentAccount, 2) | ||
compare(pullDownMenu.currentAccountIndex, 0) | ||
compare(pullDownMenu.selectAccountString, "") | ||
compare(pullDownMenu.changeToAccountString, "") | ||
compare(pullDownMenu.accountString, "Account %1") | ||
compare(pullDownMenu.pageContainer, page) | ||
compare(pullDownMenu.serviceName, "") | ||
compare(pullDownMenu.switchEnabled, false) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/**************************************************************************************** | ||
** | ||
** Copyright (C) 2013 Jolla Ltd. | ||
** Contact: Antti Seppälä <antti.seppala@jollamobile.com> | ||
** All rights reserved. | ||
** | ||
** This file is part of sociald package. | ||
** | ||
****************************************************************************************/ | ||
|
||
import QtTest 1.0 | ||
import QtQuick 2.0 | ||
import Sailfish.Silica 1.0 | ||
import "eventfeed/shared" | ||
|
||
Item { | ||
id: item | ||
width: 100; height: 100 | ||
|
||
SocialAvatar { | ||
id: avatar | ||
} | ||
|
||
TestCase { | ||
name: "SocialAvatar" | ||
when: windowShown | ||
|
||
function test_avatar() { | ||
compare(avatar.width, Theme.itemSizeExtraLarge) | ||
compare(avatar.height, Theme.itemSizeExtraLarge) | ||
compare(avatar.fillMode, Image.PreserveAspectCrop) | ||
compare(avatar.sourceSize.width, avatar.width) | ||
compare(avatar.sourceSize.height, avatar.height) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/**************************************************************************************** | ||
** | ||
** Copyright (C) 2013 Jolla Ltd. | ||
** Contact: Antti Seppälä <antti.seppala@jollamobile.com> | ||
** All rights reserved. | ||
** | ||
** This file is part of sociald package. | ||
** | ||
****************************************************************************************/ | ||
|
||
import QtTest 1.0 | ||
import QtQuick 2.0 | ||
import Sailfish.Silica 1.0 | ||
import "eventfeed/shared" | ||
|
||
Item { | ||
width: 100; height: 100 | ||
|
||
SocialBody { | ||
id: body | ||
width: parent.width | ||
} | ||
|
||
TestCase { | ||
name: "SocialBody" | ||
when: windowShown | ||
|
||
function test_body() { | ||
compare(body.text, "") | ||
compare(body.time, "") | ||
} | ||
} | ||
} |
Oops, something went wrong.