Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
9b3a76f7
Commit
9b3a76f7
authored
7 years ago
by
Anton Tarasov
Browse files
Options
Download
Email Patches
Plain Diff
Use assertTiming for IconsLoadTimeTest
parent
8c106084
Branches unavailable
Tags unavailable
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
platform/platform-tests/testSrc/com/intellij/util/IconsLoadTimeTest.java
+11
-7
...rm-tests/testSrc/com/intellij/util/IconsLoadTimeTest.java
with
11 additions
and
7 deletions
+11
-7
platform/platform-tests/testSrc/com/intellij/util/IconsLoadTimeTest.java
+
11
-
7
View file @
9b3a76f7
...
...
@@ -8,15 +8,19 @@ import com.intellij.internal.IconsLoadTime.StatData;
import
com.intellij.openapi.util.registry.Registry
;
import
com.intellij.openapi.util.registry.RegistryValue
;
import
com.intellij.testFramework.PlatformTestUtil
;
import
junit.framework.TestCase
;
import
org.junit.After
;
import
org.junit.Assume
;
import
org.junit.Before
;
import
org.junit.Test
;
import
java.io.*
;
import
static
com
.
intellij
.
testFramework
.
PlatformTestUtil
.
assertTiming
;
import
static
com
.
intellij
.
util
.
ImageLoader
.
ImageDesc
.
Type
;
import
static
junit
.
framework
.
TestCase
.
assertEquals
;
import
static
junit
.
framework
.
TestCase
.
assertNotNull
;
import
static
org
.
junit
.
Assume
.
assumeTrue
;
/**
* Estimates SVG icon average load time.
...
...
@@ -24,7 +28,7 @@ import static junit.framework.TestCase.assertNotNull;
* @author tav
*/
public
class
IconsLoadTimeTest
{
private
static
final
int
SVG_ICON_AVERAGE_LOAD_TIME_E
STIMA
TE
=
1
0
;
// ms
private
static
final
int
SVG_ICON_AVERAGE_LOAD_TIME_E
XPEC
TE
D
=
3
0
;
// ms
private
static
final
int
SVG_ICON_QUORUM_COUNT
=
50
;
// a list of icons for which we have SVG versions
...
...
@@ -53,15 +57,15 @@ public class IconsLoadTimeTest {
}
}
StatData
svgData
=
IconsLoadTime
.
getStatData
(
false
,
Type
.
SVG
);
assertNotNull
(
"failed to gather SVG load statistics"
,
svgData
);
assumeTrue
(
"no SVG load statistics gathered"
,
svgData
!=
null
);
System
.
out
.
println
(
svgData
);
ass
ertEquals
(
"too few icons loaded: "
+
svgData
.
count
+
"; expecting > "
+
SVG_ICON_QUORUM_COUNT
,
true
,
svgData
.
count
>=
SVG_ICON_QUORUM_COUNT
);
ass
umeTrue
(
"too few icons loaded: "
+
svgData
.
count
+
"; expecting > "
+
SVG_ICON_QUORUM_COUNT
,
svgData
.
count
>=
SVG_ICON_QUORUM_COUNT
);
assertEquals
(
"SVG icon load time raised to "
+
String
.
format
(
"%.02fms"
,
svgData
.
averageTime
)
+
", exceeding max "
+
SVG_ICON_AVERAGE_LOAD_TIME_ESTIMATE
+
"ms"
,
true
,
svgData
.
averageTime
<=
SVG_ICON_AVERAGE_LOAD_TIME_ESTIMATE
);
assertTiming
(
"SVG icon load time raised to "
+
String
.
format
(
"%.02fms"
,
svgData
.
averageTime
),
SVG_ICON_AVERAGE_LOAD_TIME_EXPECTED
,
(
int
)
svgData
.
averageTime
);
}
@After
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help