Skip to content

Commit

Permalink
fix crash in test and extend test
Browse files Browse the repository at this point in the history
  • Loading branch information
sunderme committed Nov 21, 2023
1 parent ad08262 commit ce452bb
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/tests/testdata/included_level1a.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
\label{test_level1}

\include{included_level2a}

4 changes: 4 additions & 0 deletions src/tests/testdata/included_level2a.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
\usepackage{siunitx}
\usepackage{wasysym}

\label{test_level2}
14 changes: 14 additions & 0 deletions src/tests/testdata/top_buried_package.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
\include{included_level1a}

\GHz
\clock
\degreeCelsius
\ref{test_level1}

\ref{test_level2}
\section{dsdfgdfgse}

\subsection{dffdfssssfdf}



4 changes: 4 additions & 0 deletions src/tests/texstudio_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ void TexStudioTest::checkIncludes_data(){
<<QStringList{QString(TESTDATADIR)+"/top.tex",QString(TESTDATADIR)+"/a1.tex",QString(TESTDATADIR)+"/a2.tex"}<<false;
QTest::newRow("2 level include, out of order")
<<QStringList{QString(TESTDATADIR)+"/top.tex",QString(TESTDATADIR)+"/a2.tex",QString(TESTDATADIR)+"/a1.tex"}<<false;
QTest::newRow("2 level include, buried package")
<<QStringList{QString(TESTDATADIR)+"/included_level1a.tex",QString(TESTDATADIR)+"/included_level2a.tex",QString(TESTDATADIR)+"/top_buried_package.tex"}<<true;
QTest::newRow("usercommands")
<<QStringList{QString(TESTDATADIR)+"/usercommands.tex"}<<false;
}
Expand Down Expand Up @@ -122,6 +124,8 @@ void TexStudioTest::checkIncludesCached_data(){
<<QStringList{QString(TESTDATADIR)+"/top.tex",QString(TESTDATADIR)+"/a1.tex",QString(TESTDATADIR)+"/a2.tex"}<<false;
QTest::newRow("2 level include, out of order")
<<QStringList{QString(TESTDATADIR)+"/top.tex",QString(TESTDATADIR)+"/a2.tex",QString(TESTDATADIR)+"/a1.tex"}<<false;
QTest::newRow("2 level include, buried package")
<<QStringList{QString(TESTDATADIR)+"/included_level1a.tex",QString(TESTDATADIR)+"/included_level2a.tex",QString(TESTDATADIR)+"/top_buried_package.tex"}<<true;
}

void TexStudioTest::checkIncludesCached(){
Expand Down
8 changes: 7 additions & 1 deletion src/texstudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7056,7 +7056,13 @@ bool Texstudio::executeTests(const QStringList &args)
return false;
}
}else{
m_languages->setLanguageFromName(currentEditorView()->editor, "TXS Test Results");
QEditor *ed=currentEditor();
if(!ed){
qDebug()<<"Editor was closed.";
fileNew();
ed=currentEditor();
}
m_languages->setLanguageFromName(ed, "TXS Test Results");
currentEditorView()->editor->setText(result, false);
if (result.startsWith("*** THERE SEEM TO BE FAILED TESTS! ***")) {
QSearchReplacePanel *searchpanel = qobject_cast<QSearchReplacePanel *>(currentEditorView()->codeeditor->panels("Search")[0]);
Expand Down

0 comments on commit ce452bb

Please sign in to comment.