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

[iOS] Qt Quick Test: TestCase.wait() while Animator is running can freeze application indefinitely

    XMLWordPrintable

Details

    • iOS/tvOS/watchOS

    Description

      The freeze only affects physical iOS devices. The iOS Simulator and macOS are not affected.

       

      Code

      // MyRadioButton.qml
      import QtQuick
      import QtQuick.Controls.Basic
      
      RadioButton {
          id: radioButton
          checkable: true
          onCheckedChanged: {
              if (checked) {
                  uncheckAnimator.stop();
                  checkAnimator.start();
                  console.log("Started checkAnimation")
              } else {
                  checkAnimator.stop();
                  uncheckAnimator.start();
                  console.log("Started uncheckAnimation")
              }
          }
      
          indicator: Rectangle {
              implicitWidth: 22
              implicitHeight: 22
              x: 12
              y: 13
              radius: 11
              color: "transparent"
              border.color: "black"
              border.width: 2
      
              Rectangle {
                  id: checkedDot
                  width: 12
                  height: width
                  x: 5
                  y: x
                  radius: width/2
                  color: "black"
                  scale: 0
      
                  ScaleAnimator{
                      id: checkAnimator
                      target: checkedDot
                      from: 0
                      to: 1
                      duration: 200
                  }
      
                  ScaleAnimator{
                      id: uncheckAnimator
                      target: checkedDot
                      from: 1
                      to: 0
                      duration: 200
                  }
              }
          }
      
          // ...
      }
      
      //tst_Action.qml
      TestCase {
          //...
          function test_clicked(){
              compare(obj1.checked, false, "TEST: Both RadioButtons unchecked: RadioButton 1");
              compare(obj2.checked, false, "TEST: Both RadioButtons unchecked: RadioButton 2");
              wait(1000);
              mouseClick(obj1);
              console.log("Clicked obj1. Waiting...")
              wait(1000);
              console.log("Done")
              compare(obj1.checked, true, "TEST: First RadioButton checked: RadioButton 1");
              compare(obj2.checked, false, "TEST: First RadioButton checked: RadioButton 2");
              mouseClick(obj2);
              console.log("Clicked obj2. Waiting...")
              wait(1000);
              console.log("Done")
              compare(obj1.checked, false, "TEST: Second RadioButton checked: RadioButton 1");
              compare(obj2.checked, true, "TEST: Second RadioButton checked: RadioButton 2");
          }
      }
      

       

      Outcome

      QML debugging is enabled. Only use this in a safe environment.
      stale focus object 0x0 , doing manual update
      ********* Start testing of main *********
      Config: Using QtTest library 6.5.4, Qt 6.5.4 (arm64-little_endian-lp64 static debug build; by Apple LLVM 14.0.0 (clang-1400.0.29.202)), ios 16.6
      PASS   : main::RadioButton::initTestCase()
      QWARN  : main::RadioButton::test_clicked() stale focus object 0x282bfc360 , doing manual update
      QDEBUG : main::RadioButton::test_clicked() qml: Started checkAnimation
      QDEBUG : main::RadioButton::test_clicked() qml: Clicked obj1. Waiting...
      
          <FROZEN FOREVER>
      

       

      Workarounds

      • Replace the ScaleAnimator with a PropertyAnimation, OR
      • Set the environment variable, QSG_RENDER_LOOP=basic

      Attachments

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

        Activity

          People

            kwpark Kwanghyo Park
            skoh-qt Sze Howe Koh
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes