Extend the header speed sparkline

Use twelve pixels of unused zero-speed label spacing for a longer graph while preserving the overall header control width and room for wider speed values.
This commit is contained in:
Sucukdeluxe
2026-08-26 15:07:54 +02:00
parent 5931c8de75
commit a087e11b52
2 changed files with 12 additions and 5 deletions
+2 -2
View File
@@ -623,7 +623,7 @@ body,
} }
.speed-sparkline-canvas { .speed-sparkline-canvas {
width: 116px; width: 128px;
height: 22px; height: 22px;
display: block; display: block;
} }
@@ -634,7 +634,7 @@ body,
font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums;
color: var(--text); color: var(--text);
white-space: nowrap; white-space: nowrap;
min-width: 66px; min-width: 54px;
text-align: right; text-align: right;
} }
+8 -1
View File
@@ -557,7 +557,7 @@ describe("bandwidth chart palette", () => {
expect(theme).toMatch(/:focus-visible\s*\{[^}]*outline:\s*2px solid var\(--ui-focus\);/s); expect(theme).toMatch(/:focus-visible\s*\{[^}]*outline:\s*2px solid var\(--ui-focus\);/s);
expect(shell).toContain("color: var(--ui-update-text);"); expect(shell).toContain("color: var(--ui-update-text);");
expect(collector.match(/color:\s*var\(--ui-primary-text\);/g)).toHaveLength(3); expect(collector.match(/color:\s*var\(--ui-primary-text\);/g)).toHaveLength(1);
}); });
it("requests only the semantic UI color properties and keeps the computed font family", () => { it("requests only the semantic UI color properties and keeps the computed font family", () => {
@@ -593,6 +593,13 @@ describe("bandwidth chart palette", () => {
expect(palette).toEqual({ accent: "rgb(74, 222, 128)" }); expect(palette).toEqual({ accent: "rgb(74, 222, 128)" });
}); });
it("uses the spare zero-speed label space for a longer sparkline", () => {
const css = readFileSync(new URL("../src/renderer/styles.css", import.meta.url), "utf8");
expect(css).toMatch(/\.speed-sparkline-canvas\s*\{[^}]*width:\s*128px;/s);
expect(css).toMatch(/\.speed-sparkline-value\s*\{[^}]*min-width:\s*54px;/s);
});
it("aligns the idle speed line to one physical pixel at every display scale", () => { it("aligns the idle speed line to one physical pixel at every display scale", () => {
expect(getIdleSparklineStroke(22, 1)).toEqual({ y: 20.5, lineWidth: 1 }); expect(getIdleSparklineStroke(22, 1)).toEqual({ y: 20.5, lineWidth: 1 });
expect(getIdleSparklineStroke(22, 1.25)).toEqual({ y: 20.4, lineWidth: 0.8 }); expect(getIdleSparklineStroke(22, 1.25)).toEqual({ y: 20.4, lineWidth: 0.8 });