Repository navigation
Unit tests for QML Cards, Workflow, System, and Visualization components - #382
parvathyabnair wants to merge 1 commit into
Conversation
|
|
||
| function test_isActivityDueTodayCalculation() { | ||
| testCard.due_date = ""; | ||
| testCard.state = ""; |
There was a problem hiding this comment.
If this test runs on a machine where the local date differs from the UTC date (e.g., UTC+5:30 in
early morning or UTC-8 in late evening), now.getUTCDate() will not equal today.getDate(). This will
cause test_isActivityDueTodayCalculation to intermittently fail depending on the hour of execution.
| angleSpan: 45 | ||
| }); | ||
|
|
||
| slices.push(sliceObj); |
There was a problem hiding this comment.
In QML JavaScript engine (V4), array in-place mutations do not emit slicesChanged notifications. As
a result, property bindings depending on slices.length (such as readonly property int count:
slices.length) do not trigger reactivity on append.
Suggested Fix: Assign a new array or reassign slices after appending:
slices = slices.concat([sliceObj]);
|
|
||
| function test_loadEmptyDataSetsNoDataTitle() { | ||
| testChart.load([]); | ||
|
|
There was a problem hiding this comment.
In test_loadEmptyDataSetsNoDataTitle, test_loadSingleProject, test_loadMultipleProjectsSorting, and
test_loadMoreThanTenProjectsAggregatesOthers, the only assertion made is:
verify(testChart.implicitHeight > 0);
The test does not assert that the chart title shows "(No Data)", nor does it verify that the slice
count is correct, that slices are sorted, or that items past 10 are aggregated into "Others".
Suggested Fix: Exposing aliases on ProjectPieChart.qml (e.g., property alias chartTitleText: chartTitle.text and property alias series: pieSeries) would allow testing the actual outcomes of load() instead of merely testing that load() does not throw an error.
There was a problem hiding this comment.
QtCharts/ mock directory and the mechanism for mocking modules via -import tests/qml are not documented in the directory structure overview
unit tests in tests/qml/ for cards, workflow handlers, system widgets, and charts: