App 2.19.9: remove the Foreground apps card from the Logs tab
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
This commit is contained in:
@@ -1,69 +0,0 @@
|
||||
package com.evsuite.abrp;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/** The Logs tab's foreground-app lines — pure JVM. */
|
||||
public class ForegroundHistoryTest {
|
||||
|
||||
private static final TimeZone UTC = TimeZone.getTimeZone("UTC");
|
||||
|
||||
private static ForegroundHistory.Event at(long seconds, String pkg, String cls) {
|
||||
return new ForegroundHistory.Event(seconds * 1000, pkg, cls);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void newestFirstWithTheActivityShortened() {
|
||||
List<String> lines = ForegroundHistory.lines(Arrays.asList(
|
||||
at(3600, "com.saic.launcher", "com.saic.launcher.Home"),
|
||||
at(3700, "com.example.carplay", "com.example.carplay.ui.ProjectionActivity")),
|
||||
10, UTC);
|
||||
assertEquals(Arrays.asList(
|
||||
"01:01:40 com.example.carplay .ui.ProjectionActivity",
|
||||
"01:00:00 com.saic.launcher .Home"), lines);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void repeatsOfTheSameScreenCollapse() {
|
||||
List<String> lines = ForegroundHistory.lines(Arrays.asList(
|
||||
at(1, "a.b", "a.b.Main"),
|
||||
at(2, "a.b", "a.b.Main"),
|
||||
at(3, "a.b", "a.b.Other"),
|
||||
at(4, "c.d", null),
|
||||
at(5, "c.d", null)), 10, UTC);
|
||||
assertEquals(Arrays.asList(
|
||||
"00:00:04 c.d",
|
||||
"00:00:03 a.b .Other",
|
||||
"00:00:01 a.b .Main"), lines);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void limitKeepsTheNewest() {
|
||||
List<String> lines = ForegroundHistory.lines(Arrays.asList(
|
||||
at(1, "one", null), at(2, "two", null), at(3, "three", null)), 2, UTC);
|
||||
assertEquals(Arrays.asList("00:00:03 three", "00:00:02 two"), lines);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void emptyAndBlankEventsGiveNoLines() {
|
||||
assertTrue(ForegroundHistory.lines(Collections.emptyList(), 10, UTC).isEmpty());
|
||||
assertTrue(ForegroundHistory.lines(Arrays.asList(null, at(1, "", null), at(2, null, "x")), 10, UTC).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aClassOutsideItsPackageStaysWhole() {
|
||||
assertEquals("com.other.Activity", ForegroundHistory.shortClass("a.b", "com.other.Activity"));
|
||||
assertEquals(".Main", ForegroundHistory.shortClass("a.b", "a.b.Main"));
|
||||
assertNull(ForegroundHistory.shortClass("a.b", null));
|
||||
// "a.bc.Main" is not inside "a.b".
|
||||
assertEquals("a.bc.Main", ForegroundHistory.shortClass("a.b", "a.bc.Main"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user