Changeset View
Changeset View
Standalone View
Standalone View
tests/features/inbox/inboxdraganddropfeature.cpp
- This file was added.
1 | /* This file is part of Zanshin | ||||
---|---|---|---|---|---|
2 | | ||||
3 | Copyright 2019 Kevin Ottens <ervin@kde.org> | ||||
4 | | ||||
5 | This program is free software; you can redistribute it and/or | ||||
6 | modify it under the terms of the GNU General Public License as | ||||
7 | published by the Free Software Foundation; either version 2 of | ||||
8 | the License or (at your option) version 3 or any later version | ||||
9 | accepted by the membership of KDE e.V. (or its successor approved | ||||
10 | by the membership of KDE e.V.), which shall act as a proxy | ||||
11 | defined in Section 14 of version 3 of the license. | ||||
12 | | ||||
13 | This program is distributed in the hope that it will be useful, | ||||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
16 | GNU General Public License for more details. | ||||
17 | | ||||
18 | You should have received a copy of the GNU General Public License | ||||
19 | along with this program; if not, write to the Free Software | ||||
20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||||
21 | USA. | ||||
22 | */ | ||||
23 | | ||||
24 | #include <testlib/qtest_zanshin.h> | ||||
25 | #include <featurelib/zanshincontext.h> | ||||
26 | | ||||
27 | using namespace Testlib; | ||||
28 | | ||||
29 | // Feature: Inbox task association | ||||
30 | // As someone collecting tasks | ||||
31 | // I can associate a task to another one | ||||
32 | // In order to deal with complex tasks requiring several steps | ||||
33 | class InboxDragAndDropFeature : public QObject | ||||
34 | { | ||||
35 | Q_OBJECT | ||||
36 | private slots: | ||||
37 | void Dropping_a_task_on_another_one_makes_it_a_child() | ||||
38 | { | ||||
39 | ZANSHIN_CONTEXT; | ||||
40 | Given(I_display_the_page("Inbox")); | ||||
41 | And(there_is_an_item_in_the_central_list("Buy apples")); | ||||
42 | When(I_drop_the_item_on_the_central_list("Errands")); | ||||
43 | And(I_list_the_items()); | ||||
44 | Then(the_list_is({ | ||||
45 | { "display" }, | ||||
46 | { | ||||
47 | { "Errands" }, | ||||
48 | { "Errands / Buy apples" }, | ||||
49 | { "\"Capital in the Twenty-First Century\" by Thomas Piketty" }, | ||||
50 | { "\"The Pragmatic Programmer\" by Hunt and Thomas" }, | ||||
51 | { "Buy cheese" }, | ||||
52 | { "Buy kiwis" }, | ||||
53 | { "Buy pears" }, | ||||
54 | { "Buy rutabagas" } | ||||
55 | } | ||||
56 | })); | ||||
57 | } | ||||
58 | | ||||
59 | void Dropping_a_child_task_on_the_inbox_makes_it_top_level() | ||||
60 | { | ||||
61 | ZANSHIN_CONTEXT; | ||||
62 | Given(I_display_the_page("Inbox")); | ||||
63 | And(there_is_an_item_in_the_central_list("Buy apples")); | ||||
64 | And(I_drop_the_item_on_the_central_list("Errands")); | ||||
65 | And(there_is_an_item_in_the_central_list("Errands / Buy apples")); | ||||
66 | When(I_drop_the_item_on_the_page_list("Inbox")); | ||||
67 | And(I_list_the_items()); | ||||
68 | Then(the_list_is({ | ||||
69 | { "display" }, | ||||
70 | { | ||||
71 | { "Errands" }, | ||||
72 | { "Buy apples" }, | ||||
73 | { "\"Capital in the Twenty-First Century\" by Thomas Piketty" }, | ||||
74 | { "\"The Pragmatic Programmer\" by Hunt and Thomas" }, | ||||
75 | { "Buy cheese" }, | ||||
76 | { "Buy kiwis" }, | ||||
77 | { "Buy pears" }, | ||||
78 | { "Buy rutabagas" } | ||||
79 | } | ||||
80 | })); | ||||
81 | } | ||||
82 | | ||||
83 | void Dropping_two_tasks_on_another_one_makes_them_children() | ||||
84 | { | ||||
85 | ZANSHIN_CONTEXT; | ||||
86 | Given(I_display_the_page("Inbox")); | ||||
87 | And(the_central_list_contains_items_named({"Buy apples", "Buy pears"})); | ||||
88 | When(I_drop_items_on_the_central_list("Errands")); | ||||
89 | And(I_list_the_items()); | ||||
90 | Then(the_list_is({ | ||||
91 | { "display" }, | ||||
92 | { | ||||
93 | { "Errands" }, | ||||
94 | { "Errands / Buy apples" }, | ||||
95 | { "Errands / Buy pears" }, | ||||
96 | { "\"Capital in the Twenty-First Century\" by Thomas Piketty" }, | ||||
97 | { "\"The Pragmatic Programmer\" by Hunt and Thomas" }, | ||||
98 | { "Buy cheese" }, | ||||
99 | { "Buy kiwis" }, | ||||
100 | { "Buy rutabagas" } | ||||
101 | } | ||||
102 | })); | ||||
103 | } | ||||
104 | | ||||
105 | void Dropping_two_child_tasks_on_the_inbox_makes_them_top_level() | ||||
106 | { | ||||
107 | ZANSHIN_CONTEXT; | ||||
108 | Given(I_display_the_page("Inbox")); | ||||
109 | And(the_central_list_contains_items_named({"Buy apples", "Buy pears"})); | ||||
110 | And(I_drop_items_on_the_central_list("Errands")); | ||||
111 | And(the_central_list_contains_items_named({"Errands / Buy apples", "Errands / Buy pears"})); | ||||
112 | When(I_drop_items_on_the_page_list("Inbox")); | ||||
113 | And(I_list_the_items()); | ||||
114 | Then(the_list_is({ | ||||
115 | { "display" }, | ||||
116 | { | ||||
117 | { "Errands" }, | ||||
118 | { "Buy apples" }, | ||||
119 | { "\"Capital in the Twenty-First Century\" by Thomas Piketty" }, | ||||
120 | { "\"The Pragmatic Programmer\" by Hunt and Thomas" }, | ||||
121 | { "Buy cheese" }, | ||||
122 | { "Buy kiwis" }, | ||||
123 | { "Buy pears" }, | ||||
124 | { "Buy rutabagas" } | ||||
125 | } | ||||
126 | })); | ||||
127 | } | ||||
128 | | ||||
129 | void Dropping_a_task_on_the_inbox_removes_it_from_its_associated_project() | ||||
130 | { | ||||
131 | ZANSHIN_CONTEXT; | ||||
132 | Given(I_display_the_page("Projects / TestData » Calendar1 / Prepare talk about TDD")); | ||||
133 | And(there_is_an_item_in_the_central_list("Create Sozi SVG")); | ||||
134 | When(I_drop_the_item_on_the_page_list("Inbox")); | ||||
135 | And(I_display_the_page("Inbox")); | ||||
136 | And(I_look_at_the_central_list()); | ||||
137 | And(I_list_the_items()); | ||||
138 | Then(the_list_is({ | ||||
139 | { "display" }, | ||||
140 | { | ||||
141 | { "Errands" }, | ||||
142 | { "Buy apples" }, | ||||
143 | { "\"Capital in the Twenty-First Century\" by Thomas Piketty" }, | ||||
144 | { "\"The Pragmatic Programmer\" by Hunt and Thomas" }, | ||||
145 | { "Buy cheese" }, | ||||
146 | { "Buy kiwis" }, | ||||
147 | { "Buy pears" }, | ||||
148 | { "Buy rutabagas" }, | ||||
149 | { "Create Sozi SVG" } | ||||
150 | } | ||||
151 | })); | ||||
152 | } | ||||
153 | | ||||
154 | void Deparenting_a_task_by_dropping_on_the_central_list_blank_area() | ||||
155 | { | ||||
156 | ZANSHIN_CONTEXT; | ||||
157 | Given(I_display_the_page("Inbox")); | ||||
158 | And(I_look_at_the_central_list()); | ||||
159 | And(there_is_an_item_in_the_central_list("Buy apples")); | ||||
160 | And(I_drop_the_item_on_the_central_list("Errands")); | ||||
161 | And(I_look_at_the_central_list()); | ||||
162 | And(there_is_an_item_in_the_central_list("Errands / Buy apples")); | ||||
163 | When(I_drop_the_item_on_the_blank_area_of_the_central_list()); | ||||
164 | And(I_list_the_items()); | ||||
165 | Then(the_list_is({ | ||||
166 | { "display" }, | ||||
167 | { | ||||
168 | { "Errands" }, | ||||
169 | { "Buy apples" }, | ||||
170 | { "\"Capital in the Twenty-First Century\" by Thomas Piketty" }, | ||||
171 | { "\"The Pragmatic Programmer\" by Hunt and Thomas" }, | ||||
172 | { "Buy cheese" }, | ||||
173 | { "Buy kiwis" }, | ||||
174 | { "Buy pears" }, | ||||
175 | { "Buy rutabagas" } | ||||
176 | } | ||||
177 | })); | ||||
178 | } | ||||
179 | | ||||
180 | void Dropping_a_task_on_the_inbox_removes_it_from_all_its_contexts() | ||||
181 | { | ||||
182 | ZANSHIN_CONTEXT; | ||||
183 | Given(I_display_the_page("Contexts / Errands")); | ||||
184 | And(there_is_an_item_in_the_central_list("Buy kiwis")); | ||||
185 | When(I_drop_the_item_on_the_page_list("Inbox")); | ||||
186 | And(I_display_the_page("Contexts / Errands")); | ||||
187 | And(I_look_at_the_central_list()); | ||||
188 | Then(the_list_does_not_contain("Buy kiwis")); | ||||
189 | } | ||||
190 | }; | ||||
191 | | ||||
192 | ZANSHIN_TEST_MAIN(InboxDragAndDropFeature) | ||||
193 | | ||||
194 | #include "inboxdraganddropfeature.moc" |