DataDecorator tests

In Chapter 5, Data, we created various classes deriving from DataDecorator. Let's create companion test classes for each of those and test the following functionalities:

  • Object construction
  • Setting the value
  • Getting the value as JSON
  • Updating the value from JSON

In cm-tests/source/data, create the DateTimeDecoratorTests, EnumeratorDecoratorTests, IntDecoratorTests, and StringDecoratorTests classes.

Let’s begin with the simplest suite, IntDecoratorTests. The tests will be broadly similar across the suites, so once we’ve written one suite, we will be able to copy most of it across to the other suites and then supplement as necessary.

int-decorator-tests.h:

#ifndef INTDECORATORTESTS_H
#define INTDECORATORTESTS_H
#include ...

Get Learn Qt 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.