Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-67221

Expose QImage of TestCase::grabImage

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Reported
    • Priority: Not Evaluated
    • Resolution: Unresolved
    • Affects Version/s: 5.10.0
    • Fix Version/s: None
    • Component/s: Testing: QuickTest
    • Labels:
      None

      Description

      The result from grabImage has a very restricted interface where you can only access it from QML and only save, compare to other grabImage results and fetch pixel values.

      For our tests we would like to be able to

      • compare to an arbitrary QImage (e.g. loaded from files)
      • do fuzzy comparisons on the C++ side to speed up the process

      Getting read access to the internal QImage of QuickTestImageObject would fully suffice. To that end there needs to be a getter and the class must be part of the public interface.

      As a workaround we currently crack open (via UB!) the class ourselves:
      1. We redeclared this class for our tests and simply made the image public.
      2. To allow passing the QuickTestImageObject result from QML to C++ we use a QObject* interface and do an unconditional `static_cast<QuickTestImageObject*>` to avoid problems with `dynamic_cast` having different typeids for our and Qt's version of QuickTestImageObject.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              qt.team.quick.subscriptions Qt Quick and Widgets Team
              Reporter:
              spynacker Martin Schulze
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes