mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-02 23:35:28 +08:00
qt 6.5.1 original
This commit is contained in:
3
tests/auto/widgets/dialogs/qwizard/BLACKLIST
Normal file
3
tests/auto/widgets/dialogs/qwizard/BLACKLIST
Normal file
@ -0,0 +1,3 @@
|
||||
# QTBUG-87394
|
||||
[setOption_IgnoreSubTitles]
|
||||
android
|
27
tests/auto/widgets/dialogs/qwizard/CMakeLists.txt
Normal file
27
tests/auto/widgets/dialogs/qwizard/CMakeLists.txt
Normal file
@ -0,0 +1,27 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#####################################################################
|
||||
## tst_qwizard Test:
|
||||
#####################################################################
|
||||
|
||||
# Resources:
|
||||
set(qwizard_resource_files
|
||||
"images/background.png"
|
||||
"images/banner.png"
|
||||
"images/logo.png"
|
||||
"images/watermark.png"
|
||||
)
|
||||
|
||||
qt_internal_add_test(tst_qwizard
|
||||
SOURCES
|
||||
tst_qwizard.cpp
|
||||
tst_qwizard_2.cpp
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
Qt::WidgetsPrivate
|
||||
TESTDATA ${qwizard_resource_files}
|
||||
BUILTIN_TESTDATA
|
||||
)
|
||||
|
BIN
tests/auto/widgets/dialogs/qwizard/images/background.png
Normal file
BIN
tests/auto/widgets/dialogs/qwizard/images/background.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
BIN
tests/auto/widgets/dialogs/qwizard/images/banner.png
Normal file
BIN
tests/auto/widgets/dialogs/qwizard/images/banner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
BIN
tests/auto/widgets/dialogs/qwizard/images/logo.png
Normal file
BIN
tests/auto/widgets/dialogs/qwizard/images/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
tests/auto/widgets/dialogs/qwizard/images/watermark.png
Normal file
BIN
tests/auto/widgets/dialogs/qwizard/images/watermark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
2743
tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
Normal file
2743
tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
Normal file
File diff suppressed because it is too large
Load Diff
170
tests/auto/widgets/dialogs/qwizard/tst_qwizard_2.cpp
Normal file
170
tests/auto/widgets/dialogs/qwizard/tst_qwizard_2.cpp
Normal file
@ -0,0 +1,170 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QDebug>
|
||||
#include <QLineEdit>
|
||||
#include <QMainWindow>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWizard>
|
||||
#include <QWizardPage>
|
||||
|
||||
#include <QTest>
|
||||
|
||||
class taskQTBUG_25691 : public QWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
taskQTBUG_25691( QWidget * parent = nullptr );
|
||||
|
||||
~taskQTBUG_25691(void);
|
||||
};
|
||||
|
||||
class taskQTBUG_25691Page1 : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
taskQTBUG_25691Page1( QWidget * parent = nullptr );
|
||||
|
||||
~taskQTBUG_25691Page1(void);
|
||||
};
|
||||
|
||||
class taskQTBUG_25691Page2 : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
taskQTBUG_25691Page2( QWidget * parent = nullptr );
|
||||
|
||||
virtual void initializePage(void) override;
|
||||
|
||||
~taskQTBUG_25691Page2(void);
|
||||
|
||||
private:
|
||||
QVBoxLayout * layout;
|
||||
QLineEdit * field0_value;
|
||||
QLineEdit * field1_value;
|
||||
QLineEdit * field2_value;
|
||||
};
|
||||
|
||||
|
||||
taskQTBUG_25691::taskQTBUG_25691( QWidget * parent )
|
||||
: QWizard( parent )
|
||||
{
|
||||
this->addPage( new taskQTBUG_25691Page1 );
|
||||
this->addPage( new taskQTBUG_25691Page2 );
|
||||
this->show();
|
||||
}
|
||||
|
||||
taskQTBUG_25691::~taskQTBUG_25691(void)
|
||||
{
|
||||
}
|
||||
|
||||
taskQTBUG_25691Page1::taskQTBUG_25691Page1( QWidget * parent )
|
||||
: QWizardPage( parent )
|
||||
{
|
||||
QComboBox * field0_needed = new QComboBox( this );
|
||||
field0_needed->addItem( "No" );
|
||||
field0_needed->addItem( "Yes" );
|
||||
field0_needed->setCurrentIndex(0);
|
||||
this->registerField( "field0_needed", field0_needed );
|
||||
|
||||
QComboBox * field1_needed = new QComboBox( this );
|
||||
field1_needed->addItem( "No" );
|
||||
field1_needed->addItem( "Yes" );
|
||||
field1_needed->setCurrentIndex(0);
|
||||
this->registerField( "field1_needed", field1_needed );
|
||||
|
||||
QComboBox * field2_needed = new QComboBox( this );
|
||||
field2_needed->addItem( "No" );
|
||||
field2_needed->addItem( "Yes" );
|
||||
field2_needed->setCurrentIndex(0);
|
||||
this->registerField( "field2_needed", field2_needed );
|
||||
|
||||
QVBoxLayout * layout = new QVBoxLayout;
|
||||
layout->addWidget( field0_needed );
|
||||
layout->addWidget( field1_needed );
|
||||
layout->addWidget( field2_needed );
|
||||
this->setLayout( layout );
|
||||
}
|
||||
|
||||
taskQTBUG_25691Page1::~taskQTBUG_25691Page1(void)
|
||||
{
|
||||
}
|
||||
|
||||
taskQTBUG_25691Page2::taskQTBUG_25691Page2( QWidget * parent )
|
||||
: QWizardPage( parent )
|
||||
{
|
||||
this->layout = new QVBoxLayout;
|
||||
this->setLayout( this->layout );
|
||||
|
||||
this->field0_value = 0;
|
||||
this->field1_value = 0;
|
||||
this->field2_value = 0;
|
||||
}
|
||||
|
||||
void taskQTBUG_25691Page2::initializePage(void)
|
||||
{
|
||||
QWizard * wizard = this->wizard();
|
||||
bool field0_needed = wizard->field( "field0_needed" ).toBool();
|
||||
bool field1_needed = wizard->field( "field1_needed" ).toBool();
|
||||
bool field2_needed = wizard->field( "field2_needed" ).toBool();
|
||||
|
||||
if ( field0_needed && this->field0_value == 0 ){
|
||||
this->field0_value = new QLineEdit( "field0_default" );
|
||||
this->registerField( "field0_value", this->field0_value );
|
||||
this->layout->addWidget( this->field0_value );
|
||||
} else if ( ! field0_needed && this->field0_value != 0 ){
|
||||
this->layout->removeWidget( this->field0_value );
|
||||
delete this->field0_value;
|
||||
this->field0_value = 0;
|
||||
}
|
||||
|
||||
if ( field1_needed && this->field1_value == 0 ){
|
||||
this->field1_value = new QLineEdit( "field1_default" );
|
||||
this->registerField( "field1_value", this->field1_value );
|
||||
this->layout->addWidget( this->field1_value );
|
||||
} else if ( ! field1_needed && this->field1_value != 0 ){
|
||||
this->layout->removeWidget( this->field1_value );
|
||||
delete this->field1_value;
|
||||
this->field1_value = 0;
|
||||
}
|
||||
|
||||
if ( field2_needed && this->field2_value == 0 ){
|
||||
this->field2_value = new QLineEdit( "field2_default" );
|
||||
this->registerField( "field2_value", this->field2_value );
|
||||
this->layout->addWidget( this->field2_value );
|
||||
} else if ( ! field2_needed && this->field2_value != 0 ){
|
||||
this->layout->removeWidget( this->field2_value );
|
||||
delete this->field2_value;
|
||||
this->field2_value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
taskQTBUG_25691Page2::~taskQTBUG_25691Page2(void)
|
||||
{
|
||||
}
|
||||
|
||||
void taskQTBUG_25691_fieldObjectDestroyed2(void)
|
||||
{
|
||||
QMainWindow mw;
|
||||
taskQTBUG_25691 wb( &mw );
|
||||
|
||||
wb.setField( "field0_needed", true );
|
||||
wb.setField( "field1_needed", true );
|
||||
wb.setField( "field2_needed", true );
|
||||
wb.next(); // Results in registration of all three field_Nvalue fields
|
||||
wb.back(); // Back up to cancel need for field1_value
|
||||
wb.setField( "field1_needed", false ); // cancel need for field1_value
|
||||
wb.next(); // Results in destruction of field field1_value's widget
|
||||
wb.next(); // Commit wizard's results
|
||||
|
||||
// Now collect the value from fields that was not destroyed.
|
||||
QString field0_value = wb.field( "field0_value" ).toString();
|
||||
QCOMPARE( field0_value, QString("field0_default") );
|
||||
|
||||
QString field2_value = wb.field( "field2_value" ).toString();
|
||||
QCOMPARE( field2_value, QString("field2_default") );
|
||||
}
|
||||
|
||||
#include "tst_qwizard_2.moc"
|
Reference in New Issue
Block a user