diff options
author | Marcus Tillmanns <[email protected]> | 2023-08-11 08:56:11 +0200 |
---|---|---|
committer | Marcus Tillmanns <[email protected]> | 2023-08-15 11:04:36 +0000 |
commit | 5ae116618e919b91d8838fa01182209c6d81a3e3 (patch) | |
tree | 3ccec70be0e1b80cae138788d7e4680744d87c20 | |
parent | 9b18e73fac3ef03ae0bf293ce4618f2fba589b82 (diff) |
Tracing: Remove useless code
runSceneGraphTest() did nothing but create an opengl context and
offscreen surface. It did nothing with the provided QSGNode.
The only thing it does is make the test fail if the opengl context
can't be created for instance on test machines without opengl.
Change-Id: I376c3565f5afcee6e123a7ef8b9832e679e645a0
Reviewed-by: Ulf Hermann <[email protected]>
9 files changed, 11 insertions, 78 deletions
diff --git a/src/libs/tracing/CMakeLists.txt b/src/libs/tracing/CMakeLists.txt index 3e0a7237f6c..e89f31f9cc8 100644 --- a/src/libs/tracing/CMakeLists.txt +++ b/src/libs/tracing/CMakeLists.txt @@ -1,11 +1,3 @@ -if (WITH_TESTS) - set(TEST_SOURCES - runscenegraphtest.cpp runscenegraphtest.h - ) -else() - set(TEST_SOURCES "") -endif() - set(TRACING_CPP_SOURCES flamegraph.cpp flamegraph.h flamegraphattached.h @@ -40,8 +32,6 @@ add_qtc_library(Tracing FEATURE_INFO DEPENDS Utils Qt::Quick PUBLIC_DEPENDS Qt::Widgets Qt::Qml - SOURCES - ${TEST_SOURCES} ) if (NOT TARGET Tracing) diff --git a/src/libs/tracing/runscenegraphtest.cpp b/src/libs/tracing/runscenegraphtest.cpp deleted file mode 100644 index d88dd03271f..00000000000 --- a/src/libs/tracing/runscenegraphtest.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// 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 "runscenegraphtest.h" - -#include <QTest> -#include <QString> -#include <QOpenGLContext> -#include <QOffscreenSurface> - -namespace Timeline { - -void runSceneGraphTest(QSGNode *node) -{ - Q_UNUSED(node) - - QSurfaceFormat format; - format.setStencilBufferSize(8); - format.setDepthBufferSize(24); - - QOpenGLContext context; - context.setFormat(format); - QVERIFY(context.create()); - - QOffscreenSurface surface; - surface.setFormat(format); - surface.create(); - - QVERIFY(context.makeCurrent(&surface)); - - context.doneCurrent(); -} - -} // namespace Timeline diff --git a/src/libs/tracing/runscenegraphtest.h b/src/libs/tracing/runscenegraphtest.h deleted file mode 100644 index e76702d6818..00000000000 --- a/src/libs/tracing/runscenegraphtest.h +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#pragma once - -#include "tracing_global.h" -#include <QSGNode> - -namespace Timeline { - -void TRACING_EXPORT runSceneGraphTest(QSGNode *node); - -} // namespace Timeline diff --git a/src/libs/tracing/tracing.qbs b/src/libs/tracing/tracing.qbs index 465a92c8ffe..b71fe1f6057 100644 --- a/src/libs/tracing/tracing.qbs +++ b/src/libs/tracing/tracing.qbs @@ -47,14 +47,6 @@ Project { files: "qml/**" } - Group { - name: "Unit test utilities" - condition: project.withAutotests - files: [ - "runscenegraphtest.cpp", "runscenegraphtest.h" - ] - } - cpp.defines: base.concat("TRACING_LIBRARY") } } diff --git a/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp index 2f720557524..0ddfc2bc927 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp @@ -4,10 +4,10 @@ #include "qmlprofilerbindingloopsrenderpass_test.h" +#include <tracing/timelineabstractrenderer.h> #include <qmlprofiler/qmlprofilerbindingloopsrenderpass.h> #include <qmlprofiler/qmlprofilerrangemodel.h> -#include <tracing/timelineabstractrenderer.h> -#include <tracing/runscenegraphtest.h> + #include <QtTest> namespace QmlProfiler { @@ -131,8 +131,8 @@ void QmlProfilerBindingLoopsRenderPassTest::testUpdate() parentState.setPassState(0, result); parentState.assembleNodeTree(&model, 1, 1); - Timeline::runSceneGraphTest(parentState.collapsedOverlayRoot()); - Timeline::runSceneGraphTest(parentState.expandedRowRoot()); + QVERIFY(parentState.collapsedOverlayRoot()); + QVERIFY(parentState.expandedRowRoot()); } } // namespace Internal diff --git a/tests/auto/tracing/flamegraph/CMakeLists.txt b/tests/auto/tracing/flamegraph/CMakeLists.txt index ae894557af4..8618fdf7d5e 100644 --- a/tests/auto/tracing/flamegraph/CMakeLists.txt +++ b/tests/auto/tracing/flamegraph/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_test(tst_tracing_flamegraph + NEEDS_GUI DEPENDS Tracing Qt::Quick SOURCES tst_flamegraph.cpp ) diff --git a/tests/auto/tracing/timelineitemsrenderpass/tst_timelineitemsrenderpass.cpp b/tests/auto/tracing/timelineitemsrenderpass/tst_timelineitemsrenderpass.cpp index 10bc5c85e1a..0c42367a613 100644 --- a/tests/auto/tracing/timelineitemsrenderpass/tst_timelineitemsrenderpass.cpp +++ b/tests/auto/tracing/timelineitemsrenderpass/tst_timelineitemsrenderpass.cpp @@ -1,7 +1,6 @@ // 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 <tracing/runscenegraphtest.h> #include <tracing/timelineitemsrenderpass.h> #include <tracing/timelinemodelaggregator.h> #include <tracing/timelinerenderstate.h> @@ -124,8 +123,8 @@ void tst_TimelineItemsRenderPass::update() parentState.setPassState(0, result); parentState.assembleNodeTree(&model, 1, 1); - runSceneGraphTest(parentState.collapsedRowRoot()); - runSceneGraphTest(parentState.expandedRowRoot()); + QVERIFY(parentState.collapsedRowRoot()); + QVERIFY(parentState.expandedRowRoot()); } QTEST_MAIN(tst_TimelineItemsRenderPass) diff --git a/tests/auto/tracing/timelinenotesrenderpass/tst_timelinenotesrenderpass.cpp b/tests/auto/tracing/timelinenotesrenderpass/tst_timelinenotesrenderpass.cpp index ea08ed7d823..77447f53ed3 100644 --- a/tests/auto/tracing/timelinenotesrenderpass/tst_timelinenotesrenderpass.cpp +++ b/tests/auto/tracing/timelinenotesrenderpass/tst_timelinenotesrenderpass.cpp @@ -1,7 +1,6 @@ // 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 <tracing/runscenegraphtest.h> #include <tracing/timelinemodelaggregator.h> #include <tracing/timelinenotesrenderpass.h> #include <tracing/timelinerenderstate.h> @@ -110,8 +109,8 @@ void tst_TimelineNotesRenderPass::update() parentState.setPassState(0, result); parentState.assembleNodeTree(&model, 1, 1); - runSceneGraphTest(parentState.collapsedOverlayRoot()); - runSceneGraphTest(parentState.expandedRowRoot()); + QVERIFY(parentState.collapsedOverlayRoot()); + QVERIFY(parentState.expandedRowRoot()); } QTEST_MAIN(tst_TimelineNotesRenderPass) diff --git a/tests/auto/tracing/timelineselectionrenderpass/tst_timelineselectionrenderpass.cpp b/tests/auto/tracing/timelineselectionrenderpass/tst_timelineselectionrenderpass.cpp index 411d42a7173..94a49d5fdba 100644 --- a/tests/auto/tracing/timelineselectionrenderpass/tst_timelineselectionrenderpass.cpp +++ b/tests/auto/tracing/timelineselectionrenderpass/tst_timelineselectionrenderpass.cpp @@ -1,7 +1,6 @@ // 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 <tracing/runscenegraphtest.h> #include <tracing/timelineselectionrenderpass.h> #include <tracing/timelinerenderstate.h> #include <tracing/timelineabstractrenderer_p.h> @@ -150,8 +149,8 @@ void tst_TimelineSelectionRenderPass::update() parentState.setPassState(0, result); parentState.assembleNodeTree(&model, 1, 1); - runSceneGraphTest(parentState.collapsedOverlayRoot()); - runSceneGraphTest(parentState.expandedOverlayRoot()); + QVERIFY(parentState.collapsedOverlayRoot()); + QVERIFY(parentState.expandedOverlayRoot()); } QTEST_MAIN(tst_TimelineSelectionRenderPass) |