Skip to content

Unit tests for QML Cards, Workflow, System, and Visualization components - #382

Open
parvathyabnair wants to merge 1 commit into
CITOpenRep:release/v1.3.4from
parvathyabnair:test-scripts
Open

parvathyabnair wants to merge 1 commit into
CITOpenRep:release/v1.3.4from
parvathyabnair:test-scripts

Conversation

@parvathyabnair

Copy link
Copy Markdown
Contributor

unit tests in tests/qml/ for cards, workflow handlers, system widgets, and charts:

ProjectDetailsCard.qml (project info, status badge, progress)
ActivityDetailsCard.qml (activity details, assignee, due date)
UpdatesDetailsCard.qml (update summary and timestamp)
FormDraftHandler.qml (draft autosave and change tracking)
AttachmentManager.qml (attachment list and file deletion signal)
VoiceTimerWidget.qml (voice recording states and timer controls)
ModelDownloadTimerWidget.qml (download progress and cancel button)
ImagePreviewer.qml (image zoom, pan, close action)
BackendBridge.qml (signal dispatch between QML and Python)
EHowerIndicator.qml (dot coordinate placement in Eisenhower matrix)
EHower.qml (matrix 2x2 grid layout)
ProjectPieChart.qml (pie slice angles and empty state)
ProjectList.qml (list model population and selection)


function test_isActivityDueTodayCalculation() {
testCard.due_date = "";
testCard.state = "";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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([]);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tests/qml/README.md

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QtCharts/ mock directory and the mechanism for mocking modules via -import tests/qml are not documented in the directory structure overview

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants