Skip to content

Commit

Permalink
Close tab with generated test suite if all test cases were deleted (#331
Browse files Browse the repository at this point in the history
)

* check generatedTestsTabData.testCasePanelFactories.size

* fix TopButtonsPanelBuilder.update
  • Loading branch information
arksap2002 authored Sep 30, 2024
1 parent b991154 commit b4a2449
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ class TopButtonsPanelBuilder {
* Updates the labels.
*/
fun update(generatedTestsTabData: GeneratedTestsTabData) {
var numberOfPassedTests = 0
for (testCasePanelFactory in generatedTestsTabData.testCasePanelFactories) {
if (testCasePanelFactory.isRemoved()) continue
val error = testCasePanelFactory.getError()
if ((error is String) && error.isEmpty()) {
numberOfPassedTests++
}
val passedTestsCount = generatedTestsTabData.testCasePanelFactories
.filter { !it.isRemoved() }
.count { it.getError()?.isEmpty() == true }

val removedTestsCount = generatedTestsTabData.testCasePanelFactories.count { it.isRemoved() }

if (generatedTestsTabData.testCasePanelFactories.size == removedTestsCount) {
removeAllButton.doClick()
return
}
testsSelectedLabel.text = String.format(
testsSelectedText,
Expand All @@ -56,7 +58,7 @@ class TopButtonsPanelBuilder {
testsPassedLabel.text =
String.format(
testsPassedText,
numberOfPassedTests,
passedTestsCount,
generatedTestsTabData.testCaseNameToPanel.size,
)
runAllButton.isEnabled = false
Expand Down

0 comments on commit b4a2449

Please sign in to comment.