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: Data sources selection
0014 //   As an advanced user
0015 //   I can select or deselect sources
0016 //   In order to see more or less content
0017 class DatasourceSelectionFeature : public QObject
0018 {
0019     Q_OBJECT
0020 private slots:
0021     void Unchecking_impacts_the_inbox()
0022     {
0023         ZanshinContext c;
0024         Given(c.I_display_the_page("Inbox"));
0025         And(c.there_is_an_item_in_the_available_data_sources("TestData / Calendar1"));
0026         When(c.I_uncheck_the_item());
0027         And(c.I_look_at_the_central_list());
0028         And(c.I_list_the_items());
0029         Then(c.the_list_is({
0030                              { "display" },
0031                              {
0032                                  { "Buy apples" },
0033                                  { "Buy pears" },
0034                                  { "Errands" },
0035                              }
0036                          }));
0037     }
0038 
0039     void Checking_impacts_the_inbox()
0040     {
0041         ZanshinContext c;
0042         Given(c.I_display_the_page("Inbox"));
0043         And(c.there_is_an_item_in_the_available_data_sources("TestData / Calendar1"));
0044         When(c.I_check_the_item());
0045         And(c.I_look_at_the_central_list());
0046         And(c.I_list_the_items());
0047         Then(c.the_list_is({
0048                              { "display" },
0049                              {
0050                                  { "\"Capital in the Twenty-First Century\" by Thomas Piketty" },
0051                                  { "\"The Pragmatic Programmer\" by Hunt and Thomas" },
0052                                  { "Buy cheese" },
0053                                  { "Buy kiwis" },
0054                                  { "Buy apples" },
0055                                  { "Buy pears" },
0056                                  { "Errands" },
0057                                  { "Buy rutabagas" },
0058                              }
0059                          }));
0060     }
0061 
0062     void Unchecking_impacts_project_list()
0063     {
0064         ZanshinContext c;
0065         Given(c.there_is_an_item_in_the_available_data_sources("TestData / Calendar1"));
0066         When(c.I_uncheck_the_item());
0067         And(c.I_display_the_available_pages());
0068         And(c.I_list_the_items());
0069         Then(c.the_list_is({
0070                              { "display" },
0071                              {
0072                                  { "Inbox" },
0073                                  { "Workday" },
0074                                  { "Projects" },
0075                                  { "Projects / TestData » Calendar1 » Calendar2" },
0076                                  { "Projects / TestData » Calendar1 » Calendar2 / Backlog" },
0077                                  { "Contexts" },
0078                                  { "Contexts / Errands" },
0079                                  { "Contexts / Online" },
0080                                  { "All Tasks" },
0081                              }
0082                          }));
0083     }
0084 
0085     void Checking_impacts_project_list()
0086     {
0087         ZanshinContext c;
0088         Given(c.there_is_an_item_in_the_available_data_sources("TestData / Calendar1"));
0089         When(c.I_check_the_item());
0090         And(c.I_display_the_available_pages());
0091         And(c.I_list_the_items());
0092         Then(c.the_list_is({
0093                              { "display" },
0094                              {
0095                                  { "Inbox" },
0096                                  { "Workday" },
0097                                  { "Projects" },
0098                                  { "Projects / TestData » Calendar1" },
0099                                  { "Projects / TestData » Calendar1 / Prepare talk about TDD" },
0100                                  { "Projects / TestData » Calendar1 / Read List" },
0101                                  { "Projects / TestData » Calendar1 » Calendar2" },
0102                                  { "Projects / TestData » Calendar1 » Calendar2 / Backlog" },
0103                                  { "Contexts" },
0104                                  { "Contexts / Errands" },
0105                                  { "Contexts / Online" },
0106                                  { "All Tasks" },
0107                              }
0108                          }));
0109     }
0110 };
0111 
0112 ZANSHIN_TEST_MAIN(DatasourceSelectionFeature)
0113 
0114 #include "datasourceselectionfeature.moc"