Skip to content

Commit 319b93b

Browse files
authored
Output timing info to verbose log, support snapshot testing (#81)
* Move timing info to verbose log, support snapshot testing * PR feedback
1 parent 0d42ff1 commit 319b93b

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Source/PluginTests.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ void PluginTests::runTest()
8888
// This has to be called on a background thread to keep the message thread free
8989
jassert (! juce::MessageManager::existsAndIsCurrentThread());
9090

91-
logMessage ("Validation started: " + Time::getCurrentTime().toString (true, true) + "\n");
91+
logMessage ("Validation started");
92+
logVerboseMessage ("\t" + Time::getCurrentTime().toString (true, true) + "\n");
9293
logMessage ("Strictness level: " + String (options.strictnessLevel));
9394

9495
if (fileOrID.isNotEmpty())
@@ -133,7 +134,7 @@ void PluginTests::testType (const PluginDescription& pd)
133134
beginTest ("Open plugin (cold)");
134135
StopwatchTimer sw;
135136
deletePluginAsync (testOpenPlugin (pd));
136-
logMessage ("\nTime taken to open plugin (cold): " + sw.getDescription());
137+
logVerboseMessage ("\nTime taken to open plugin (cold): " + sw.getDescription());
137138
}
138139

139140
{
@@ -142,7 +143,7 @@ void PluginTests::testType (const PluginDescription& pd)
142143

143144
if (auto instance = testOpenPlugin (pd))
144145
{
145-
logMessage ("\nTime taken to open plugin (warm): " + sw.getDescription());
146+
logVerboseMessage ("\nTime taken to open plugin (warm): " + sw.getDescription());
146147
logMessage (String ("Running tests 123 times").replace ("123", String (options.numRepeats)));
147148

148149
// This sleep is here to allow time for plugin async initialisation as in most cases
@@ -198,13 +199,13 @@ void PluginTests::testType (const PluginDescription& pd)
198199
t->runTest (*this, *instance);
199200
}
200201

201-
logMessage ("\nTime taken to run test: " + sw2.getDescription());
202+
logVerboseMessage ("\nTime taken to run test: " + sw2.getDescription());
202203
}
203204
}
204205

205206
deletePluginAsync (std::move (instance));
206207
}
207208
}
208209

209-
logMessage ("\nTime taken to run all tests: " + totalTimer.getDescription());
210+
logVerboseMessage ("\nTime taken to run all tests: " + totalTimer.getDescription());
210211
}

Source/tests/BasicTests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ struct EditorTest : public PluginTest
105105
{
106106
ScopedEditorShower editorShower (instance);
107107
ut.expect (editorShower.editor != nullptr, "Unable to create editor");
108-
ut.logMessage ("\nTime taken to open editor (cold): " + timer.getDescription());
108+
ut.logVerboseMessage ("\nTime taken to open editor (cold): " + timer.getDescription());
109109
}
110110

111111
{
112112
timer.reset();
113113
ScopedEditorShower editorShower (instance);
114114
ut.expect (editorShower.editor != nullptr, "Unable to create editor on second attempt");
115-
ut.logMessage ("Time taken to open editor (warm): " + timer.getDescription());
115+
ut.logVerboseMessage ("Time taken to open editor (warm): " + timer.getDescription());
116116
}
117117
}
118118
}

0 commit comments

Comments
 (0)