2021-12-14 19:36:48 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2021 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
|
2021-12-14 19:36:48 +02:00
|
|
|
|
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 "gmock/gmock-matchers.h"
|
2021-12-14 19:36:48 +02:00
|
|
|
#include <gmock/gmock.h>
|
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
|
|
#include <QtGlobal>
|
|
|
|
|
#include <QVariant>
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
|
|
|
|
#include <utils/algorithm.h>
|
|
|
|
|
|
|
|
|
|
using ::testing::Return;
|
|
|
|
|
using ::testing::AtLeast;
|
|
|
|
|
using ::testing::ElementsAreArray;
|
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
|
|
|
using ::testing::ElementsAre;
|
2021-12-14 19:36:48 +02:00
|
|
|
using ::testing::IsEmpty;
|
|
|
|
|
using ::testing::Not;
|
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
|
|
|
using ::testing::SizeIs;
|
2021-12-14 19:36:48 +02:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
|
|
|
|
|
inline std::ostream &operator<<(std::ostream &out, const QByteArray &byteArray)
|
|
|
|
|
{
|
|
|
|
|
if (byteArray.contains('\n')) {
|
|
|
|
|
QByteArray formattedArray = byteArray;
|
|
|
|
|
formattedArray.replace("\n", "\n\t");
|
|
|
|
|
out << "\n\t";
|
|
|
|
|
out.write(formattedArray.data(), formattedArray.size());
|
|
|
|
|
} else {
|
|
|
|
|
out << "\"";
|
|
|
|
|
out.write(byteArray.data(), byteArray.size());
|
|
|
|
|
out << "\"";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline std::ostream &operator<<(std::ostream &out, const QVariant &variant)
|
|
|
|
|
{
|
|
|
|
|
QString output;
|
|
|
|
|
QDebug debug(&output);
|
|
|
|
|
|
|
|
|
|
debug.noquote().nospace() << variant;
|
|
|
|
|
|
|
|
|
|
QByteArray utf8Text = output.toUtf8();
|
|
|
|
|
|
|
|
|
|
return out.write(utf8Text.data(), utf8Text.size());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline std::ostream &operator<<(std::ostream &out, const QString &text)
|
|
|
|
|
{
|
|
|
|
|
return out << text.toUtf8();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void PrintTo(const QString &text, std::ostream *os)
|
|
|
|
|
{
|
|
|
|
|
*os << text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void PrintTo(const QVariant &variant, std::ostream *os)
|
|
|
|
|
{
|
|
|
|
|
*os << variant;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void PrintTo(const QByteArray &text, std::ostream *os)
|
|
|
|
|
{
|
|
|
|
|
*os << text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|