Tests: Add manual test for Utils::StyledBar

Utils::Icon and other widgets in a Utils::Styledbar need some additions
which are best done with an as small as possible manual tester.

Change-Id: I44e7922c6ccc4c4c42493e10177e8bc5b908a09e
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Alessandro Portale
2024-09-20 13:26:41 +02:00
parent 821d9e8690
commit dee2886dc3
5 changed files with 102 additions and 0 deletions

View File

@@ -3,5 +3,6 @@ add_subdirectory(crumblepath)
add_subdirectory(infolabel)
add_subdirectory(layoutbuilder)
add_subdirectory(manhattanstyle)
add_subdirectory(styledbar)
add_subdirectory(tracing)
add_subdirectory(uifonts)

View File

@@ -0,0 +1,8 @@
add_qtc_test(tst_manual_widgets_styledbar
MANUALTEST
DEPENDS Qt::Gui Utils Core
SOURCES
tst_manual_widgets_styledbar.cpp
../common/themeselector.cpp ../common/themeselector.h
../common/themes.qrc
)

View File

@@ -0,0 +1,12 @@
import "../common/common.qbs" as Common
CppApplication {
name: "Manual Test Utils StyledBar"
Depends { name: "Core" }
Depends { name: "Utils" }
files: "tst_manual_widgets_styledbar.cpp"
Common {}
}

View File

@@ -0,0 +1,80 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "../common/themeselector.h"
#include <QApplication>
#include <QCheckBox>
#include <QComboBox>
#include <QLayout>
#include <QSpinBox>
#include <QToolButton>
#include <utils/icon.h>
#include <utils/layoutbuilder.h>
#include <utils/styledbar.h>
#include <utils/stylehelper.h>
#include <utils/theme/theme.h>
using namespace Utils;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
auto themeSelector = new ManualTest::ThemeSelector;
StyleHelper::setToolbarStyle(StyleHelper::ToolbarStyleRelaxed);
const Icon icon({
{":/utils/images/zoom.png", Theme::IconsBaseColor},
{":/utils/images/iconoverlay_add_small.png", Theme::IconsRunColor},
});
const QIcon qIcon = icon.icon();
auto styledBar = new StyledBar;
auto toolButton = new QToolButton;
toolButton->setCheckable(true);
toolButton->setIcon(qIcon);
auto toolButtonChecked = new QToolButton;
toolButtonChecked->setCheckable(true);
toolButtonChecked->setChecked(true);
toolButtonChecked->setIcon(qIcon);
auto toolButtonDisabled = new QToolButton;
toolButtonDisabled->setEnabled(false);
toolButtonDisabled->setIcon(qIcon);
auto comboBox = new QComboBox;
const QStringList content = QColor::colorNames();
comboBox->addItems(content.first(8));
auto spinBox = new QSpinBox;
spinBox->setFrame(false);
spinBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
auto checkBox = new QCheckBox("check");
using namespace Layouting;
Row {
toolButton,
toolButtonChecked,
toolButtonDisabled,
new Utils::StyledSeparator,
comboBox,
"Text label",
spinBox,
checkBox,
noMargin, spacing(0),
}.attachTo(styledBar);
Column {
themeSelector,
styledBar,
st,
}.show();
return app.exec();
}

View File

@@ -7,6 +7,7 @@ Project {
"infolabel/infolabel.qbs",
"layoutbuilder/layoutbuilder.qbs",
"manhattanstyle/manhattanstyle.qbs",
"styledbar/styledbar.qbs",
"tracing/tracing.qbs",
"uifonts/uifonts.qbs",
]