File indexing completed on 2024-04-28 11:20:52
0001 /* 0002 SPDX-License-Identifier: GPL-2.0-or-later 0003 SPDX-FileCopyrightText: 2019 Sirgienko Nikita <warquark@gmail.com> 0004 */ 0005 0006 #include <QObject> 0007 0008 class Worksheet; 0009 class WorksheetEntry; 0010 namespace Cantor { 0011 class Expression; 0012 } 0013 0014 class WorksheetTest: public QObject 0015 { 0016 Q_OBJECT 0017 0018 private Q_SLOTS: 0019 /* Jupyter load tests */ 0020 void initTestCase(); 0021 void testJupyter1(); 0022 void testJupyter2(); 0023 void testJupyter3(); 0024 void testJupyter4(); 0025 void testJupyter5(); 0026 void testJupyter6(); 0027 void testJupyter7(); 0028 0029 void testMarkdownAttachment(); 0030 void testEntryLoad1(); 0031 void testEntryLoad2(); 0032 void testResultsLoad(); 0033 void testMimeResult(); 0034 void testMimeResultWithPlain(); 0035 0036 void testCommandEntryExecutionAction1(); 0037 void testCommandEntryExecutionAction2(); 0038 void testCollapsingAllResultsAction(); 0039 void testRemovingAllResultsAction(); 0040 0041 /* common features tests */ 0042 void testMathRender(); 0043 void testMathRender2(); 0044 0045 private: 0046 void waitForSignal( QObject* sender, const char* signal); 0047 static Worksheet* loadWorksheet(const QString& name); 0048 static int entriesCount(Worksheet* worksheet); 0049 static Cantor::Expression* expression(WorksheetEntry* entry); 0050 static QString plainMarkdown(WorksheetEntry* markdownEntry); 0051 static QString plainText(WorksheetEntry* textEntry); 0052 static QString plainCommand(WorksheetEntry* commandEntry); 0053 static QString plainLatex(WorksheetEntry* latexEntry); 0054 static void testMarkdown(WorksheetEntry* &entry, const QString& content); 0055 static void testCommandEntry(WorksheetEntry* &entry, int id, const QString& content); 0056 static void testCommandEntry(WorksheetEntry* entry, int id, int resultsCount, const QString& content); 0057 static void testLatexEntry(WorksheetEntry* &entry, const QString& content); 0058 static void testTextEntry(WorksheetEntry* &entry, const QString& content); 0059 static void testImageResult(WorksheetEntry* entry, int index); 0060 static void testTextResult(WorksheetEntry* entry, int index, const QString& content); 0061 static void testHtmlResult(WorksheetEntry* entry, int index, const QString& content); 0062 static void testHtmlResult(WorksheetEntry* entry, int index, const QString& plain, const QString& html); 0063 };