2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2022 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
|
|
|
|
|
#include "test-utilities.h"
|
|
|
|
|
|
|
|
|
|
#include "presetmodel.h"
|
|
|
|
|
|
|
|
|
|
using namespace StudioWelcome;
|
|
|
|
|
using ::testing::ElementsAre;
|
|
|
|
|
using ::testing::ElementsAreArray;
|
|
|
|
|
using ::testing::PrintToString;
|
|
|
|
|
|
|
|
|
|
namespace StudioWelcome {
|
2022-02-23 15:32:34 +02:00
|
|
|
|
|
|
|
|
void PrintTo(const UserPresetItem &item, std::ostream *os);
|
|
|
|
|
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
void PrintTo(const PresetItem &item, std::ostream *os)
|
2022-02-23 15:32:34 +02:00
|
|
|
{
|
|
|
|
|
if (typeid(item) == typeid(UserPresetItem)) {
|
|
|
|
|
PrintTo((UserPresetItem &) item, os);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*os << "{categId: " << item.categoryId << ", "
|
|
|
|
|
<< "name: " << item.wizardName;
|
|
|
|
|
|
|
|
|
|
if (!item.screenSizeName.isEmpty())
|
|
|
|
|
*os << ", size: " << item.screenSizeName;
|
|
|
|
|
|
|
|
|
|
*os << "}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PrintTo(const UserPresetItem &item, std::ostream *os)
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
{
|
|
|
|
|
*os << "{categId: " << item.categoryId << ", "
|
2022-02-23 15:32:34 +02:00
|
|
|
<< "name: " << item.wizardName << ", "
|
|
|
|
|
<< "user name: " << item.userName;
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
|
|
|
|
|
if (!item.screenSizeName.isEmpty())
|
|
|
|
|
*os << ", size: " << item.screenSizeName;
|
|
|
|
|
|
|
|
|
|
*os << "}";
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-23 15:32:34 +02:00
|
|
|
void PrintTo(const std::shared_ptr<PresetItem> &p, std::ostream *os)
|
|
|
|
|
{
|
|
|
|
|
if (p)
|
|
|
|
|
PrintTo(*p, os);
|
|
|
|
|
else
|
|
|
|
|
*os << "{null}";
|
|
|
|
|
}
|
|
|
|
|
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
} // namespace StudioWelcome
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
std::pair<QString, WizardCategory> aCategory(const QString &categId,
|
|
|
|
|
const QString &categName,
|
|
|
|
|
const std::vector<QString> &names)
|
|
|
|
|
{
|
2022-02-23 15:32:34 +02:00
|
|
|
std::vector<std::shared_ptr<PresetItem>> items
|
|
|
|
|
= Utils::transform(names, [&categId](const QString &name) {
|
|
|
|
|
std::shared_ptr<PresetItem> item{new PresetItem};
|
|
|
|
|
item->wizardName = name;
|
|
|
|
|
item->categoryId = categId;
|
|
|
|
|
|
|
|
|
|
return item;
|
|
|
|
|
});
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
return std::make_pair(categId, WizardCategory{categId, categName, items});
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-23 15:32:34 +02:00
|
|
|
UserPresetData aUserPreset(const QString &categId, const QString &wizardName, const QString &userName)
|
|
|
|
|
{
|
|
|
|
|
UserPresetData preset;
|
|
|
|
|
preset.categoryId = categId;
|
|
|
|
|
preset.wizardName = wizardName;
|
|
|
|
|
preset.name = userName;
|
|
|
|
|
|
|
|
|
|
return preset;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-21 23:18:59 +02:00
|
|
|
UserPresetData aRecentPreset(const QString &categId, const QString &wizardName, const QString &screenSizeName)
|
|
|
|
|
{
|
|
|
|
|
UserPresetData preset = aUserPreset(categId, wizardName, wizardName);
|
|
|
|
|
preset.screenSize = screenSizeName;
|
|
|
|
|
|
|
|
|
|
return preset;
|
|
|
|
|
}
|
|
|
|
|
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
MATCHER_P2(PresetIs, category, name, PrintToString(PresetItem{name, category}))
|
|
|
|
|
{
|
2022-02-23 15:32:34 +02:00
|
|
|
return arg->categoryId == category && arg->wizardName == name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MATCHER_P3(UserPresetIs,
|
|
|
|
|
category,
|
|
|
|
|
wizardName,
|
|
|
|
|
userName,
|
|
|
|
|
PrintToString(UserPresetItem{wizardName, userName, category}))
|
|
|
|
|
{
|
|
|
|
|
auto userPreset = dynamic_cast<UserPresetItem *>(arg.get());
|
|
|
|
|
|
|
|
|
|
return userPreset->categoryId == category && userPreset->wizardName == wizardName
|
|
|
|
|
&& userPreset->userName == userName;
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MATCHER_P3(PresetIs, category, name, size, PrintToString(PresetItem{name, category, size}))
|
|
|
|
|
{
|
2022-02-23 15:32:34 +02:00
|
|
|
return arg->categoryId == category && arg->wizardName == name && size == arg->screenSizeName;
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
/******************* TESTS *******************/
|
|
|
|
|
|
|
|
|
|
TEST(QdsPresetModel, whenHaveNoPresetsNoRecentsReturnEmpty)
|
|
|
|
|
{
|
|
|
|
|
PresetData data;
|
|
|
|
|
|
|
|
|
|
ASSERT_THAT(data.presets(), SizeIs(0));
|
|
|
|
|
ASSERT_THAT(data.categories(), SizeIs(0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(QdsPresetModel, haveSameArraySizeForPresetsAndCategories)
|
|
|
|
|
{
|
|
|
|
|
PresetData data;
|
|
|
|
|
|
|
|
|
|
data.setData(
|
2022-03-21 23:18:59 +02:00
|
|
|
/*wizard presets*/
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
{
|
|
|
|
|
aCategory("A.categ", "A", {"item a", "item b"}),
|
|
|
|
|
aCategory("B.categ", "B", {"item c", "item d"}),
|
|
|
|
|
},
|
2022-02-23 15:32:34 +02:00
|
|
|
{/*user presets*/},
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
{/*recents*/});
|
|
|
|
|
|
|
|
|
|
ASSERT_THAT(data.presets(), SizeIs(2));
|
|
|
|
|
ASSERT_THAT(data.categories(), SizeIs(2));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(QdsPresetModel, haveWizardPresetsNoRecents)
|
|
|
|
|
{
|
|
|
|
|
// Given
|
|
|
|
|
PresetData data;
|
|
|
|
|
|
|
|
|
|
// When
|
|
|
|
|
data.setData(
|
2022-03-21 23:18:59 +02:00
|
|
|
/*wizard presets*/
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
{
|
|
|
|
|
aCategory("A.categ", "A", {"item a", "item b"}),
|
|
|
|
|
aCategory("B.categ", "B", {"item c", "item d"}),
|
|
|
|
|
},
|
2022-02-23 15:32:34 +02:00
|
|
|
{/*user presets*/},
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
{/*recents*/});
|
|
|
|
|
|
|
|
|
|
// Then
|
|
|
|
|
ASSERT_THAT(data.categories(), ElementsAre("A", "B"));
|
|
|
|
|
ASSERT_THAT(data.presets()[0],
|
|
|
|
|
ElementsAre(PresetIs("A.categ", "item a"), PresetIs("A.categ", "item b")));
|
|
|
|
|
ASSERT_THAT(data.presets()[1],
|
|
|
|
|
ElementsAre(PresetIs("B.categ", "item c"), PresetIs("B.categ", "item d")));
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-23 15:32:34 +02:00
|
|
|
TEST(QdsPresetModel, whenHaveUserPresetsButNoWizardPresetsReturnEmpty)
|
|
|
|
|
{
|
|
|
|
|
// Given
|
|
|
|
|
PresetData data;
|
|
|
|
|
|
|
|
|
|
// When
|
|
|
|
|
data.setData({/*builtin presets*/},
|
2022-03-21 23:18:59 +02:00
|
|
|
/*user presets*/
|
2022-02-23 15:32:34 +02:00
|
|
|
{
|
|
|
|
|
aUserPreset("A.Mobile", "Scroll", "iPhone5"),
|
|
|
|
|
aUserPreset("B.Desktop", "Launcher", "MacBook"),
|
|
|
|
|
},
|
|
|
|
|
{/*recents*/});
|
|
|
|
|
|
|
|
|
|
// Then
|
|
|
|
|
ASSERT_THAT(data.categories(), IsEmpty());
|
|
|
|
|
ASSERT_THAT(data.presets(), IsEmpty());
|
|
|
|
|
}
|
|
|
|
|
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
TEST(QdsPresetModel, haveRecentsNoWizardPresets)
|
|
|
|
|
{
|
|
|
|
|
PresetData data;
|
|
|
|
|
|
|
|
|
|
data.setData({/*wizardPresets*/},
|
2022-02-23 15:32:34 +02:00
|
|
|
{/*user presets*/},
|
2022-03-21 23:18:59 +02:00
|
|
|
/*recent presets*/
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
{
|
2022-03-21 23:18:59 +02:00
|
|
|
aRecentPreset("A.categ", "Desktop", "640 x 480"),
|
|
|
|
|
aRecentPreset("B.categ", "Mobile", "800 x 600"),
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
ASSERT_THAT(data.categories(), IsEmpty());
|
|
|
|
|
ASSERT_THAT(data.presets(), IsEmpty());
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-23 15:32:34 +02:00
|
|
|
TEST(QdsPresetModel, recentsAddedWithWizardPresets)
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
{
|
|
|
|
|
// Given
|
|
|
|
|
PresetData data;
|
|
|
|
|
|
|
|
|
|
// When
|
|
|
|
|
data.setData(
|
|
|
|
|
/*wizard presets*/
|
|
|
|
|
{
|
|
|
|
|
aCategory("A.categ", "A", {"Desktop", "item b"}),
|
|
|
|
|
aCategory("B.categ", "B", {"item c", "Mobile"}),
|
|
|
|
|
},
|
2022-02-23 15:32:34 +02:00
|
|
|
{/*user presets*/},
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
/*recents*/
|
|
|
|
|
{
|
2022-03-21 23:18:59 +02:00
|
|
|
aRecentPreset("A.categ", "Desktop", "800 x 600"),
|
|
|
|
|
aRecentPreset("B.categ", "Mobile", "640 x 480"),
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Then
|
|
|
|
|
ASSERT_THAT(data.categories(), ElementsAre("Recents", "A", "B"));
|
|
|
|
|
|
|
|
|
|
ASSERT_THAT(data.presets(),
|
|
|
|
|
ElementsAreArray(
|
|
|
|
|
{ElementsAre(PresetIs("A.categ", "Desktop"), PresetIs("B.categ", "Mobile")),
|
|
|
|
|
|
|
|
|
|
ElementsAre(PresetIs("A.categ", "Desktop"), PresetIs("A.categ", "item b")),
|
|
|
|
|
ElementsAre(PresetIs("B.categ", "item c"), PresetIs("B.categ", "Mobile"))}));
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-23 15:32:34 +02:00
|
|
|
TEST(QdsPresetModel, userPresetsAddedWithWizardPresets)
|
|
|
|
|
{
|
|
|
|
|
// Given
|
|
|
|
|
PresetData data;
|
|
|
|
|
|
|
|
|
|
// When
|
|
|
|
|
data.setData(
|
|
|
|
|
/*wizard presets*/
|
|
|
|
|
{
|
|
|
|
|
aCategory("A.categ", "A", {"Desktop", "item b"}),
|
|
|
|
|
aCategory("B.categ", "B", {"Mobile"}),
|
|
|
|
|
},
|
2022-03-21 23:18:59 +02:00
|
|
|
/*user presets*/
|
2022-02-23 15:32:34 +02:00
|
|
|
{
|
|
|
|
|
aUserPreset("A.categ", "Desktop", "Windows10"),
|
|
|
|
|
},
|
|
|
|
|
{/*recents*/});
|
|
|
|
|
|
|
|
|
|
// Then
|
|
|
|
|
ASSERT_THAT(data.categories(), ElementsAre("A", "B", "Custom"));
|
|
|
|
|
ASSERT_THAT(data.presets(),
|
|
|
|
|
ElementsAre(ElementsAre(PresetIs("A.categ", "Desktop"),
|
|
|
|
|
PresetIs("A.categ", "item b")),
|
|
|
|
|
ElementsAre(PresetIs("B.categ", "Mobile")),
|
|
|
|
|
ElementsAre(UserPresetIs("A.categ", "Desktop", "Windows10"))));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(QdsPresetModel, doesNotAddUserPresetsOfNonExistingCategory)
|
|
|
|
|
{
|
|
|
|
|
// Given
|
|
|
|
|
PresetData data;
|
|
|
|
|
|
|
|
|
|
// When
|
|
|
|
|
data.setData(
|
|
|
|
|
/*wizard presets*/
|
|
|
|
|
{
|
|
|
|
|
aCategory("A.categ", "A", {"Desktop"}), // Only category "A.categ" exists
|
|
|
|
|
},
|
2022-03-21 23:18:59 +02:00
|
|
|
/*user presets*/
|
2022-02-23 15:32:34 +02:00
|
|
|
{
|
|
|
|
|
aUserPreset("Bad.Categ", "Desktop", "Windows8"), // Bad.Categ does not exist
|
|
|
|
|
},
|
|
|
|
|
{/*recents*/});
|
|
|
|
|
|
|
|
|
|
// Then
|
|
|
|
|
ASSERT_THAT(data.categories(), ElementsAre("A"));
|
|
|
|
|
ASSERT_THAT(data.presets(), ElementsAre(ElementsAre(PresetIs("A.categ", "Desktop"))));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(QdsPresetModel, doesNotAddUserPresetIfWizardPresetItRefersToDoesNotExist)
|
|
|
|
|
{
|
|
|
|
|
// Given
|
|
|
|
|
PresetData data;
|
|
|
|
|
|
|
|
|
|
// When
|
|
|
|
|
data.setData(
|
|
|
|
|
/*wizard presets*/
|
|
|
|
|
{
|
|
|
|
|
aCategory("A.categ", "A", {"Desktop"}),
|
|
|
|
|
},
|
2022-03-21 23:18:59 +02:00
|
|
|
/*user presets*/
|
2022-02-23 15:32:34 +02:00
|
|
|
{
|
|
|
|
|
aUserPreset("B.categ", "BadWizard", "Tablet"), // BadWizard referenced does not exist
|
|
|
|
|
},
|
|
|
|
|
{/*recents*/});
|
|
|
|
|
|
|
|
|
|
// Then
|
|
|
|
|
ASSERT_THAT(data.categories(), ElementsAre("A"));
|
|
|
|
|
ASSERT_THAT(data.presets(), ElementsAre(ElementsAre(PresetIs("A.categ", "Desktop"))));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(QdsPresetModel, userPresetWithSameNameAsWizardPreset)
|
|
|
|
|
{
|
|
|
|
|
// Given
|
|
|
|
|
PresetData data;
|
|
|
|
|
|
|
|
|
|
// When
|
|
|
|
|
data.setData(
|
|
|
|
|
/*wizard presets*/
|
|
|
|
|
{
|
|
|
|
|
aCategory("A.categ", "A", {"Desktop"}),
|
|
|
|
|
},
|
2022-03-21 23:18:59 +02:00
|
|
|
/*user presets*/
|
2022-02-23 15:32:34 +02:00
|
|
|
{
|
|
|
|
|
aUserPreset("A.categ", "Desktop", "Desktop"),
|
|
|
|
|
},
|
|
|
|
|
{/*recents*/});
|
|
|
|
|
|
|
|
|
|
// Then
|
|
|
|
|
ASSERT_THAT(data.categories(), ElementsAre("A", "Custom"));
|
|
|
|
|
ASSERT_THAT(data.presets(),
|
|
|
|
|
ElementsAre(ElementsAre(PresetIs("A.categ", "Desktop")),
|
|
|
|
|
ElementsAre(UserPresetIs("A.categ", "Desktop", "Desktop"))));
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-21 23:18:59 +02:00
|
|
|
TEST(QdsPresetModel, recentOfNonExistentWizardPreset)
|
2022-03-08 15:09:49 +02:00
|
|
|
{
|
|
|
|
|
// Given
|
|
|
|
|
PresetData data;
|
|
|
|
|
|
|
|
|
|
// When
|
|
|
|
|
data.setData(
|
|
|
|
|
/*wizard presets*/
|
|
|
|
|
{
|
|
|
|
|
aCategory("A.categ", "A", {"Desktop"}),
|
|
|
|
|
},
|
2022-03-21 23:18:59 +02:00
|
|
|
{/*user presets*/},
|
2022-03-08 15:09:49 +02:00
|
|
|
/*recents*/
|
|
|
|
|
{
|
2022-03-21 23:18:59 +02:00
|
|
|
aRecentPreset("A.categ", "Windows 7", "200 x 300")
|
2022-03-08 15:09:49 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Then
|
|
|
|
|
ASSERT_THAT(data.categories(), ElementsAre("A"));
|
|
|
|
|
ASSERT_THAT(data.presets(), ElementsAre(ElementsAre(PresetIs("A.categ", "Desktop"))));
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-21 23:18:59 +02:00
|
|
|
TEST(QdsPresetModel, recentsShouldNotBeSorted)
|
2022-03-08 15:09:49 +02:00
|
|
|
{
|
|
|
|
|
// Given
|
|
|
|
|
PresetData data;
|
|
|
|
|
|
|
|
|
|
// When
|
|
|
|
|
data.setData(
|
|
|
|
|
/*wizard presets*/
|
|
|
|
|
{
|
2022-03-21 23:18:59 +02:00
|
|
|
aCategory("A.categ", "A", {"Desktop", "item b"}),
|
|
|
|
|
aCategory("B.categ", "B", {"item c", "Mobile"}),
|
|
|
|
|
aCategory("Z.categ", "Z", {"Z.desktop"}),
|
2022-03-08 15:09:49 +02:00
|
|
|
},
|
|
|
|
|
{/*user presets*/},
|
|
|
|
|
/*recents*/
|
|
|
|
|
{
|
2022-03-21 23:18:59 +02:00
|
|
|
aRecentPreset("Z.categ", "Z.desktop", "200 x 300"),
|
|
|
|
|
aRecentPreset("B.categ", "Mobile", "200 x 300"),
|
|
|
|
|
aRecentPreset("A.categ", "Desktop", "200 x 300"),
|
2022-03-08 15:09:49 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Then
|
2022-03-21 23:18:59 +02:00
|
|
|
ASSERT_THAT(data.presets()[0],
|
|
|
|
|
ElementsAre(PresetIs("Z.categ", "Z.desktop"),
|
|
|
|
|
PresetIs("B.categ", "Mobile"),
|
|
|
|
|
PresetIs("A.categ", "Desktop")));
|
2022-03-08 15:09:49 +02:00
|
|
|
}
|
|
|
|
|
|
2022-03-21 23:18:59 +02:00
|
|
|
TEST(QdsPresetModel, recentsOfSameWizardProjectButDifferentSizesAreRecognizedAsDifferentPresets)
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
{
|
|
|
|
|
// Given
|
|
|
|
|
PresetData data;
|
|
|
|
|
|
|
|
|
|
// When
|
|
|
|
|
data.setData(
|
|
|
|
|
/*wizard presets*/
|
|
|
|
|
{
|
2022-03-21 23:18:59 +02:00
|
|
|
aCategory("A.categ", "A", {"Desktop"}),
|
|
|
|
|
aCategory("B.categ", "B", {"Mobile"}),
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
},
|
2022-02-23 15:32:34 +02:00
|
|
|
{/*user presets*/},
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
/*recents*/
|
|
|
|
|
{
|
2022-03-21 23:18:59 +02:00
|
|
|
aRecentPreset("B.categ", "Mobile", "400 x 400"),
|
|
|
|
|
aRecentPreset("B.categ", "Mobile", "200 x 300"),
|
|
|
|
|
aRecentPreset("A.categ", "Desktop", "640 x 480"),
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Then
|
|
|
|
|
ASSERT_THAT(data.presets()[0],
|
2022-03-21 23:18:59 +02:00
|
|
|
ElementsAre(PresetIs("B.categ", "Mobile", "400 x 400"),
|
|
|
|
|
PresetIs("B.categ", "Mobile", "200 x 300"),
|
|
|
|
|
PresetIs("A.categ", "Desktop", "640 x 480")));
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
}
|
|
|
|
|
|
2022-03-21 23:18:59 +02:00
|
|
|
TEST(QdsPresetModel, allowRecentsWithTheSameName)
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
{
|
|
|
|
|
// Given
|
|
|
|
|
PresetData data;
|
|
|
|
|
|
|
|
|
|
// When
|
|
|
|
|
data.setData(
|
|
|
|
|
/*wizard presets*/
|
|
|
|
|
{
|
|
|
|
|
aCategory("A.categ", "A", {"Desktop"}),
|
|
|
|
|
},
|
2022-02-23 15:32:34 +02:00
|
|
|
{/*user presets*/},
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
/*recents*/
|
|
|
|
|
{
|
2022-03-21 23:18:59 +02:00
|
|
|
/* NOTE: it is assumed recents with the same name and size have other fields that
|
|
|
|
|
* distinguishes them from one another. It is the responsibility of the caller, who
|
|
|
|
|
* calls data.setData() to make sure that the recents do not contain duplicates. */
|
|
|
|
|
aRecentPreset("A.categ", "Desktop", "200 x 300"),
|
|
|
|
|
aRecentPreset("A.categ", "Desktop", "200 x 300"),
|
|
|
|
|
aRecentPreset("A.categ", "Desktop", "200 x 300"),
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Then
|
|
|
|
|
ASSERT_THAT(data.presets()[0],
|
2022-03-21 23:18:59 +02:00
|
|
|
ElementsAre(PresetIs("A.categ", "Desktop"),
|
|
|
|
|
PresetIs("A.categ", "Desktop"),
|
|
|
|
|
PresetIs("A.categ", "Desktop")));
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(QdsPresetModel, outdatedRecentsAreNotShown)
|
|
|
|
|
{
|
|
|
|
|
// Given
|
|
|
|
|
PresetData data;
|
|
|
|
|
|
|
|
|
|
// When
|
|
|
|
|
data.setData(
|
|
|
|
|
/*wizard presets*/
|
|
|
|
|
{
|
|
|
|
|
aCategory("A.categ", "A", {"Desktop"}),
|
|
|
|
|
aCategory("B.categ", "B", {"Mobile"}),
|
|
|
|
|
},
|
2022-02-23 15:32:34 +02:00
|
|
|
{/*user presets*/},
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
/*recents*/
|
|
|
|
|
{
|
2022-03-21 23:18:59 +02:00
|
|
|
aRecentPreset("B.categ", "NoLongerExists", "400 x 400"),
|
|
|
|
|
aRecentPreset("A.categ", "Desktop", "640 x 480"),
|
QDS-5691 Create a tab for Recent choices
The Recents should store presets, rather than normal project items,
while the rest of tabs are to store normal project (i.e. wizard) items
but with the default screen size written under the wizard name.
In this patch I also did a few renames: e.g. the Presets view now uses a
PresetModel rather than ProjectModel, because we now store presets. A
Preset is a higher level concept than Project / Wizard item: it can be a
project/wizard item with pre-defined configurations; and now we can have
multiple presets using the same Wizard factory. Renamed struct
ProjectCategory to WizardCategory, because the items are grouped by the
category of the wizard (i.e. the "category" property of IWizardFactory)
I extracted a class, PresetData, to hold the data that is being shared
by the PresetModel (items in the view) and the PresetCategoryModel
(header/tab items). It stored both information on normal presets and on
recent presets.
Made changes to JsonWizardFactory so that I could extract the list of
screen sizes without requiring to build a wizard object first. This is
important, because multiple JsonWizard objects cannot be created at the
same time and I need to show the screen sizes of multiple presets /
wizards as the Presets view is opened. This also required class
WizardFactories to use JsonWizardFactory instead of Core::IWizardFactory
-- since "screen sizes" are a particularity of the json wizards, not of
all kinds of wizards.
Also, fixed a TODO in WizardHandler::reset() method.
Also, added a few utilities I had need of, in algorithm.h.
Change-Id: Ifd986e2def19b2e112f0aa1ab3db63d522736321
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-10 15:48:29 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Then
|
|
|
|
|
ASSERT_THAT(data.presets()[0], ElementsAre(PresetIs("A.categ", "Desktop", "640 x 480")));
|
|
|
|
|
}
|