Merge lp:~paulliu/unity/phablet_add-qmluitest1 into lp:unity/phablet

Proposed by Ying-Chun Liu
Status: Merged
Approved by: Michael Zanetti
Approved revision: 642
Merged at revision: 638
Proposed branch: lp:~paulliu/unity/phablet_add-qmluitest1
Merge into: lp:unity/phablet
Diff against target: 105 lines (+91/-0)
2 files modified
tests/qmltests/CMakeLists.txt (+1/-0)
tests/qmltests/Panel/Menus/tst_IndicatorMenuWindow.qml (+90/-0)
To merge this branch: bzr merge lp:~paulliu/unity/phablet_add-qmluitest1
Reviewer Review Type Date Requested Status
Daniel d'Andrada (community) Needs Information
Michael Zanetti (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+158362@code.launchpad.net

Commit message

Add test for Panel/Menus/IndicatorMenuWindow.

Description of the change

Add test for Panel/Menus/IndicatorMenuWindow.

To post a comment you must log in.
578. By Michael Zanetti on 2013-04-11

added tests for PeoplePreview.

Approved by Albert Astals Cid, PS Jenkins bot.

579. By Jussi Pakkanen on 2013-04-11

Detect unwanted implementation detail leakage in public headers

Our API design guidelines say that public headers should not leak implementation details such as gobject. This script checks that they don't.

Approved by PS Jenkins bot, Michi Henning.

580. By Michał Sawicz on 2013-04-11

use the ./build and ./run scripts on the device.

Approved by PS Jenkins bot, Albert Astals Cid.

Daniel d'Andrada (dandrader) wrote :

60 + compare(indicatorMenuWindow.headingText, indicatorMenuWindow.name, "IndicatorMenuWindow name != headingText")
61 + compare(indicatorMenuWindow.contentHeight, testIndicatorMenuWindowItem.height, "IndicatorMenuWindow contentHeight != height")

Please avoid such long lines. Avoid having anything longer than 90 chars. Long lines makes having split windows (side-by-side code windows) a pain.

581. By Michael Zanetti on 2013-04-11

get rid of old header which was replaced by switching to DashPreview.

Approved by PS Jenkins bot, Michał Sawicz.

582. By Michał Sawicz on 2013-04-11

add missing phablet3 dependency, release 1.71.

Approved by PS Jenkins bot, Sergio Schvezov.

Daniel d'Andrada (dandrader) wrote :

Looking at IndicatorMenuWindow.qml, I don't think it makes sense to test it at all. There's virtually no logic in there. Nothing worth testing.

This test is also at a 1:1 mapping of the code being tested. It doesn't make much sense.

e.g.:

code under test:
   opacity: shown ? 1.0 : 0.0
test code:
    compare(indicatorMenuWindow.opacity, 0.0, "Init opacity is not zero")
    indicatorMenuWindow.shown=true
    tryCompare(indicatorMenuWindow, "opacity", 1.0)
    indicatorMenuWindow.shown=false
    tryCompare(indicatorMenuWindow, "opacity", 0.0)

I fail to see the value of such tests.

review: Disapprove
Daniel d'Andrada (dandrader) wrote :

> Looking at IndicatorMenuWindow.qml, I don't think it makes sense to test it at
> all. There's virtually no logic in there. Nothing worth testing.
>
> This test is also at a 1:1 mapping of the code being tested. It doesn't make
> much sense.
>
> e.g.:
>
> code under test:
> opacity: shown ? 1.0 : 0.0
> test code:
> compare(indicatorMenuWindow.opacity, 0.0, "Init opacity is not zero")
> indicatorMenuWindow.shown=true
> tryCompare(indicatorMenuWindow, "opacity", 1.0)
> indicatorMenuWindow.shown=false
> tryCompare(indicatorMenuWindow, "opacity", 0.0)
>
> I fail to see the value of such tests.

I mean, this is like testing if a QML expression is doing what it should do. It's like testing QML itself.

583. By Michael Zanetti on 2013-04-11

Bring back launcher tests.

Approved by PS Jenkins bot, Daniel d'Andrada.

584. By Michael Terry on 2013-04-12

Greeter: Make highlight box darker and rounder.

Approved by Katie Taylor, PS Jenkins bot, John Lea.

585. By Jussi Pakkanen on 2013-04-12

Check for indentation made with tabs.

Approved by PS Jenkins bot.

586. By Albert Astals Cid on 2013-04-12

No need to store the role names ourselves, just relay the source model roles.

Approved by Michał Sawicz, PS Jenkins bot, Michael Zanetti.

587. By Nick Dedekind on 2013-04-12

Added panel tests.

Approved by Albert Astals Cid, PS Jenkins bot.

588. By Daniel d'Andrada on 2013-04-12

Improve add_qml_test() CMake function

- Improve its documentation
- Add support for multiple QML import paths
- Refactor implementation of PROPERTIES argument.
  Turn it into a multi-valued keyword.

Approved by PS Jenkins bot, Michał Sawicz.

589. By Michael Zanetti on 2013-04-12

added tests for Indicators Overview Page

Volume slider and Flight mode button have been left for now as they don't do anything.

Approved by PS Jenkins bot, Nick Dedekind.

590. By Andrea Cimitan on 2013-04-12

Adds tests for IndicatorItem.

Approved by PS Jenkins bot, Michael Zanetti.

591. By Albert Astals Cid on 2013-04-12

Remove unused signal.

Approved by PS Jenkins bot, Michael Zanetti.

592. By Gerry Boland on 2013-04-12

[tests] Add ListViewWithPageHeader tests.

Approved by PS Jenkins bot, Michael Zanetti.

593. By Andrea Cimitan on 2013-04-12

Add tests for Greeter's Clock.

Approved by PS Jenkins bot, Michael Zanetti.

594. By Jussi Pakkanen on 2013-04-12

More fixes to CMake setup.

Approved by PS Jenkins bot, Michi Henning.

595. By Michael Zanetti on 2013-04-15

Make volume slider in Overview work
add tests
merge trunk
.

Approved by PS Jenkins bot, Albert Astals Cid.

596. By Albert Astals Cid on 2013-04-15

No need to specify regexp twice
.

Approved by PS Jenkins bot, Michael Zanetti.

597. By Michi Henning on 2013-04-15

Re-based this MR on trunk rather than a prerequisite branch.

    Added coverage processing for C++ and suppressions to stop unwanted chatter during the build and to ignore things we don't want coverage for (/usr/include and tests).
    Added clean-coverage target. This removes all .gcda files, which is useful if the tests have been run previously, and code changes have come to the point where the new and old .gcda files can't be merged anymore. In this case, run "make clean-coverage" and re-run the tests before generating the coverage report.
    Fixed overwriting of CMAKE_MODULE_PATH.
    Added cppcheck target for static checking of C++ (similar to lint).
    Fixed build script to print usage if command-line arguments/options are incorrect and to write to stderr instead of stdout for errors.
    Changed build script to allow the build type to be passed in, so we don't have a hard-wired build type.

Approved by PS Jenkins bot, Michał Sawicz.

598. By Michał Sawicz on 2013-04-15

disable libhud tests, add missing libboost-regex dependency in build scripts.

Approved by Albert Astals Cid, PS Jenkins bot.

599. By Albert Astals Cid on 2013-04-15

Just create the QModelIndex once
.

Approved by PS Jenkins bot, Michael Zanetti.

600. By Brandon Schaefer on 2013-04-15

Adds GDB option to the run script.

Approved by Michał Sawicz, PS Jenkins bot.

Michael Zanetti (mzanetti) wrote :

I agree with Daniel here. I think what could be tested is that the Window in fact does not let any mouse clicks pass through (which is the actual purpose of it).

In a nutshell:
- Open the Window, make it invisible
- Click somewhere in the window, make sure the click passes through
- Make it visible
- Click again in the window, make sure the click does NOT pass through it

review: Needs Fixing
601. By Ying-Chun Liu on 2013-04-16

Add unittests for Components/OpenEffect.qml.

Approved by Michael Zanetti, PS Jenkins bot.

602. By Michał Sawicz on 2013-04-16

reduce .bzrignore to a minimum.

Approved by PS Jenkins bot, Jussi Pakkanen, Michi Henning.

603. By Michał Sawicz on 2013-04-17

flatten qmluitests and unittests into qmltests to reduce the test management burden.

Approved by PS Jenkins bot, Michael Zanetti.

604. By Michi Henning on 2013-04-17

Minor fixes to doxygen comments.

Approved by PS Jenkins bot.

605. By Michi Henning on 2013-04-18

Moved clean-coverage target from main CMakeLists.txt file to EnableCoverage module.

Approved by Michał Sawicz, PS Jenkins bot.

606. By Albert Astals Cid on 2013-04-18

Split the filterproxymodel in two

Since the limit feature did collide a bit with the rest of the implementation (it even had a qFatal) if you tried to use both

The new QLimitProxyModel inherits from QIdentityProxyModel instead of QSortFilterProxyModel

Adapt the testscases.

Approved by Michael Zanetti, PS Jenkins bot.

607. By Michi Henning on 2013-04-18

Changed script to Python 3 and removed unused variable.

Approved by PS Jenkins bot, Michał Sawicz.

608. By Michi Henning on 2013-04-18

Removed progname global variable.

Approved by PS Jenkins bot, Michał Sawicz, Jussi Pakkanen.

609. By Michael Zanetti on 2013-04-18

added tests for the various filtergrid subclasses.

Approved by PS Jenkins bot, Andrea Cimitan.

610. By Nick Dedekind on 2013-04-18

Added MenuContent tests.

Approved by PS Jenkins bot, Albert Astals Cid.

611. By Michael Zanetti on 2013-04-19

fix import paths of for filtergrid tests.

Approved by PS Jenkins bot, Daniel d'Andrada.

612. By Daniel d'Andrada on 2013-04-19

Purge fakes from QML code.

Instead of having several switches in the qml code to choose between fake
and real implementations of components, provide a fake implementation of
Ubuntu.Application module instead. That way we have a cleaner QML code
that is easier to test and we run exactly the same qml code both on the
target device and under a fake environment.

Approved by Michał Sawicz, PS Jenkins bot.

Ying-Chun Liu (paulliu) wrote :

Need review again.

613. By Michael Zanetti on 2013-04-19

hide static parts of apps dash while searching for apps. Fixes: https://bugs.launchpad.net/bugs/1170495.

Approved by PS Jenkins bot, Michał Sawicz.

614. By Michał Sawicz on 2013-04-22

add TestUtil class with isInstanceOf utility method.

Approved by Albert Astals Cid, PS Jenkins bot.

615. By Nick Dedekind on 2013-04-22

Fake Unity plugin for dash tests.

Approved by PS Jenkins bot, Albert Astals Cid, Andrea Cimitan.

616. By Albert Astals Cid on 2013-04-22

Use findChild instead of property.

Approved by PS Jenkins bot, Michael Zanetti.

617. By Michi Henning on 2013-04-22

generate API docs with doxygen

This change adds support for generating API docs with doxygen. "make doc" generates the documentation. The HTML output is placed into buiilddir/doc/libunity-api.

Approved by Jussi Pakkanen, PS Jenkins bot.

618. By Michi Henning on 2013-04-22

Added tests to check that headers compile stand-alone (that is, include their own dependencies), that no public header includes an internal header, and that source files contain a copyright message.

Approved by PS Jenkins bot, Jussi Pakkanen.

619. By Daniel d'Andrada on 2013-04-22

Close applications using their thumbnails on the Dash

Long-press on a application thumbnail to bring up the close mode
(close icon decorations will pop up). Then tap on the thumbnail
of the application you want to close to close it.

You can dismiss the close/termination mode in two ways:
1 - by long-pressing one of the app thumbnails
2 - by sliding horizontally to another dash.

As there's no design for this feature yet I didn't to go any further/deeper
on it.

Approved by PS Jenkins bot, Albert Astals Cid.

620. By Albert Astals Cid on 2013-04-23

Remove the itemY function, we can just pass the item.y and use it.

Approved by PS Jenkins bot, Michael Zanetti.

621. By Nick Dedekind on 2013-04-23

Adds categories and categoryfilter to the fake unity plugin.

Approved by PS Jenkins bot, Albert Astals Cid.

622. By Michi Henning on 2013-04-23

Added valgrind target to cmake. To suppress valgrind testing for tests that don't need it, add the test to be omitted to CTestCustom.cmake.in.

Approved by PS Jenkins bot, Jussi Pakkanen.

623. By Nick Dedekind on 2013-04-23

Fixed issue where the indicator menus will not open if you do a small swipe on the indicator bar.

Approved by PS Jenkins bot, Michał Sawicz.

624. By Michael Zanetti on 2013-04-23

don't create coverage reports for test plugins and mocks.

Approved by PS Jenkins bot, Michał Sawicz.

625. By Albert Astals Cid on 2013-04-24

For raring we need -s here so that build-dep works
.

Approved by PS Jenkins bot, Michael Zanetti.

626. By Michał Sawicz on 2013-04-24

release 1.72

  * bring greeter closer to desktop design
  * simplify SortFilterProxyModel role management
  * CMake and build script improvements
  * enable volume slider in Overview
  * clean up .bzrignore
  * flatten qmluitests and unittests into generic qmltests
  * split out LimitProxyModel out of SortFilterProxyModel
  * replace fake QML wrappers for Ubuntu.Application with a mock
    implementation
  * hide Frequent and Available categories in Apps lens during search
    (LP: #1170495)
  * add first test utilities
  * use fake Unity plugin for Dash tests
  * generate and package API docs
  * close applications after long-press in dash
  * simplify preview calculation
  * tests for:
    * bad indentation
    * Panel
    * indicators Overview
    * IndicatorItem
    * ListViewWithPageHeader
    * Clock
    * OpenEffect
    * FilterGrids
    * MenuContent
    * header standalone compilation.

Approved by Albert Astals Cid, PS Jenkins bot.

627. By Michael Zanetti on 2013-04-24

fix execution of local autopilot tests.

Approved by PS Jenkins bot, Daniel d'Andrada.

628. By Andrea Cimitan on 2013-04-24

Adds test for LensView.

Approved by PS Jenkins bot, Albert Astals Cid.

Andrea Cimitan (cimi) wrote :

Indentation needs fixes and extra lines to be removed

629. By Albert Astals Cid on 2013-04-25

No need to include lens.h in peoplepreviewdata.h
.

Approved by Ying-Chun Liu, PS Jenkins bot.

Michael Zanetti (mzanetti) wrote :

12 === added file 'tests/qmltests/Panel/Menus/CMakeLists.txt'
16 +add_qml_test(IndicatorMenuWindow)

This CMakeLists.txt file is not needed any more. Delete it.

review: Needs Fixing
Michael Zanetti (mzanetti) wrote :

94 + function test_mouseEvent() {
95 + indicatorMenuWindow.shown=true
96 + tryCompare(indicatorMenuWindow, "opacity", 1.0)
97 +
98 + clickedSpy.clear()
99 + mouseClick(indicatorMenuWindow, indicatorMenuWindow.width / 2,
100 + indicatorMenuWindow.height / 2)
101 + compare(clickedSpy.count, 0,
102 + "Mouse event should be eaten by indicatorMenuWindow")
103 +
104 + indicatorMenuWindow.shown=false
105 + tryCompare(indicatorMenuWindow, "opacity", 0.0)
106 +
107 + clickedSpy.clear()
108 + mouseClick(indicatorMenuWindow, indicatorMenuWindow.width / 2,
109 + indicatorMenuWindow.height / 2)
110 + compare(clickedSpy.count, 1,
111 + "Mouse event should not be eaten by indicatorMenuWindow")
112 + }

I think this would be a perfect candidate for using the _data() mechanism.

Example:

        function test_mouseEvent_data() {
            return [
                {tag: "invisible", shown: true, opacity: 1.0, mouseClicks: 0},
                {tag: "visible", shown: false, opacity: 0.0, mouseClicks: 1},
            ]
        }

        function test_mouseEvent(data) {
            indicatorMenuWindow.shown = data.shown
            tryCompare(indicatorMenuWindow, "opacity", data.opacity)

            clickedSpy.clear()
            mouseClick(indicatorMenuWindow, indicatorMenuWindow.width / 2,
                       indicatorMenuWindow.height / 2)
            compare(clickedSpy.count, data.mouseClicks,
                    "Check for Mouse event eating by indicatorMenuWindow failed")
        }

This way you don't have to copy/paste the test code and the debug output gives better feedback when a test fails.

review: Needs Fixing
630. By Albert Astals Cid on 2013-04-25

Use the new libhud-client.

Approved by PS Jenkins bot, Ricardo Salveti, Ted Gould.

631. By Ricardo Salveti on 2013-04-25

Release 1.73.

Approved by PS Jenkins bot.

632. By Albert Astals Cid on 2013-04-26

Don't force to only have 1 param after --

Otherwise stuff like
    ./run -- -geometry 100x100
doesn't work.

Approved by PS Jenkins bot, Michael Zanetti.

633. By Albert Astals Cid on 2013-04-26

Use the new API that signals models have changed.

Approved by Michael Zanetti, PS Jenkins bot, Ted Gould.

634. By Albert Astals Cid on 2013-04-26

Build hud from the hud upstream
.

Approved by PS Jenkins bot, Michael Zanetti.

635. By Albert Astals Cid on 2013-04-26

Move the -zdefs definition to toplevel and make it applies to modules too
.

Approved by Andrea Cimitan, PS Jenkins bot.

636. By Andrea Cimitan on 2013-04-26

Add tests for the GenericLensView.

Approved by PS Jenkins bot, Albert Astals Cid.

637. By Albert Astals Cid on 2013-04-26

Release 1.74.

Approved by PS Jenkins bot, Ricardo Salveti.

639. By Ying-Chun Liu on 2013-04-12

Line wrapping. Fix indents.

640. By Ying-Chun Liu on 2013-04-18

Test signal is eaten by IndicatorMenuWindow or not.

641. By Ying-Chun Liu on 2013-04-29

use _data to avoid code replication.

642. By Ying-Chun Liu on 2013-04-29

Remove tests/qmltests/Panel/Menus/CMakeLists.txt

Michael Zanetti (mzanetti) wrote :

thanks.

review: Approve
Daniel d'Andrada (dandrader) wrote :

I would use more meaningful names for those rectangles, like backgroundRect and foregroundRect, instead of simply rectangle1 and rectangle2.

Daniel d'Andrada (dandrader) wrote :

> I would use more meaningful names for those rectangles, like backgroundRect
> and foregroundRect, instead of simply rectangle1 and rectangle2.

Or rootRectangle for rectangle1

Daniel d'Andrada (dandrader) wrote :

89 + {tag: "invisible", shown: true, opacity: 1.0, mouseClicks: 0},
90 + {tag: "visible", shown: false, opacity: 0.0, mouseClicks: 1},

Looks like you've swapped the "visible" and "invisible" tags...

Daniel d'Andrada (dandrader) wrote :

By the way, what's the purpose of this red rectangle (id: rectangle2)? It doesn't seem to be used in the tests.
Looks like you can just remove it.

review: Needs Information
Daniel d'Andrada (dandrader) wrote :

Also rectangle1 could be the root item itself. Or maybe even that MouseArea.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/qmltests/CMakeLists.txt'
2--- tests/qmltests/CMakeLists.txt 2013-04-26 10:02:29 +0000
3+++ tests/qmltests/CMakeLists.txt 2013-04-29 16:27:26 +0000
4@@ -56,4 +56,5 @@
5 add_qml_test(Panel Overview)
6 add_qml_test(Panel Panel)
7 add_qml_test(Panel SearchIndicator)
8+add_qml_test(Panel/Menus IndicatorMenuWindow IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS})
9 add_qml_test(SideStage SideStage IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
10
11=== added directory 'tests/qmltests/Panel/Menus'
12=== added file 'tests/qmltests/Panel/Menus/tst_IndicatorMenuWindow.qml'
13--- tests/qmltests/Panel/Menus/tst_IndicatorMenuWindow.qml 1970-01-01 00:00:00 +0000
14+++ tests/qmltests/Panel/Menus/tst_IndicatorMenuWindow.qml 2013-04-29 16:27:26 +0000
15@@ -0,0 +1,90 @@
16+/*
17+ * Copyright 2013 Canonical Ltd.
18+ *
19+ * This program is free software; you can redistribute it and/or modify
20+ * it under the terms of the GNU General Public License as published by
21+ * the Free Software Foundation; version 3.
22+ *
23+ * This program is distributed in the hope that it will be useful,
24+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
25+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26+ * GNU General Public License for more details.
27+ *
28+ * You should have received a copy of the GNU General Public License
29+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
30+ */
31+
32+import QtQuick 2.0
33+import QtTest 1.0
34+import "../.."
35+import "../../../../Panel/Menus"
36+import Ubuntu.Components 0.1
37+import Unity.Test 0.1 as UT
38+
39+Item {
40+ id: testIndicatorMenuWindowItem
41+ width: units.gu(9)
42+ height: units.gu(3)
43+
44+ Rectangle {
45+ id: rectangle1
46+ anchors.fill: parent
47+ signal clicked
48+
49+ MouseArea {
50+ anchors.fill: parent
51+ onClicked: rectangle1.clicked()
52+ }
53+
54+ Rectangle {
55+ anchors.right: rectangle1.right
56+ anchors.left: rectangle1.horizontalCenter
57+ anchors.top: rectangle1.verticalCenter
58+ anchors.bottom: rectangle1.bottom
59+ color: "green"
60+ IndicatorMenuWindow {
61+ id: indicatorMenuWindow
62+ name: "TestIndicatorMenuWindow"
63+ anchors.fill: parent
64+ }
65+ }
66+
67+ Rectangle {
68+ id: rectangle2
69+ color: "red"
70+ anchors.right: rectangle1.horizontalCenter
71+ anchors.left: rectangle1.left
72+ anchors.top: rectangle1.verticalCenter
73+ anchors.bottom: rectangle1.bottom
74+ }
75+
76+ SignalSpy {
77+ id: clickedSpy
78+ target: rectangle1
79+ signalName: "clicked"
80+ }
81+ }
82+
83+ UT.UnityTestCase {
84+ name: "IndicatorMenuWindow"
85+ when: windowShown
86+
87+ function test_mouseEvent_data() {
88+ return [
89+ {tag: "invisible", shown: true, opacity: 1.0, mouseClicks: 0},
90+ {tag: "visible", shown: false, opacity: 0.0, mouseClicks: 1},
91+ ]
92+ }
93+
94+ function test_mouseEvent(data) {
95+ indicatorMenuWindow.shown = data.shown
96+ tryCompare(indicatorMenuWindow, "opacity", data.opacity)
97+
98+ clickedSpy.clear()
99+ mouseClick(indicatorMenuWindow, indicatorMenuWindow.width / 2,
100+ indicatorMenuWindow.height / 2)
101+ compare(clickedSpy.count, data.mouseClicks,
102+ "Check for Mouse event eating by indicatorMenuWindow failed")
103+ }
104+ }
105+}

Subscribers

People subscribed via source and target branches