File indexing completed on 2024-05-19 03:50:40

0001 /*
0002     File                 : RetransformTest.h
0003     Project              : LabPlot
0004     Description          : Tests to evaluate retransforming
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2021 Martin Marmsoler <martin.marmsoler@gmail.com>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #ifndef RETRANSFORMTEST_H
0012 #define RETRANSFORMTEST_H
0013 
0014 #include "../../CommonTest.h"
0015 
0016 class RetransformTest : public CommonTest {
0017     Q_OBJECT
0018 
0019     // Tests
0020 private Q_SLOTS:
0021     void initTestCase();
0022 
0023     void TestLoadProject();
0024     void TestLoadProject2();
0025     void TestResizeWindows();
0026     void TestPadding();
0027     void TestCopyPastePlot();
0028     void TestAddCurve();
0029     void TestImportCSV();
0030     void TestSetScale();
0031 
0032     void TestZoomSelectionAutoscale();
0033     void TestZoomAutoscaleSingleYRange();
0034     void TestZoomAutoscaleSingleXRange();
0035     void TestZoom();
0036 
0037     void TestChangePlotRange();
0038     void TestChangePlotRangeElement();
0039     void TestChangePlotRangeElement2();
0040     void TestChangePlotRangeElement3();
0041 
0042     void TestBarPlotOrientation();
0043 
0044     void testPlotRecalcRetransform();
0045     void testPlotRecalcNoRetransform();
0046 };
0047 
0048 /*!
0049  * \brief The RetransformCallCounter class
0050  * Used to count the retransform calls to evaluate that
0051  * the items retransform are called a exact number of times
0052  */
0053 class RetransformCallCounter : public QObject {
0054     Q_OBJECT
0055 public:
0056     QHash<QString, int> statistic(bool includeSuppressed);
0057     int elementLogCount(bool includeSuppressed);
0058     bool calledExact(int requiredCallCount, bool includeSuppressed);
0059     int callCount(const QString& path);
0060     int callCount(const AbstractAspect* aspect);
0061     void resetRetransformCount();
0062     void aspectRetransformed(const AbstractAspect* sender, bool suppressed);
0063     void retransformScaleCalled(const CartesianPlot* plot, CartesianCoordinateSystem::Dimension dim, int index);
0064     void aspectAdded(const AbstractAspect* aspect);
0065 
0066 public:
0067     struct Retransformed {
0068         const AbstractAspect* aspect;
0069         bool suppressed;
0070     };
0071 
0072     struct ScaleRetransformed {
0073         const CartesianPlot* plot;
0074         int index;
0075     };
0076     QVector<Retransformed> logsRetransformed;
0077     QVector<ScaleRetransformed> logsXScaleRetransformed;
0078     QVector<ScaleRetransformed> logsYScaleRetransformed;
0079 };
0080 
0081 #endif // RETRANSFORMTEST_H