cambaido ctrl por los shift

mover ventana de zonas de exclusion
puntos en zonas de exclusion
vertices mas pequeños en las zonas de exclusion
check y persistencia de las zonas d eexclusion*
distancia andando visual de un punto z al anterior
primer lector del lidar para simualciones de terreno
quitado el traductor de el selector de superficie de valhalla
This commit is contained in:
2026-09-09 14:59:44 +02:00
parent acbdd1501d
commit d50333f82a
16 changed files with 316 additions and 54 deletions

View File

@@ -50,7 +50,7 @@ var fake = new FakeValhalla();
var planner = new PlanificadorRutasServicio(null!, null!, fake, null!, null!, null!, null!);
var walk = typeof(PlanificadorRutasServicio).GetMethod("WalkValhallaCached", BindingFlags.Instance | BindingFlags.NonPublic)!;
async Task<(double[,]? linea, double distancia, double duracion)> Walk(List<List<double[]>>? zones = null) =>
await (Task<(double[,]?, double, double)>)walk.Invoke(planner, new object?[] { 43.31, -1.99, 43.32, -1.98, zones })!;
await (Task<(double[,]?, double, double)>)walk.Invoke(planner, new object?[] { 43.31, -1.99, 43.32, -1.98, zones, null })!;
List<double[]> Ring(double lon, double lat, double size) =>
new() { new[] { lon, lat }, new[] { lon + size, lat }, new[] { lon + size, lat + size },
new[] { lon, lat + size }, new[] { lon, lat } };
@@ -96,12 +96,17 @@ Console.WriteLine("Pruebas completadas.");
sealed class FakeValhalla : IClienteValhalla
{
public Task<InformacionSueloTramo?> ObtenerInformacionSueloAsync(
double[,] linea, CancellationToken cancellationToken = default)
=> Task.FromResult<InformacionSueloTramo?>(null);
public int Calls { get; private set; }
public int Zones { get; private set; }
public bool Fail { get; set; }
public Task<(double[,]? Linea, double DistanciaMetros, double DuracionSegundos)> ObtenerRutaAsync(
double latitudDesde, double longitudDesde, double latitudHasta, double longitudHasta,
string costing = "pedestrian", List<List<double[]>>? excludePolygons = null)
string costing = "pedestrian", List<List<double[]>>? excludePolygons = null,
List<double[]>? excludeLocations = null)
{
Calls++;
Zones = excludePolygons?.Count ?? 0;

View File

@@ -14,7 +14,9 @@ const path = require("node:path");
await page.goto("http://127.0.0.1:5199", { waitUntil: "domcontentloaded" });
await page.waitForFunction(() => !!window.rt?._dotNetHelper && !!window.__rtLeafletMap);
const initialErrors = errors.slice();
await page.getByRole("button", { name: "Abrir zonas a evitar", exact: true }).click();
await page.keyboard.press("Control+Shift+KeyZ");
await page.locator(".zones-panel").waitFor();
await page.waitForTimeout(1000);
await page.getByRole("button", { name: "Añadir zona", exact: true }).click();
for (const [x, y] of [[600, 420], [850, 430], [760, 640]]) {
await page.mouse.click(x, y);
@@ -24,6 +26,7 @@ const path = require("node:path");
await page.getByRole("button", { name: "Añadir zona", exact: true }).waitFor();
assert.equal(await page.locator(".zones-panel__item").count(), 1);
assert.equal(await page.locator(".rt-exclusion-vertex").count(), 3);
assert.equal(Math.round((await page.locator(".rt-exclusion-vertex").first().boundingBox()).width), 10);
const polygon = page.locator('path[stroke="#e879f9"]');
const previousShape = await polygon.getAttribute("d");
const marker = await page.locator(".rt-exclusion-vertex").first().boundingBox();
@@ -49,9 +52,32 @@ const path = require("node:path");
await page.locator(".zones-panel").waitFor({ state: "detached" });
assert.equal(await page.locator(".rt-exclusion-vertex").count(), 0);
assert.equal(await page.locator('path[stroke="#e879f9"], path[stroke="#f97316"]').count(), 0);
await page.getByRole("button", { name: "Abrir zonas a evitar", exact: true }).click();
await page.keyboard.press("Control+Shift+KeyZ");
await page.locator(".zones-panel").waitFor();
assert.equal(await page.locator(".zones-panel__item").count(), 2, "Reabrir conserva zonas editables");
await page.getByRole("checkbox", { name: "Activar zona", exact: true }).first().uncheck();
await page.waitForFunction(() => JSON.parse(localStorage.getItem("rutasdbus.zonas.v1"))[0].Activa === false);
await page.reload();
await page.waitForFunction(() => !!window.rt?._dotNetHelper && !!window.__rtLeafletMap);
await page.waitForTimeout(1000);
await page.keyboard.press("Control+Shift+KeyZ");
await page.locator(".zones-panel__item").first().waitFor();
assert.equal(await page.locator(".zones-panel__item").count(), 2, "F5 conserva zonas");
assert.equal(await page.getByRole("checkbox", { name: "Activar zona", exact: true }).first().isChecked(), false);
const panelBefore = await page.locator(".zones-panel").boundingBox();
const header = await page.locator(".zones-panel .draggable-popup-handle").boundingBox();
await page.mouse.move(header.x + 40, header.y + 15);
await page.mouse.down();
await page.mouse.move(header.x + 190, header.y + 65, { steps: 10 });
await page.mouse.up();
const panelAfter = await page.locator(".zones-panel").boundingBox();
assert.ok(Math.abs(panelAfter.x - panelBefore.x) > 50, "El modal se arrastra");
await page.screenshot({ path: path.join(artifacts, "persistencia-arrastre.png") });
await page.keyboard.press("Control+Shift+KeyF");
await page.getByRole("dialog", { name: "Guardar valores predeterminados" }).waitFor();
assert.ok(await page.getByRole("button", { name: "Guardar y sustituir", exact: true }).isVisible());
await page.screenshot({ path: path.join(artifacts, "confirmacion-fabrica.png") });
await page.getByRole("button", { name: "Cancelar", exact: true }).click();
await page.getByRole("button", { name: "Eliminar zona", exact: true }).first().click();
await page.waitForFunction(() => document.querySelectorAll(".zones-panel__item").length === 1);
assert.equal(await page.locator(".zones-panel__item").count(), 1);