O'Reilly logo

Qt 5 Projects by Marco Piccolino

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Removing a grocery item

The RemoveGroceryItem use case is pretty simple too — we mostly need to remove an item from the entities::GroceryItems list, and check that the item isn't there anymore (leaving aside, again, data persistence considerations).

We give here a possible API, leaving the implementation to the reader:

void Usecases_remove_grocery_item::item_can_be_removed(){    // Given I am given a list of available groceries    auto checkAvailableGroceries = new usecases::CheckAvailableGroceries(groceryItems, this);         QSignalSpy checkAvailableGroceriesSuccess(checkAvailableGroceries,  &usecases::CheckAvailableGroceries::success);    checkAvailableGroceries->run();    QTRY_COMPARE_WITH_TIMEOUT(checkAvailableGroceriesSuccess.count(), 1, 1000); delete ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required