ubuntu-ui-extras-0.2+16.04.20160323.1/ 0000755 0000156 0000165 00000000000 12674555560 017333 5 ustar pbuser pbgroup 0000000 0000000 ubuntu-ui-extras-0.2+16.04.20160323.1/tests/ 0000755 0000156 0000165 00000000000 12674555560 020475 5 ustar pbuser pbgroup 0000000 0000000 ubuntu-ui-extras-0.2+16.04.20160323.1/tests/qml/ 0000755 0000156 0000165 00000000000 12674555560 021266 5 ustar pbuser pbgroup 0000000 0000000 ubuntu-ui-extras-0.2+16.04.20160323.1/tests/qml/tst_CropDragArea.qml 0000644 0000156 0000165 00000005343 12674555141 025165 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright 2015 Canonical Ltd.
*
* This file is part of dialer-app.
*
* dialer-app is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* dialer-app is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
import QtQuick 2.3
import QtTest 1.0
import Ubuntu.Test 0.1
import Ubuntu.Components 1.1
import '../../modules/Ubuntu/Components/Extras/PhotoEditor'
Item {
id: root
width: units.gu(40)
height: units.gu(60)
CropDragArea {
id: cropDragArea
anchors.fill: parent
}
SignalSpy {
id: draggedSpy
target: cropDragArea
signalName: 'dragged'
}
SignalSpy {
id: dragStartedSpy
target: cropDragArea
signalName: 'dragStarted'
}
SignalSpy {
id: dragCompletedSpy
target: cropDragArea
signalName: 'dragCompleted'
}
UbuntuTestCase {
id: cropDragAreaTestCase
name: 'cropDragAreaTestCase'
when: windowShown
function init() {
waitForRendering(cropDragArea);
}
function cleanup() {
draggedSpy.clear()
dragStartedSpy.clear()
dragCompletedSpy.clear()
}
function test_cropDragAreaCheckDragExecution() {
mousePress(cropDragArea, cropDragArea.width / 2, cropDragArea.height / 2)
dragStartedSpy.wait()
compare(dragStartedSpy.count, 1, 'dragStarted signal was not emitted.')
mouseMove(cropDragArea, cropDragArea.width / 2, cropDragArea.height)
draggedSpy.wait()
compare(draggedSpy.count, 1, 'dragged signal was not emitted.')
mouseRelease(cropDragArea, cropDragArea.width / 2, cropDragArea.height)
dragCompletedSpy.wait()
compare(dragCompletedSpy.count, 1, 'dragCompleted signal was not emitted.')
}
function test_cropDragAreaCheckClickExecution() {
mouseClick(cropDragArea, cropDragArea.width / 2, cropDragArea.height / 2)
dragStartedSpy.wait()
compare(dragStartedSpy.count, 1, 'dragStarted signal was not emitted.')
dragCompletedSpy.wait()
compare(dragCompletedSpy.count, 1, 'dragCompleted signal was not emitted.')
compare(draggedSpy.count, 0, 'dragged signal was emitted.')
}
}
}
ubuntu-ui-extras-0.2+16.04.20160323.1/tests/qml/tst_BusyIndicator.qml 0000644 0000156 0000165 00000005217 12674555141 025452 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright 2015 Canonical Ltd.
*
* This file is part of dialer-app.
*
* dialer-app is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* dialer-app is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
import QtQuick 2.3
import QtTest 1.0
import Ubuntu.Test 0.1
import Ubuntu.Components 1.1
import '../../modules/Ubuntu/Components/Extras/PhotoEditor'
Item {
id: root
width: units.gu(40)
height: units.gu(60)
BusyIndicator {
id: busyIndicator
text: "BusyIndicatorText"
}
UbuntuTestCase {
id: busyIndicatorTestCase
name: 'busyIndicatorTestCase'
when: windowShown
function init() {
waitForRendering(busyIndicator);
}
function cleanup() {
}
function test_busyIndicatorCheckInvisibleWhenNotRunning() {
busyIndicator.running = false
tryCompare(busyIndicator, 'visible', false)
}
function test_busyIndicatorCheckIsVisibleWhenRunning() {
busyIndicator.running = true
tryCompare(busyIndicator, 'visible', true)
}
function test_busyIndicatorCheckLabelInvisibleWhenNotLongOperation() {
busyIndicator.running = true
busyIndicator.longOperation = false
var l = findChild(busyIndicator, 'busyLabel')
tryCompare(l, 'visible', false)
}
function test_busyIndicatorCheckLabelIsVisibleWhenLongOperation() {
busyIndicator.running = true
busyIndicator.longOperation = true
var l = findChild(busyIndicator, 'busyLabel')
tryCompare(l, 'visible', true)
}
function test_busyIndicatorCheckUbuntuShapeOpacityWhenNotLongOperation() {
busyIndicator.running = true
busyIndicator.longOperation = false
var us = findChild(busyIndicator, 'busyUbuntuShape')
tryCompare(us, 'opacity', 0)
}
function test_busyIndicatorCheckUbuntuShapeOpacityWhenLongOperation() {
busyIndicator.running = true
busyIndicator.longOperation = true
var us = findChild(busyIndicator, 'busyUbuntuShape')
tryCompare(us, 'opacity', 0.75)
}
}
}
ubuntu-ui-extras-0.2+16.04.20160323.1/tests/qml/tst_ActionsBar.qml 0000644 0000156 0000165 00000004513 12674555141 024716 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright 2015 Canonical Ltd.
*
* This file is part of dialer-app.
*
* dialer-app is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* dialer-app is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
import QtQuick 2.3
import QtTest 1.0
import Ubuntu.Test 0.1
import Ubuntu.Components 1.1
import '../../modules/Ubuntu/Components/Extras/PhotoEditor'
Item {
id: root
width: units.gu(40)
height: units.gu(60)
property list toolActions: [
Action { text: "ToolActions01" },
Action { text: "ToolActions02" }
]
property list filterActions: [
Action { text: "FilterActions01" },
Action { text: "FilterActions02" }
]
ActionsBar {
id: actionsBar
toolActions: root.toolActions
}
UbuntuTestCase {
id: actionsBarTestCase
name: 'actionsBarTestCase'
when: windowShown
function init() {
waitForRendering(actionsBar);
}
function cleanup() {
}
function test_actionsBarCheckColumnHeightWhitFilterActions() {
actionsBar.filterActions = root.filterActions
tryCompare(actionsBar, 'height', units.gu(20))
}
function test_actionsBarCheckColumnHeightWhitFilterActionsEmpty() {
actionsBar.filterActions = []
tryCompare(actionsBar, 'height', units.gu(6))
}
function test_actionsBarCheckFiltersBarVisibleWhitFilterActions() {
actionsBar.filterActions = root.filterActions
var filtersBar = findChild(actionsBar, 'filtersBar')
tryCompare(filtersBar, 'visible', true)
}
function test_actionsBarCheckFiltersBarNotVisibleWhitFilterActionsEmpty() {
actionsBar.filterActions = []
var filtersBar = findChild(actionsBar, 'filtersBar')
tryCompare(filtersBar, 'visible', false)
}
}
}
ubuntu-ui-extras-0.2+16.04.20160323.1/tests/qml/CMakeLists.txt 0000644 0000156 0000165 00000001772 12674555141 024030 0 ustar pbuser pbgroup 0000000 0000000 find_program(QMLTESTRUNNER_BIN
NAMES qmltestrunner
PATHS /usr/lib/*/qt5/bin
NO_DEFAULT_PATH
)
find_program(XVFB_RUN_BIN
NAMES xvfb-run
)
macro(DECLARE_QML_TEST TST_NAME TST_QML_FILE)
add_test(NAME ${TST_NAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${XVFB_RUN_BIN} -a -s "-screen 0 1024x768x24" ${QMLTESTRUNNER_BIN} -input ${CMAKE_CURRENT_SOURCE_DIR}/${TST_QML_FILE}
)
endmacro()
if(QMLTESTRUNNER_BIN AND XVFB_RUN_BIN)
declare_qml_test("tst_actions_bar" tst_ActionsBar.qml)
declare_qml_test("tst_busy_indicator" tst_BusyIndicator.qml)
declare_qml_test("tst_crop_drag_area" tst_CropDragArea.qml)
else()
if (NOT QMLTESTRUNNER_BIN)
message(WARNING "Qml tests disabled: qmltestrunner not found")
else()
message(WARNING "Qml tests disabled: xvfb-run not found")
endif()
endif()
set(QML_TST_FILES
tst_ActionsBar.qml
tst_BusyIndicator.qml
tst_CropDragArea.qml
)
add_custom_target(tst_QmlFiles ALL SOURCES ${QML_TST_FILES})
ubuntu-ui-extras-0.2+16.04.20160323.1/tests/unittests/ 0000755 0000156 0000165 00000000000 12674555560 022537 5 ustar pbuser pbgroup 0000000 0000000 ubuntu-ui-extras-0.2+16.04.20160323.1/tests/unittests/tst_PhotoEditorPhoto.cpp 0000644 0000156 0000165 00000015435 12674555141 027412 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright (C) 2014 Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "photo-data.h"
#include
#include
#include
#include
#include
#include
#include
class PhotoEditorPhotoTest: public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase();
void testBasicProperties();
void testOrientation();
void testRefresh();
void testRotate();
void testCrop();
void cleanupTestCase();
private:
QTemporaryDir m_workingDir;
};
void PhotoEditorPhotoTest::initTestCase()
{
QDir rc = QDir(":/assets/");
QDir dest = QDir(m_workingDir.path());
Q_FOREACH(const QString &name, rc.entryList())
{
QFile::copy(rc.absoluteFilePath(name), dest.absoluteFilePath(name));
QFile::setPermissions(dest.absoluteFilePath(name),
QFile::WriteOwner | QFile::ReadOwner);
}
m_workingDir.setAutoRemove(false);
}
void PhotoEditorPhotoTest::cleanupTestCase()
{
// temporary dir will be deleted when m_workingDir goes out of scope
}
void PhotoEditorPhotoTest::testBasicProperties()
{
QDir source = QDir(m_workingDir.path());
QString path = source.absoluteFilePath("windmill.jpg");
PhotoData photo;
photo.setPath(path);
QVERIFY(photo.path() == path);
QVERIFY(photo.file() == QFileInfo(path));
QVERIFY(photo.fileFormat() == "jpeg");
QVERIFY(photo.fileFormatHasMetadata() == true);
QVERIFY(photo.fileFormatHasOrientation() == true);
}
void PhotoEditorPhotoTest::testOrientation()
{
QDir source = QDir(m_workingDir.path());
QString path = source.absoluteFilePath("windmill.jpg");
PhotoData photo;
photo.setPath(path);
QVERIFY(photo.orientation() == TOP_LEFT_ORIGIN);
PhotoData photo2;
QString path2 = source.absoluteFilePath("windmill_rotated_90.jpg");
photo2.setPath(path2);
QVERIFY(photo2.orientation() == RIGHT_TOP_ORIGIN);
// Test updating the original PhotoData by changing path
photo.setPath(path2);
QVERIFY(photo.orientation() == RIGHT_TOP_ORIGIN);
}
void PhotoEditorPhotoTest::testRefresh()
{
// Work on a copy to avoid disturbing other tests
QDir source = QDir(m_workingDir.path());
QString path = source.absoluteFilePath("testrefresh.jpg");
qDebug() << QFile::copy(source.absoluteFilePath("windmill.jpg"), path);
// Load the file.
PhotoData photo;
photo.setPath(path);
Orientation orientation = photo.orientation();
// Now overwrite it with another file with different rotation and verify
// the new data is correct
QFile::remove(path);
QFile::copy(source.absoluteFilePath("windmill_rotated_90.jpg"), path);
photo.refreshFromDisk();
QVERIFY(orientation != photo.orientation());
}
void PhotoEditorPhotoTest::testRotate()
{
// Work on a copy to avoid disturbing other tests
QDir source = QDir(m_workingDir.path());
QString path = source.absoluteFilePath("testrotate.jpg");
QFile::remove(path);
QFile::copy(source.absoluteFilePath("windmill.jpg"), path);
PhotoData photo;
photo.setPath(path);
QVERIFY(photo.path() == path);
QVERIFY(photo.orientation() == TOP_LEFT_ORIGIN);
QSignalSpy spy(&photo, SIGNAL(busyChanged()));
photo.rotateRight();
spy.wait(5000);
QVERIFY(photo.orientation() == RIGHT_TOP_ORIGIN);
spy.clear();
photo.rotateRight();
spy.wait(5000);
QVERIFY(photo.orientation() == BOTTOM_RIGHT_ORIGIN);
spy.clear();
photo.rotateRight();
spy.wait(5000);
QVERIFY(photo.orientation() == LEFT_BOTTOM_ORIGIN);
spy.clear();
photo.rotateRight();
spy.wait(5000);
QVERIFY(photo.orientation() == TOP_LEFT_ORIGIN);
}
void PhotoEditorPhotoTest::testCrop()
{
QDir source = QDir(m_workingDir.path());
QString path = source.absoluteFilePath("tmp.png");
QFile::remove(path);
QFile::copy(source.absoluteFilePath("croptest.png"), path);
PhotoData photo;
photo.setPath(path);
// Verify cropping a vertical strip at the left edge
QSignalSpy spy(&photo, SIGNAL(busyChanged()));
photo.crop(QRectF(0, 0, 0.1, 1.0));
spy.wait(5000);
QImage cropped(path);
QImage compare(QSize(10, 100), cropped.format());
compare.fill(QColor(0, 0, 0));
QVERIFY(compare == cropped);
// Verify cropping a square from the center
QFile::remove(path);
QFile::copy(source.absoluteFilePath("croptest.png"), path);
photo.setPath(path);
spy.clear();
photo.crop(QRectF(0.4, 0.4, 0.2, 0.2));
spy.wait(5000);
cropped = QImage(path);
compare = QImage(QSize(20, 20), cropped.format());
compare.fill(QColor(0, 255, 0));
QVERIFY(compare == cropped);
// Verify cropping a thin strip from the top after rotating the image.
// Incidentally this also tests rotation of an image without EXIF tags
QFile::remove(path);
QFile::copy(source.absoluteFilePath("croptest.png"), path);
photo.setPath(path);
spy.clear();
photo.rotateRight();
spy.wait(5000);
spy.clear();
photo.crop(QRectF(0.0, 0.0, 1.0, 0.1));
spy.wait(5000);
cropped = QImage(path);
compare = QImage(QSize(100, 10), cropped.format());
compare.fill(QColor(0, 0, 0));
QVERIFY(compare == cropped);
// When rotating an image without EXIF, the orientation is fixed
QVERIFY(photo.orientation() == TOP_LEFT_ORIGIN);
// Test progressive cropping by carving off the bottom horizontal strip and
// then cropping the center part of it
QFile::remove(path);
QFile::copy(source.absoluteFilePath("croptest.png"), path);
photo.setPath(path);
spy.clear();
photo.crop(QRectF(0.0, 0.9, 1.0, 0.1));
spy.wait(5000);
spy.clear();
photo.crop(QRectF(0.1, 0.0, 0.8, 1.0));
spy.wait(5000);
cropped = QImage(path);
compare = QImage(QSize(80, 10), cropped.format());
compare.fill(QColor(0, 0, 255));
QVERIFY(compare == cropped);
// Test a cropping rectangle outside of boundaries
QFile::remove(path);
QFile::copy(source.absoluteFilePath("croptest.png"), path);
photo.setPath(path);
spy.clear();
photo.crop(QRectF(-1.0, -100.0, 2405.0, 2.0));
spy.wait(5000);
cropped = QImage(path);
QVERIFY(cropped.size() == QSize(100, 100));
}
QTEST_MAIN(PhotoEditorPhotoTest)
#include "tst_PhotoEditorPhoto.moc"
ubuntu-ui-extras-0.2+16.04.20160323.1/tests/unittests/tst_ExampleModelTests.cpp 0000644 0000156 0000165 00000002277 12674555141 027537 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright 2013 Canonical Ltd.
*
* This file is part of ubuntu-ui-extras.
*
* ubuntu-ui-extras is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* ubuntu-ui-extras is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
// Qt
#include
#include
#include
#include
// local
#include "example-model.h"
class ExampleModelTests : public QObject
{
Q_OBJECT
private:
ExampleModel* model;
private Q_SLOTS:
void init()
{
model = new ExampleModel;
}
void cleanup()
{
delete model;
}
void shouldHaveThreeItems()
{
QCOMPARE(model->rowCount(), 3);
}
};
QTEST_MAIN(ExampleModelTests)
#include "tst_ExampleModelTests.moc"
ubuntu-ui-extras-0.2+16.04.20160323.1/tests/unittests/assets/ 0000755 0000156 0000165 00000000000 12674555560 024041 5 ustar pbuser pbgroup 0000000 0000000 ubuntu-ui-extras-0.2+16.04.20160323.1/tests/unittests/assets/croptest.png 0000644 0000156 0000165 00000000515 12674555141 026406 0 ustar pbuser pbgroup 0000000 0000000 PNG
IHDR d d pHYs tIMEd{O tEXtComment Created with GIMPW IDATxA
@љ E
5 ƍzU#:X`K`S/ֶ8,c,X,X,X` ,X`,X`ڱ2dCX,X` ,X`,XVo{t',X,X` ,X`,X`%X`K都^tE'c,X])N}/ IENDB` ubuntu-ui-extras-0.2+16.04.20160323.1/tests/unittests/assets/testfile_portrait.jpg 0000644 0000156 0000165 00001210706 12674555141 030310 0 ustar pbuser pbgroup 0000000 0000000 JFIF ` ` C
$ #," '.0,)7(44418=9'.<2432 C
2!!22222222222222222222222222222222222222222222222222
"
} !1AQa"q2#BR$3br
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz
w !1AQaq"2B #3Rbr
$4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ? 8 RsAHK@'␜`c.p?O^) })N:ar8;sJs0CFq;J>p Wi8HqK"Qz′bc
9+9
X^9'('PxzPݩ:B:R#4 qCɥ'.;;Rߊ8L= S{b#( x;tҎO|}iOiю{bcAtǧ41A#