=== modified file 'tests/autopilot/notes_app/tests/test_expand_collapse.py'
--- tests/autopilot/notes_app/tests/test_expand_collapse.py	2013-12-11 17:29:27 +0000
+++ tests/autopilot/notes_app/tests/test_expand_collapse.py	2014-03-11 18:33:19 +0000
@@ -1,5 +1,5 @@
 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
-# Copyright 2013 Canonical
+# Copyright 2014 Canonical
 #
 # This program is free software: you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 3, as published
@@ -9,9 +9,6 @@
 
 from __future__ import absolute_import
 
-from testtools.matchers import Equals
-from autopilot.matchers import Eventually
-
 from notes_app.tests import NotesAppTestCase
 
 import sqlite3
@@ -44,25 +41,6 @@
         conn.commit()
         conn.close()
 
-    def test_expand_and_collapse_many(self):
-        notes = self.main_window.get_notes()
-        first = notes[0]
-        second = notes[1]
-
-        self.assert_note_eventually_collapsed(first)
-        self.assert_note_eventually_collapsed(second)
-
-        self.pointing_device.click_object(first)
-        self.assert_note_eventually_expanded(first)
-
-        self.pointing_device.click_object(second)
-        self.assert_note_eventually_collapsed(first)
-        self.assert_note_eventually_expanded(second)
-
-        self.pointing_device.click_object(first)
-        self.assert_note_eventually_expanded(first)
-        self.assert_note_eventually_collapsed(second)
-
     def test_collapse_header(self):
         first = self.main_window.get_notes()[0]
         header = self.main_window.get_header()

=== added directory 'tests/qml'
=== added file 'tests/qml/tst_NoteList.qml'
--- tests/qml/tst_NoteList.qml	1970-01-01 00:00:00 +0000
+++ tests/qml/tst_NoteList.qml	2014-03-11 18:33:19 +0000
@@ -0,0 +1,120 @@
+/*
+ * Copyright 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 <http://www.gnu.org/licenses/>.
+ */
+
+import QtQuick 2.0
+import QtTest 1.0
+
+import '../../Components/'
+
+
+Item {
+    width: units.gu(40)
+    height: units.gu(40)
+
+    ListModel {
+        id: mockModel
+
+        ListElement {
+            note: 'Test0'
+            date: 'test date 0'
+        }
+        ListElement {
+            note: 'Test1'
+            date: 'test date 1'
+        }
+    }
+
+    ListModel {
+        // dummy data model.
+        id: dataModel
+
+        function touchNote(index, note) { }
+    }
+
+    NoteList {
+        id: noteList
+        anchors.fill: parent
+        model: mockModel
+    }
+
+    TestCase {
+        id: noteListTestCase
+        name: 'noteListTestCase'
+
+        when: windowShown
+
+        function init() {
+            waitForRendering(noteList);
+        }
+
+        function cleanup() {
+            // Make sure all the notes that were expanded are collapsed.
+            clickOutsideNotes();
+        }
+
+        function clickOutsideNotes() {
+            var spaceBetweenNotesHeight = noteList.contentItem.children[0].height
+                - noteList.contentItem.children[1].y;
+            mouseClick(noteList, noteList.width/2,
+                       noteList.contentItem.children[0].height - spaceBetweenNotesHeight / 2);
+        }
+
+        function test_noteStartsCollapsed_data() {
+            return getNotesScenarios()
+        }
+
+        function getNotesScenarios() {
+            var data = new Array();
+            for (var i = 0; i < noteList.count; i++) {
+                data.push({tag: "index" + i, index: i});
+            }
+            return data;
+        }
+
+        function test_noteStartsCollapsed(data) {
+            var note = noteList.contentItem.children[data.index];
+            compare(note.isExpanded, false);
+            tryCompare(note, 'height', units.gu(11));
+        }
+
+        function test_clickNoteMustExpandIt() {
+            var note = noteList.contentItem.children[0];
+            mouseClick(note, note.width/2, note.height/2);
+            compare(note.isExpanded, true);
+            tryCompare(note, 'height', units.gu(24));
+            compare(noteList.contentItem.children[1].isExpanded, false,
+                    'Only note 0 should expand when clicking note 0')
+        }
+
+        function test_clickOtherNoteMustCollapseCurrentlyExpandedNote_data() {
+            return getNotesScenarios()
+        }
+
+        function test_clickOtherNoteMustCollapseCurrentlyExpandedNote(data) {
+            var initiallyExpandedNote = noteList.contentItem.children[data.index];
+            mouseClick(initiallyExpandedNote, initiallyExpandedNote.width/2,
+                       initiallyExpandedNote.height/2);
+
+            var noteToExpand = noteList.contentItem.children[(data.index + 1) % noteList.count];
+
+            mouseClick(noteToExpand, noteToExpand.width/2, noteToExpand.height/2);
+
+            compare(initiallyExpandedNote.isExpanded, false);
+            compare(noteToExpand.isExpanded, true);
+        }
+
+    }
+}

