File indexing completed on 2025-03-09 04:56:51

0001 /*
0002  * SPDX-FileCopyrightText: 2019 Kevin Ottens <ervin@kde.org>
0003    SPDX-FileCopyrightText: 2019 David Faure <faure@kde.org>
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 
0008 #include <testlib/qtest_zanshin.h>
0009 #include <featurelib/zanshincontext.h>
0010 
0011 using namespace Testlib;
0012 
0013 // Feature: Context task dissociation
0014 //   As someone collecting tasks
0015 //   I can delete a task related to a context
0016 //   In order to keep my context meaningful
0017 class ContextTaskRemoveFeature : public QObject
0018 {
0019     Q_OBJECT
0020 private slots:
0021     void Removing_a_task_from_a_context_keeps_it_in_the_project_page_it_s_linked_to()
0022     {
0023         ZanshinContext c;
0024         Given(c.I_display_the_page("Projects / TestData » Calendar1 / Prepare talk about TDD"));
0025         And(c.there_is_an_item_in_the_central_list("Create examples and exercices"));
0026         And(c.I_drop_the_item_on_the_page_list("Contexts / Online"));
0027         And(c.I_display_the_page("Contexts / Online"));
0028         And(c.there_is_an_item_in_the_central_list("Create examples and exercices"));
0029         When(c.I_remove_the_item());
0030         And(c.I_look_at_the_central_list());
0031         Then(c.the_list_does_not_contain("Create examples and exercices"));
0032         And(c.I_display_the_page("Projects / TestData » Calendar1 / Prepare talk about TDD"));
0033         Then(c.there_is_an_item_in_the_central_list("Create examples and exercices"));
0034     }
0035 
0036     void Removing_a_task_linked_only_to_a_context_moves_it_back_to_the_inbox()
0037     {
0038         ZanshinContext c;
0039         Given(c.I_display_the_page("Inbox"));
0040         And(c.I_look_at_the_central_list());
0041         Then(c.the_list_is({
0042                              { "display" },
0043                              {
0044                              }
0045                          }));
0046         And(c.I_display_the_page("Contexts / Errands"));
0047         And(c.there_is_an_item_in_the_central_list("Buy kiwis"));
0048         When(c.I_remove_the_item());
0049         And(c.I_look_at_the_central_list());
0050         Then(c.the_list_does_not_contain("Buy kiwis"));
0051         And(c.I_display_the_page("Inbox"));
0052         Then(c.there_is_an_item_in_the_central_list("Buy kiwis"));
0053     }
0054 };
0055 
0056 ZANSHIN_TEST_MAIN(ContextTaskRemoveFeature)
0057 
0058 #include "contexttaskremovefeature.moc"