1

I'm writing the tests of a component which looks something more or less like this:

FocusScope {
  property ...

  id: root
  width: parent.width

  Component {
    id: focusMarker

    Item {
      z: 100

      Rectangle {
        objectName: "focusMarker"
        visible: root.focus
        //...
      }
    }
  }

  ListView {
    id: sliderView
    objectName: "sliderView"
    highlight: focusMarker
    highlightRangeMode: ListView.ApplyRange
    //...
  }
}

While doing the tests of the Focus Marker part, I don't seem to get to the focusMarker. When I do


  function test_focusMarker() {
    var obj = createTemporaryObject(slider, testCase, {visible: true});
    var focusMarker = findChild(obj, "focusMarker");
    verify(focusMarker)
  }

It returns FAIL! : qmltestrunner::<Slider />::test_focusMarker() 'verify()' returned FALSE. (). I'm definitely missing something but I don't get to know what. Maybe it is something related to the fact that I need to go to a focused item for it to appear and so to be tested. However I don't really know how to do that. Your help is much appreciated :) Hope my question is clear.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Manzana
  • 205
  • 4
  • 19

0 Answers0