Ensure that scarce resources work with var properties
[profile/ivi/qtdeclarative.git] / tests / auto / declarative / qdeclarativeecmascript / data / scarceResourceCopyImportDifferent.var.qml
1 import QtQuick 2.0
2 import Qt.test 1.0
3 import "scarceResourceCopyImportDifferent.var.js" as ScarceResourceCopyImportJs
4
5 // in this case, the ScarceResourceCopyImportJs returns a _new_, different
6 // scarce resource each time.  Invalidating one will not invalidate the others.
7
8 QtObject {
9     // this binding is evaluated once, prior to the resource being released
10     property var scarceResourceImportedCopy: ScarceResourceCopyImportJs.importScarceResource()
11
12     // the following properties are assigned on component completion.
13     property bool arePropertiesEqual
14     property var scarceResourceAssignedCopyOne;
15     property var scarceResourceAssignedCopyTwo;
16     Component.onCompleted: {
17         scarceResourceAssignedCopyOne = ScarceResourceCopyImportJs.importScarceResource();
18         arePropertiesEqual = (scarceResourceAssignedCopyOne != scarceResourceImportedCopy); // they're not the same object.
19         ScarceResourceCopyImportJs.destroyScarceResource(); // makes the MOST RECENT resource invalid (ie, assignedCopyOne).
20         scarceResourceAssignedCopyTwo = ScarceResourceCopyImportJs.importScarceResource();
21     }
22 }