mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-06 01:05:23 +08:00
qt 6.5.1 original
This commit is contained in:
13
tests/auto/gui/kernel/qdrag/CMakeLists.txt
Normal file
13
tests/auto/gui/kernel/qdrag/CMakeLists.txt
Normal file
@ -0,0 +1,13 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#####################################################################
|
||||
## tst_qdrag Test:
|
||||
#####################################################################
|
||||
|
||||
qt_internal_add_test(tst_qdrag
|
||||
SOURCES
|
||||
tst_qdrag.cpp
|
||||
LIBRARIES
|
||||
Qt::Gui
|
||||
)
|
54
tests/auto/gui/kernel/qdrag/tst_qdrag.cpp
Normal file
54
tests/auto/gui/kernel/qdrag/tst_qdrag.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
// 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 <QTest>
|
||||
#include <QMimeData>
|
||||
|
||||
#include <qcoreapplication.h>
|
||||
#include <qdebug.h>
|
||||
#include <qdrag.h>
|
||||
|
||||
class tst_QDrag : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
tst_QDrag();
|
||||
virtual ~tst_QDrag();
|
||||
|
||||
private slots:
|
||||
void getSetCheck();
|
||||
};
|
||||
|
||||
tst_QDrag::tst_QDrag()
|
||||
{
|
||||
}
|
||||
|
||||
tst_QDrag::~tst_QDrag()
|
||||
{
|
||||
}
|
||||
|
||||
// Testing get/set functions
|
||||
void tst_QDrag::getSetCheck()
|
||||
{
|
||||
QDrag obj1(0);
|
||||
// QMimeData * QDrag::mimeData()
|
||||
// void QDrag::setMimeData(QMimeData *)
|
||||
QMimeData *var1 = new QMimeData;
|
||||
obj1.setMimeData(var1);
|
||||
QCOMPARE(var1, obj1.mimeData());
|
||||
obj1.setMimeData(var1);
|
||||
QCOMPARE(var1, obj1.mimeData());
|
||||
obj1.setMimeData((QMimeData *)0);
|
||||
QCOMPARE((QMimeData *)0, obj1.mimeData());
|
||||
// delete var1; // No delete, since QDrag takes ownership
|
||||
|
||||
Qt::DropAction result = obj1.exec();
|
||||
QCOMPARE(result, Qt::IgnoreAction);
|
||||
result = obj1.exec(Qt::MoveAction | Qt::LinkAction);
|
||||
QCOMPARE(result, Qt::IgnoreAction);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QDrag)
|
||||
#include "tst_qdrag.moc"
|
Reference in New Issue
Block a user