** Changed in: ubuntu-ui-toolkit (Ubuntu)
       Status: In Progress => Fix Committed

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to ubuntu-ui-toolkit in
Ubuntu.
https://bugs.launchpad.net/bugs/1621509

Title:
  'window' contextProperty is registered after components are completed

Status in ubuntu-ui-toolkit package in Ubuntu:
  Fix Committed

Bug description:
  This is the cause for the Sections index resetting after
  initialization, see bug 1610231.

  Use this code:
  ------ ModelFromList13.qml ------
  import QtQuick 2.4

  // This component is used in tst_listview_bug1621509.13.qml
  Item {
      id: root
      property var myObject
      property int count: 0 // will hold the number of changes to myObject 
after Component.completed.

      onMyObjectChanged: {
          print("myObject changed to "+myObject)
          count++;
      }
      Component.onCompleted: {
          count = 0;
      }
  }

  ------ tst_list_model_from_list_bug1621509.13.qml ------
  import QtQuick 2.4
  import QtTest 1.0

  // Ubuntu.Components is not explicitly used below, but its import causes bug 
#1621509.
  import Ubuntu.Components 1.3

  TestCase {
      id: testCase
      name: "EmbeddedListView"
      width: 100
      height: 100

      // Bug #1621509 only occurs when we wait for the window to be visible.
      // Forces the components to be completed before the test functions are 
executed.
      when: windowShown

      ModelFromList13 {
          id: embeddedListView
          QtObject {
              objectName: "one"
              id: objectOne
          }
          myObject: objectOne
      }

      Component.onCompleted: {
          print("Component completed."); // must print something to reproduce 
the bug.
      }

      function test_no_model_change_after_completed_bug1621509_bug1610231() {
          compare(embeddedListView.count, 0,
                  "The model was changed after the component was completed.");
      }
  }
  ----------

  the test will fail. Also, one can replace the TestCase by Item (and
  remove when: windowShown) and simply use qmlscene to start the app. It
  will show that myObject is set twice: before the component completed,
  and then again afterwards. I suspect the reason for this is the change
  of the 'window' context property which causes everything in the
  context (objectOne) and properties that depend on that to be re-
  evaluated.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1621509/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to