forked from qt-creator/qt-creator
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:
@@ -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)
|
||||
|
8
tests/manual/widgets/styledbar/CMakeLists.txt
Normal file
8
tests/manual/widgets/styledbar/CMakeLists.txt
Normal 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
|
||||
)
|
12
tests/manual/widgets/styledbar/styledbar.qbs
Normal file
12
tests/manual/widgets/styledbar/styledbar.qbs
Normal 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 {}
|
||||
}
|
@@ -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();
|
||||
}
|
@@ -7,6 +7,7 @@ Project {
|
||||
"infolabel/infolabel.qbs",
|
||||
"layoutbuilder/layoutbuilder.qbs",
|
||||
"manhattanstyle/manhattanstyle.qbs",
|
||||
"styledbar/styledbar.qbs",
|
||||
"tracing/tracing.qbs",
|
||||
"uifonts/uifonts.qbs",
|
||||
]
|
||||
|
Reference in New Issue
Block a user