fix(javaTest): correct route comparison and layer visibility
This commit is contained in:
@@ -27,6 +27,7 @@ def horizontal_overflow(page):
|
||||
|
||||
def run_point_to_point(page):
|
||||
"""Execute the real point simulation and verify route evidence is rendered."""
|
||||
page.locator("#swap-sites").click()
|
||||
page.locator("#run-point").click()
|
||||
page.locator("#task-status").wait_for(state="visible", timeout=120_000)
|
||||
page.locator("#loading-state").wait_for(state="hidden", timeout=120_000)
|
||||
@@ -60,6 +61,8 @@ def verify_map_interactions(page):
|
||||
page.locator("#show-current-route").uncheck()
|
||||
require(page.locator("#dynamic-route-layer .planned-only").count() == 0,
|
||||
"current route remained visible after its layer was disabled")
|
||||
require(page.locator("#dynamic-route-layer .approach").count() == 0,
|
||||
"approach route remained visible after the current layer was disabled")
|
||||
require(page.locator(".map-floor-layer:not([hidden]) .map-edge").count() == map_edges,
|
||||
"disabling current route changed the authoritative map")
|
||||
page.locator("#show-current-route").check()
|
||||
|
||||
@@ -40,6 +40,12 @@ final class HistoricalRouteQualityMapper {
|
||||
}
|
||||
|
||||
double historicalDistance = distanceCalculator.pathDistance(map, historicalPath);
|
||||
if (plannedPath.isEmpty()) {
|
||||
// 失败或仍等待的任务没有新路线,不能把“无结果”伪装成算法质量退化。
|
||||
return new HistoricalRouteComparison(
|
||||
HistoricalRouteComparison.Comparability.COMPARABLE,
|
||||
null, historicalDistance, null);
|
||||
}
|
||||
if (!isValidPath(map, plannedPath)) {
|
||||
return new HistoricalRouteComparison(
|
||||
HistoricalRouteComparison.Comparability.COMPARABLE,
|
||||
|
||||
@@ -548,7 +548,9 @@
|
||||
}
|
||||
hideMapHint();
|
||||
|
||||
drawPath(layer, approach, "approach", project);
|
||||
if (elements["show-current-route"].checked) {
|
||||
drawPath(layer, approach, "approach", project);
|
||||
}
|
||||
if (elements["show-initial-route"].checked) {
|
||||
drawPath(layer, initialService, "initial-service", project);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
class HistoricalRouteQualityMapperTest {
|
||||
|
||||
@@ -70,6 +71,20 @@ class HistoricalRouteQualityMapperTest {
|
||||
comparison.getQualityCategory());
|
||||
}
|
||||
|
||||
@Test
|
||||
void excludesMissingPlannedRouteFromQualityClassification() {
|
||||
GridMap map = map();
|
||||
HistoricalRouteComparison comparison = new HistoricalRouteQualityMapper().compare(
|
||||
map, "A", "D", Arrays.asList("A", "B", "D"),
|
||||
Collections.<String>emptyList(), null, null);
|
||||
|
||||
assertEquals(HistoricalRouteComparison.Comparability.COMPARABLE,
|
||||
comparison.getComparability());
|
||||
assertEquals(10.0d, comparison.getHistoricalPhysicalDistance(), 0.000001d);
|
||||
assertNull(comparison.getPlannedPhysicalDistance());
|
||||
assertNull(comparison.getQualityCategory());
|
||||
}
|
||||
|
||||
private RouteQuality quality(GridMap map, java.util.List<String> path,
|
||||
TrafficRouteSnapshot snapshot) {
|
||||
double distance = new com.ft546.wcs.demo.traffic.RouteCandidatePlanner()
|
||||
|
||||
Reference in New Issue
Block a user