File indexing completed on 2025-01-19 04:56:43

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: Drag and drop a task in workday view
0014 //   As someone reviewing his tasks in the workday view
0015 //   I can drag task within the workday view
0016 //   In order to change parent/child relationships
0017 class WorkdayDragAndDropFeature : public QObject
0018 {
0019     Q_OBJECT
0020 private slots:
0021     void Parenting_a_task_in_the_Workday_page()
0022     {
0023         ZanshinContext c;
0024         Given(c.I_display_the_page("Workday"));
0025         And(c.I_add_a_task("parent"));
0026         And(c.I_add_a_task("child"));
0027         And(c.there_is_an_item_in_the_central_list("parent"));
0028         And(c.there_is_an_item_in_the_central_list("child"));
0029         When(c.I_drop_the_item_on_the_central_list("parent"));
0030         And(c.I_look_at_the_central_list());
0031         And(c.I_list_the_items());
0032         Then(c.the_central_list_contains_items_named({
0033                                  "parent",
0034                                  "parent / child",
0035                              }));
0036     }
0037 
0038     void Deparenting_a_task_in_the_Workday_page()
0039     {
0040         ZanshinContext c;
0041         Given(c.I_display_the_page("Workday"));
0042         And(c.I_add_a_task("parent"));
0043         And(c.there_is_an_item_in_the_central_list("parent"));
0044         And(c.I_add_a_task_child("child", "parent"));
0045         And(c.there_is_an_item_in_the_central_list("parent / child"));
0046         When(c.I_drop_the_item_on_the_blank_area_of_the_central_list());
0047         And(c.I_look_at_the_central_list());
0048         And(c.I_list_the_items());
0049         QEXPECT_FAIL("", "Setting the date during deparenting is broken, see the TODO in workdaypagemodel.cpp", Continue);
0050         Then(c.the_central_list_contains_items_named({
0051                                  "parent",
0052                                  "child",
0053                              }));
0054     }
0055 };
0056 
0057 ZANSHIN_TEST_MAIN(WorkdayDragAndDropFeature)
0058 
0059 #include "workdaydraganddropfeature.moc"