Repository navigation
refactor(ui): move the test-only chart reference helpers out of ChartWidgets.h (#3116) - #3134
Merged
Merged
Conversation
…Widgets.h (#3116) reduceSeriesKeepingGaps, reduceSeriesMinMax, reduceAlignedSeries and holdLastValuesToNow, and writeReducedPoint behind the first two, had no caller under src/, benchmarks/ or the fuzzers: only tests used them. They move unchanged to tests/UI/ChartReferenceHelpers.h, in UI::Widgets::TestReference, so test_ChartWidgets.cpp keeps its peak, gap, alignment and hold-to-now tests and #2937's check of appendHeldValues + holdTimeToNow against holdLastValuesToNow. The two test_ProcessDetailsHistory.cpp tests that held a series to now now use the charts' own appendHeldValues + holdTimeToNow, with the same assertions. The descriptions the removed wrappers carried move to the production primitives (forEachStrideReducedPoint, forEachAlignedReducedPoint, holdTimeToNow, appendHeldValues), and the comments that pointed at the removed names point at those. No include of ChartWidgets.h was used only by the moved helpers. No production behaviour changes. Fixes #3116 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
src/UI/ChartWidgets.hstill carried four value-buffer helpers that nothing undersrc/,benchmarks/or the fuzz targets calls. Only tests used them. This moves them, and thewriteReducedPointhelper that only the first two used, into a test-support header. Their code is unchanged.What moved where
reduceSeriesKeepingGaps,reduceSeriesMinMax,reduceAlignedSeries,holdLastValuesToNowandwriteReducedPointnow live intests/UI/ChartReferenceHelpers.h, namespaceUI::Widgets::TestReference. The header's file comment says what they are and that nothing undersrc/may include it.forEachStrideReducedPoint,forEachMinMaxReducedPoint,forEachAlignedReducedPoint,reduceSeriesMinMaxPoints,reduceAlignedPoints,holdLastValueToNow,holdTimeToNow,appendHeldValuesand the gather functions.Tests
tests/UI/test_ChartWidgets.cppincludes the new header and pulls in the four helpers withusing TestReference::.... Every existing test is still there and its assertions are unchanged. That includes perf(ui): chart sections keep their per-publication series and window maxima between samples, so a frame between samples rebuilds only x (#843) #2937's equivalence test (HeldValuesAndAHeldTimeDrawWhatHoldLastValuesToNowDoes), which still checksappendHeldValues+holdTimeToNowagainstholdLastValuesToNow, along with the stale, empty, mismatched-length and NaN hold cases and the peak, gap, end-point, budget and aligned-series tests.tests/App/test_ProcessDetailsHistory.cpp: two tests held a series to now withholdLastValuesToNow. They now use the charts' ownappendHeldValues+holdTimeToNow, with the same assertions. This is the path Process Details actually draws with, so the App test doesn't need a UI test header.tests/UI/test_ChartWidgetsEdgeCases.cppalready used onlyreduceSeriesMinMaxPoints, so it is unchanged.Docs and comments
forEachStrideReducedPoint;forEachAlignedReducedPoint;holdTimeToNowandappendHeldValues.ChartWidgets.h,ProcessDetailsCharts.cppandSystemMetricsPanel.cppthat named a removed helper now names a production one.ChartWidgets.h's includes was needed only by the moved helpers (<initializer_list>,<limits>,<algorithm>,<array>and<type_traits>all still have production users), so none was removed.git grepfinds no remaining reference to the moved names outsidetests/UI/. Production behaviour does not change: only unused inline templates and functions left the header, plus comment edits.Fixes #3116
PR Size
Small: about 230 lines added and 185 removed. Most of it is the moved code: about 170 lines out of
ChartWidgets.h, about 157 into the new header.Type of Change
Refactor, no runtime change: test-only code moved out of a production header, plus comment updates.
Checklist
clang-tidyand addressed any warnings (no local build: see Testing)clang-formaton my changespre-commit run --all-filesor installed pre-commit hooks (pre-commit run --fileson the touched files: all passed)Testing
Not built locally. Free RAM stayed near 5.5 GB, under this machine's 8 GB build threshold, for the whole 15-minute wait, so CI is the first build and test run of this change. The suites to watch are
ChartWidgetsTest,ChartWidgetsStackTest,ChartWidgetsReduceTestand the other suites intest_ChartWidgets.cppandtest_ChartWidgetsEdgeCases.cpp, plusProcessDetailsHistoryTest.Additional Notes
tests/UI/ChartReferenceHelpers.his reached as"UI/ChartReferenceHelpers.h"through the tests directory that is already onTaskSmackTests' include path, the same way"Core/WindowSizeTestUtils.h"is. It is header-only, sotests/CMakeLists.txtdoesn't change.🤖 Generated with Claude Code