From 7839157e098c278cbb24d5e6eed2c39fcfdaedf8 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Thu, 17 Feb 2022 14:54:06 +0100 Subject: [PATCH] [tests] sort by duration should not override "suites always on top" option (IDEA-286460) GitOrigin-RevId: a45f09633431edc82c217fbcf12b4f2d881e1804 --- .../testframework/TestFrameworkRunningModel.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/platform/testRunner/src/com/intellij/execution/testframework/TestFrameworkRunningModel.java b/platform/testRunner/src/com/intellij/execution/testframework/TestFrameworkRunningModel.java index a3c43acc677c..31215c8512ae 100644 --- a/platform/testRunner/src/com/intellij/execution/testframework/TestFrameworkRunningModel.java +++ b/platform/testRunner/src/com/intellij/execution/testframework/TestFrameworkRunningModel.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.execution.testframework; import com.intellij.execution.testframework.ui.AbstractTestTreeBuilderBase; @@ -36,9 +36,12 @@ public interface TestFrameworkRunningModel extends Disposable { if (o1.getParentDescriptor() == o2.getParentDescriptor() && o1 instanceof BaseTestProxyNodeDescriptor && o2 instanceof BaseTestProxyNodeDescriptor) { - final Long d1 = ((BaseTestProxyNodeDescriptor)o1).getElement().getDuration(); - final Long d2 = ((BaseTestProxyNodeDescriptor)o2).getElement().getDuration(); - return Comparing.compare(d2, d1); + AbstractTestProxy t1 = ((BaseTestProxyNodeDescriptor)o1).getElement(); + AbstractTestProxy t2 = ((BaseTestProxyNodeDescriptor)o2).getElement(); + if (!TestConsoleProperties.SUITES_ALWAYS_ON_TOP.value(properties) || + t1.isLeaf() == t2.isLeaf()) { + return Comparing.compare(t2.getDuration(), t1.getDuration()); + } } return 0; };