File indexing completed on 2024-05-12 04:40:09

0001 /*
0002     SPDX-FileCopyrightText: 2016 Aetf <aetf@unlimitedcodeworks.xyz>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 #ifndef LLDBFORMATTERSTEST_H
0008 #define LLDBFORMATTERSTEST_H
0009 
0010 #include <QList>
0011 #include <QObject>
0012 #include <QPair>
0013 #include <QPointer>
0014 #include <QStringList>
0015 
0016 class IExecutePlugin;
0017 
0018 namespace KDevelop {
0019 class Breakpoint;
0020 class TestCore;
0021 class VariableCollection;
0022 }
0023 namespace KDevMI { namespace LLDB {
0024 class DebugSession;
0025 class LldbVariable;
0026 }
0027 }
0028 class LldbFormattersTest : public QObject
0029 {
0030     Q_OBJECT
0031 private Q_SLOTS:
0032     void initTestCase();
0033     void cleanupTestCase();
0034 
0035     void init();
0036     void cleanup();
0037 
0038     void testQChar();
0039     void testQString();
0040     void testQByteArray();
0041     void testQListContainer_data();
0042     void testQListContainer();
0043     void testQListPOD();
0044     void testQMapInt();
0045     void testQMapString();
0046     void testQMapStringBool();
0047     void testQHashInt();
0048     void testQHashString();
0049     void testQSetInt();
0050     void testQSetString();
0051     void testQDate();
0052     void testQTime();
0053     void testQDateTime();
0054     void testQUrl();
0055     void testQUuid();
0056     void testKTextEditorTypes();
0057     void testKDevelopTypes();
0058 
0059 private:
0060     // helpers
0061     bool verifyVariable(int index, const QString &name,
0062                         const QString &expectedSummary, QList<QPair<QString, QString>> expectedChildren,
0063                         const char *file, int line,
0064                         bool isLocal = true, bool useRE = false, bool unordered = false);
0065 
0066     bool verifyVariable(int index, const QString &name,
0067                         const QString &expectedSummary, QStringList expectedChildren,
0068                         const char *file, int line,
0069                         bool isLocal = true, bool useRE = false, bool unordered = false);
0070 
0071 private:
0072     KDevelop::Breakpoint* addCodeBreakpoint(const QUrl& location, int line);
0073     KDevelop::VariableCollection *variableCollection();
0074     QModelIndex watchVariableIndexAt(int i, int col = 0);
0075     QModelIndex localVariableIndexAt(int i, int col = 0);
0076 
0077     KDevelop::TestCore *m_core;
0078     IExecutePlugin *m_iface;
0079     QPointer<KDevMI::LLDB::DebugSession> m_session;
0080 };
0081 
0082 #endif