aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2018-01-31 16:28:07 +0100
committerMitch Curtis <mitch.curtis@qt.io>2018-02-05 15:14:48 +0000
commita5aa09dfd7e42f38545fe4640b0fa251bdd32be9 (patch)
tree64da9335dc93d496239767bf18a07a0e3ce8f8cb
parentb9584b13d53f36da5585051346d03a86650961bc (diff)
Make AbstractButton's icon properties win over Action's when both are set
Task-number: QTBUG-65193 Change-Id: Idff23dcc35f3c3fe41406678613b022098149318 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp50
-rw-r--r--src/quicktemplates2/qquickabstractbutton_p_p.h3
-rw-r--r--src/quicktemplates2/qquickicon.cpp82
-rw-r--r--src/quicktemplates2/qquickicon_p.h14
-rw-r--r--tests/auto/controls/data/tst_abstractbutton.qml221
5 files changed, 321 insertions, 49 deletions
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp
index b1522995..768b923b 100644
--- a/src/quicktemplates2/qquickabstractbutton.cpp
+++ b/src/quicktemplates2/qquickabstractbutton.cpp
@@ -306,6 +306,21 @@ void QQuickAbstractButtonPrivate::setText(const QString &newText, bool isExplici
q->buttonChange(QQuickAbstractButton::ButtonTextChange);
}
+void QQuickAbstractButtonPrivate::updateEffectiveIcon()
+{
+ Q_Q(QQuickAbstractButton);
+ // We store effectiveIcon because we need to be able to tell if the icon has actually changed.
+ // If we only stored our icon and the action's icon, and resolved in the getter, we'd have
+ // no way of knowing what the old value was here. As an added benefit, we only resolve when
+ // something has changed, as opposed to doing it unconditionally in the icon() getter.
+ const QQuickIcon newEffectiveIcon = action ? icon.resolve(action->icon()) : icon;
+ if (newEffectiveIcon == effectiveIcon)
+ return;
+
+ effectiveIcon = newEffectiveIcon;
+ emit q->iconChanged();
+}
+
void QQuickAbstractButtonPrivate::click()
{
Q_Q(QQuickAbstractButton);
@@ -687,17 +702,14 @@ void QQuickAbstractButton::setIndicator(QQuickItem *indicator)
QQuickIcon QQuickAbstractButton::icon() const
{
Q_D(const QQuickAbstractButton);
- return d->icon;
+ return d->effectiveIcon;
}
void QQuickAbstractButton::setIcon(const QQuickIcon &icon)
{
Q_D(QQuickAbstractButton);
- if (d->icon == icon)
- return;
-
d->icon = icon;
- emit iconChanged();
+ d->updateEffectiveIcon();
}
/*!
@@ -759,7 +771,7 @@ void QQuickAbstractButton::setAction(QQuickAction *action)
QObjectPrivate::disconnect(oldAction, &QQuickAction::triggered, d, &QQuickAbstractButtonPrivate::click);
QObjectPrivate::disconnect(oldAction, &QQuickAction::textChanged, d, &QQuickAbstractButtonPrivate::actionTextChange);
- disconnect(oldAction, &QQuickAction::iconChanged, this, &QQuickAbstractButton::setIcon);
+ QObjectPrivate::disconnect(oldAction, &QQuickAction::iconChanged, d, &QQuickAbstractButtonPrivate::updateEffectiveIcon);
disconnect(oldAction, &QQuickAction::checkedChanged, this, &QQuickAbstractButton::setChecked);
disconnect(oldAction, &QQuickAction::checkableChanged, this, &QQuickAbstractButton::setCheckable);
disconnect(oldAction, &QQuickAction::enabledChanged, this, &QQuickItem::setEnabled);
@@ -770,33 +782,11 @@ void QQuickAbstractButton::setAction(QQuickAction *action)
QObjectPrivate::connect(action, &QQuickAction::triggered, d, &QQuickAbstractButtonPrivate::click);
QObjectPrivate::connect(action, &QQuickAction::textChanged, d, &QQuickAbstractButtonPrivate::actionTextChange);
- connect(action, &QQuickAction::iconChanged, this, &QQuickAbstractButton::setIcon);
+ QObjectPrivate::connect(action, &QQuickAction::iconChanged, d, &QQuickAbstractButtonPrivate::updateEffectiveIcon);
connect(action, &QQuickAction::checkedChanged, this, &QQuickAbstractButton::setChecked);
connect(action, &QQuickAction::checkableChanged, this, &QQuickAbstractButton::setCheckable);
connect(action, &QQuickAction::enabledChanged, this, &QQuickItem::setEnabled);
- QQuickIcon actionIcon = action->icon();
-
- QString name = actionIcon.name();
- if (!name.isEmpty())
- d->icon.setName(name);
-
- QUrl source = actionIcon.source();
- if (!source.isEmpty())
- d->icon.setSource(source);
-
- int width = actionIcon.width();
- if (width > 0)
- d->icon.setWidth(width);
-
- int height = actionIcon.height();
- if (height)
- d->icon.setHeight(height);
-
- QColor color = actionIcon.color();
- if (color != Qt::transparent)
- d->icon.setColor(color);
-
setChecked(action->isChecked());
setCheckable(action->isCheckable());
setEnabled(action->isEnabled());
@@ -807,6 +797,8 @@ void QQuickAbstractButton::setAction(QQuickAction *action)
if (oldText != text())
buttonChange(ButtonTextChange);
+ d->updateEffectiveIcon();
+
emit actionChanged();
}
diff --git a/src/quicktemplates2/qquickabstractbutton_p_p.h b/src/quicktemplates2/qquickabstractbutton_p_p.h
index 3b2a87f2..c82f8cf7 100644
--- a/src/quicktemplates2/qquickabstractbutton_p_p.h
+++ b/src/quicktemplates2/qquickabstractbutton_p_p.h
@@ -93,6 +93,8 @@ public:
void actionTextChange();
void setText(const QString &text, bool isExplicit);
+ void updateEffectiveIcon();
+
void click();
void trigger();
void toggle(bool value);
@@ -119,6 +121,7 @@ public:
QKeySequence shortcut;
#endif
QQuickIcon icon;
+ QQuickIcon effectiveIcon;
QPointF pressPoint;
Qt::MouseButtons pressButtons;
QQuickDeferredPointer<QQuickItem> indicator;
diff --git a/src/quicktemplates2/qquickicon.cpp b/src/quicktemplates2/qquickicon.cpp
index 0b0127d3..79af62b1 100644
--- a/src/quicktemplates2/qquickicon.cpp
+++ b/src/quicktemplates2/qquickicon.cpp
@@ -44,7 +44,8 @@ public:
QQuickIconPrivate()
: width(0),
height(0),
- color(Qt::transparent)
+ color(Qt::transparent),
+ resolveMask(0)
{
}
@@ -53,6 +54,18 @@ public:
int width;
int height;
QColor color;
+
+ enum ResolveProperties {
+ NameResolved = 0x0001,
+ SourceResolved = 0x0002,
+ WidthResolved = 0x0004,
+ HeightResolved = 0x0008,
+ ColorResolved = 0x0010,
+ AllPropertiesResolved = 0x1ffff
+ };
+
+ // This is based on QFont's resolve_mask.
+ int resolveMask;
};
QQuickIcon::QQuickIcon()
@@ -101,7 +114,17 @@ QString QQuickIcon::name() const
void QQuickIcon::setName(const QString &name)
{
+ if ((d->resolveMask & QQuickIconPrivate::NameResolved) && d->name == name)
+ return;
+
d->name = name;
+ d->resolveMask |= QQuickIconPrivate::NameResolved;
+}
+
+void QQuickIcon::resetName()
+{
+ d->name = QString();
+ d->resolveMask &= ~QQuickIconPrivate::NameResolved;
}
QUrl QQuickIcon::source() const
@@ -111,7 +134,17 @@ QUrl QQuickIcon::source() const
void QQuickIcon::setSource(const QUrl &source)
{
+ if ((d->resolveMask & QQuickIconPrivate::SourceResolved) && d->source == source)
+ return;
+
d->source = source;
+ d->resolveMask |= QQuickIconPrivate::SourceResolved;
+}
+
+void QQuickIcon::resetSource()
+{
+ d->source = QString();
+ d->resolveMask &= ~QQuickIconPrivate::SourceResolved;
}
int QQuickIcon::width() const
@@ -121,7 +154,17 @@ int QQuickIcon::width() const
void QQuickIcon::setWidth(int width)
{
+ if ((d->resolveMask & QQuickIconPrivate::WidthResolved) && d->width == width)
+ return;
+
d->width = width;
+ d->resolveMask |= QQuickIconPrivate::WidthResolved;
+}
+
+void QQuickIcon::resetWidth()
+{
+ d->width = 0;
+ d->resolveMask &= ~QQuickIconPrivate::WidthResolved;
}
int QQuickIcon::height() const
@@ -131,7 +174,17 @@ int QQuickIcon::height() const
void QQuickIcon::setHeight(int height)
{
+ if ((d->resolveMask & QQuickIconPrivate::HeightResolved) && d->height == height)
+ return;
+
d->height = height;
+ d->resolveMask |= QQuickIconPrivate::HeightResolved;
+}
+
+void QQuickIcon::resetHeight()
+{
+ d->height = 0;
+ d->resolveMask &= ~QQuickIconPrivate::HeightResolved;
}
QColor QQuickIcon::color() const
@@ -141,12 +194,39 @@ QColor QQuickIcon::color() const
void QQuickIcon::setColor(const QColor &color)
{
+ if ((d->resolveMask & QQuickIconPrivate::ColorResolved) && d->color == color)
+ return;
+
d->color = color;
+ d->resolveMask |= QQuickIconPrivate::ColorResolved;
}
void QQuickIcon::resetColor()
{
d->color = Qt::transparent;
+ d->resolveMask &= ~QQuickIconPrivate::ColorResolved;
+}
+
+QQuickIcon QQuickIcon::resolve(const QQuickIcon &other) const
+{
+ QQuickIcon resolved = *this;
+
+ if (!(d->resolveMask & QQuickIconPrivate::NameResolved))
+ resolved.setName(other.name());
+
+ if (!(d->resolveMask & QQuickIconPrivate::SourceResolved))
+ resolved.setSource(other.source());
+
+ if (!(d->resolveMask & QQuickIconPrivate::WidthResolved))
+ resolved.setWidth(other.width());
+
+ if (!(d->resolveMask & QQuickIconPrivate::HeightResolved))
+ resolved.setHeight(other.height());
+
+ if (!(d->resolveMask & QQuickIconPrivate::ColorResolved))
+ resolved.setColor(other.color());
+
+ return resolved;
}
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickicon_p.h b/src/quicktemplates2/qquickicon_p.h
index 6e28f2a9..5eb18205 100644
--- a/src/quicktemplates2/qquickicon_p.h
+++ b/src/quicktemplates2/qquickicon_p.h
@@ -62,10 +62,10 @@ class QQuickIconPrivate;
class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickIcon
{
Q_GADGET
- Q_PROPERTY(QString name READ name WRITE setName FINAL)
- Q_PROPERTY(QUrl source READ source WRITE setSource FINAL)
- Q_PROPERTY(int width READ width WRITE setWidth FINAL)
- Q_PROPERTY(int height READ height WRITE setHeight FINAL)
+ Q_PROPERTY(QString name READ name WRITE setName RESET name FINAL)
+ Q_PROPERTY(QUrl source READ source WRITE setSource RESET source FINAL)
+ Q_PROPERTY(int width READ width WRITE setWidth RESET width FINAL)
+ Q_PROPERTY(int height READ height WRITE setHeight RESET height FINAL)
Q_PROPERTY(QColor color READ color WRITE setColor RESET resetColor FINAL)
public:
@@ -81,20 +81,26 @@ public:
QString name() const;
void setName(const QString &name);
+ void resetName();
QUrl source() const;
void setSource(const QUrl &source);
+ void resetSource();
int width() const;
void setWidth(int width);
+ void resetWidth();
int height() const;
void setHeight(int height);
+ void resetHeight();
QColor color() const;
void setColor(const QColor &color);
void resetColor();
+ QQuickIcon resolve(const QQuickIcon &other) const;
+
private:
QSharedDataPointer<QQuickIconPrivate> d;
};
diff --git a/tests/auto/controls/data/tst_abstractbutton.qml b/tests/auto/controls/data/tst_abstractbutton.qml
index 7acf9882..a46a08df 100644
--- a/tests/auto/controls/data/tst_abstractbutton.qml
+++ b/tests/auto/controls/data/tst_abstractbutton.qml
@@ -285,6 +285,208 @@ TestCase {
compare(spy.count, data.resetChanged ? 1 : 0)
}
+ function test_actionIcon_data() {
+ var data = []
+
+ // Save duplicating the rows by reusing them with different properties of the same type.
+ // This means that the first loop will test icon.name and the second one will test icon.source.
+ var stringPropertyValueSuffixes = [
+ { propertyName: "name", valueSuffix: "IconName" },
+ { propertyName: "source", valueSuffix: "IconSource" }
+ ]
+
+ for (var i = 0; i < stringPropertyValueSuffixes.length; ++i) {
+ var propertyName = stringPropertyValueSuffixes[i].propertyName
+ var valueSuffix = stringPropertyValueSuffixes[i].valueSuffix
+
+ var buttonPropertyValue = "Button" + valueSuffix
+ var buttonPropertyValue2 = "Button" + valueSuffix + "2"
+ var actionPropertyValue = "Action" + valueSuffix
+ var actionPropertyValue2 = "Action" + valueSuffix + "2"
+
+ data.push({ tag: "implicit " + propertyName, property: propertyName,
+ initButton: undefined, initAction: actionPropertyValue,
+ assignExpected: actionPropertyValue, assignChanged: true,
+ resetExpected: "", resetChanged: true })
+ data.push({ tag: "explicit " + propertyName, property: propertyName,
+ initButton: buttonPropertyValue, initAction: actionPropertyValue,
+ assignExpected: buttonPropertyValue, assignChanged: false,
+ resetExpected: buttonPropertyValue, resetChanged: false })
+ data.push({ tag: "empty button " + propertyName, property: propertyName,
+ initButton: "", initAction: actionPropertyValue,
+ assignExpected: "", assignChanged: false,
+ resetExpected: "", resetChanged: false })
+ data.push({ tag: "empty action " + propertyName, property: propertyName,
+ initButton: buttonPropertyValue, initAction: "",
+ assignExpected: buttonPropertyValue, assignChanged: false,
+ resetExpected: buttonPropertyValue, resetChanged: false })
+ data.push({ tag: "empty both " + propertyName, property: propertyName,
+ initButton: undefined, initAction: "",
+ assignExpected: "", assignChanged: false,
+ resetExpected: "", resetChanged: false })
+ data.push({ tag: "modify button " + propertyName, property: propertyName,
+ initButton: undefined, initAction: actionPropertyValue,
+ assignExpected: actionPropertyValue, assignChanged: true,
+ modifyButton: buttonPropertyValue2,
+ modifyButtonExpected: buttonPropertyValue2, modifyButtonChanged: true,
+ resetExpected: buttonPropertyValue2, resetChanged: false })
+ data.push({ tag: "modify implicit action " + propertyName, property: propertyName,
+ initButton: undefined, initAction: actionPropertyValue,
+ assignExpected: actionPropertyValue, assignChanged: true,
+ modifyAction: actionPropertyValue2,
+ modifyActionExpected: actionPropertyValue2, modifyActionChanged: true,
+ resetExpected: "", resetChanged: true })
+ data.push({ tag: "modify explicit action " + propertyName, property: propertyName,
+ initButton: buttonPropertyValue, initAction: actionPropertyValue,
+ assignExpected: buttonPropertyValue, assignChanged: false,
+ modifyAction: actionPropertyValue2,
+ modifyActionExpected: buttonPropertyValue, modifyActionChanged: false,
+ resetExpected: buttonPropertyValue, resetChanged: false })
+ }
+
+ var intPropertyNames = [
+ "width",
+ "height",
+ ]
+
+ for (i = 0; i < intPropertyNames.length; ++i) {
+ propertyName = intPropertyNames[i]
+
+ buttonPropertyValue = 20
+ buttonPropertyValue2 = 21
+ actionPropertyValue = 40
+ actionPropertyValue2 = 41
+ var defaultValue = 0
+
+ data.push({ tag: "implicit " + propertyName, property: propertyName,
+ initButton: undefined, initAction: actionPropertyValue,
+ assignExpected: actionPropertyValue, assignChanged: true,
+ resetExpected: defaultValue, resetChanged: true })
+ data.push({ tag: "explicit " + propertyName, property: propertyName,
+ initButton: buttonPropertyValue, initAction: actionPropertyValue,
+ assignExpected: buttonPropertyValue, assignChanged: false,
+ resetExpected: buttonPropertyValue, resetChanged: false })
+ data.push({ tag: "default button " + propertyName, property: propertyName,
+ initButton: defaultValue, initAction: actionPropertyValue,
+ assignExpected: defaultValue, assignChanged: false,
+ resetExpected: defaultValue, resetChanged: false })
+ data.push({ tag: "default action " + propertyName, property: propertyName,
+ initButton: buttonPropertyValue, initAction: defaultValue,
+ assignExpected: buttonPropertyValue, assignChanged: false,
+ resetExpected: buttonPropertyValue, resetChanged: false })
+ data.push({ tag: "default both " + propertyName, property: propertyName,
+ initButton: undefined, initAction: defaultValue,
+ assignExpected: defaultValue, assignChanged: false,
+ resetExpected: defaultValue, resetChanged: false })
+ data.push({ tag: "modify button " + propertyName, property: propertyName,
+ initButton: undefined, initAction: actionPropertyValue,
+ assignExpected: actionPropertyValue, assignChanged: true,
+ modifyButton: buttonPropertyValue2,
+ modifyButtonExpected: buttonPropertyValue2, modifyButtonChanged: true,
+ resetExpected: buttonPropertyValue2, resetChanged: false })
+ data.push({ tag: "modify implicit action " + propertyName, property: propertyName,
+ initButton: undefined, initAction: actionPropertyValue,
+ assignExpected: actionPropertyValue, assignChanged: true,
+ modifyAction: actionPropertyValue2,
+ modifyActionExpected: actionPropertyValue2, modifyActionChanged: true,
+ resetExpected: defaultValue, resetChanged: true })
+ data.push({ tag: "modify explicit action " + propertyName, property: propertyName,
+ initButton: buttonPropertyValue, initAction: actionPropertyValue,
+ assignExpected: buttonPropertyValue, assignChanged: false,
+ modifyAction: actionPropertyValue2,
+ modifyActionExpected: buttonPropertyValue, modifyActionChanged: false,
+ resetExpected: buttonPropertyValue, resetChanged: false })
+ }
+
+ propertyName = "color"
+ buttonPropertyValue = "#aa0000"
+ buttonPropertyValue2 = "#ff0000"
+ actionPropertyValue = "#0000aa"
+ actionPropertyValue2 = "#0000ff"
+ defaultValue = "#00000000"
+
+ data.push({ tag: "implicit " + propertyName, property: propertyName,
+ initButton: undefined, initAction: actionPropertyValue,
+ assignExpected: actionPropertyValue, assignChanged: true,
+ resetExpected: defaultValue, resetChanged: true })
+ data.push({ tag: "explicit " + propertyName, property: propertyName,
+ initButton: buttonPropertyValue, initAction: actionPropertyValue,
+ assignExpected: buttonPropertyValue, assignChanged: false,
+ resetExpected: buttonPropertyValue, resetChanged: false })
+ data.push({ tag: "default button " + propertyName, property: propertyName,
+ initButton: defaultValue, initAction: actionPropertyValue,
+ assignExpected: defaultValue, assignChanged: false,
+ resetExpected: defaultValue, resetChanged: false })
+ data.push({ tag: "default action " + propertyName, property: propertyName,
+ initButton: buttonPropertyValue, initAction: defaultValue,
+ assignExpected: buttonPropertyValue, assignChanged: false,
+ resetExpected: buttonPropertyValue, resetChanged: false })
+ data.push({ tag: "default both " + propertyName, property: propertyName,
+ initButton: undefined, initAction: defaultValue,
+ assignExpected: defaultValue, assignChanged: false,
+ resetExpected: defaultValue, resetChanged: false })
+ data.push({ tag: "modify button " + propertyName, property: propertyName,
+ initButton: undefined, initAction: actionPropertyValue,
+ assignExpected: actionPropertyValue, assignChanged: true,
+ modifyButton: buttonPropertyValue2,
+ modifyButtonExpected: buttonPropertyValue2, modifyButtonChanged: true,
+ resetExpected: buttonPropertyValue2, resetChanged: false })
+ data.push({ tag: "modify implicit action " + propertyName, property: propertyName,
+ initButton: undefined, initAction: actionPropertyValue,
+ assignExpected: actionPropertyValue, assignChanged: true,
+ modifyAction: actionPropertyValue2,
+ modifyActionExpected: actionPropertyValue2, modifyActionChanged: true,
+ resetExpected: defaultValue, resetChanged: true })
+ data.push({ tag: "modify explicit action " + propertyName, property: propertyName,
+ initButton: buttonPropertyValue, initAction: actionPropertyValue,
+ assignExpected: buttonPropertyValue, assignChanged: false,
+ modifyAction: actionPropertyValue2,
+ modifyActionExpected: buttonPropertyValue, modifyActionChanged: false,
+ resetExpected: buttonPropertyValue, resetChanged: false })
+
+ return data;
+ }
+
+ function test_actionIcon(data) {
+ var control = createTemporaryObject(button, testCase)
+ verify(control)
+ control.icon[data.property] = data.initButton
+
+ var act = action.createObject(control)
+ act.icon[data.property] = data.initAction
+
+ var spy = signalSpy.createObject(control, {target: control, signalName: "iconChanged"})
+ verify(spy.valid)
+
+ // assign action
+ spy.clear()
+ control.action = act
+ compare(control.icon[data.property], data.assignExpected)
+ compare(spy.count, data.assignChanged ? 1 : 0)
+
+ // modify button
+ if (data.hasOwnProperty("modifyButton")) {
+ spy.clear()
+ control.icon[data.property] = data.modifyButton
+ compare(control.icon[data.property], data.modifyButtonExpected)
+ compare(spy.count, data.modifyButtonChanged ? 1 : 0)
+ }
+
+ // modify action
+ if (data.hasOwnProperty("modifyAction")) {
+ spy.clear()
+ act.icon[data.property] = data.modifyAction
+ compare(control.icon[data.property], data.modifyActionExpected)
+ compare(spy.count, data.modifyActionChanged ? 1 : 0)
+ }
+
+ // reset action
+ spy.clear()
+ control.action = null
+ compare(control.icon[data.property], data.resetExpected)
+ compare(spy.count, data.resetChanged ? 1 : 0)
+ }
+
Component {
id: actionButton
AbstractButton {
@@ -305,8 +507,6 @@ TestCase {
// initial values
compare(control.text, "Default")
- compare(control.icon.name, "default")
- compare(control.icon.source, "qrc:/icons/default.png")
compare(control.checkable, true)
compare(control.checked, true)
compare(control.enabled, false)
@@ -316,14 +516,10 @@ TestCase {
// changes via action
control.action.text = "Action"
- control.action.icon.name = "action"
- control.action.icon.source = "qrc:/icons/action.png"
control.action.checkable = false
control.action.checked = false
control.action.enabled = true
compare(control.text, "Action") // propagates
- compare(control.icon.name, "action") // propagates
- compare(control.icon.source, "qrc:/icons/action.png") // propagates
compare(control.checkable, false) // propagates
compare(control.checked, false) // propagates
compare(control.enabled, true) // propagates
@@ -331,31 +527,26 @@ TestCase {
// changes via button
control.text = "Button"
- control.icon.name = "button"
- control.icon.source = "qrc:/icons/button.png"
control.checkable = true
control.checked = true
control.enabled = false
compare(control.text, "Button")
- compare(control.icon.name, "button")
- compare(control.icon.source, "qrc:/icons/button.png")
compare(control.checkable, true)
compare(control.checked, true)
compare(control.enabled, false)
compare(control.action.text, "Action") // does NOT propagate
- compare(control.action.icon.name, "action") // does NOT propagate
- compare(control.action.icon.source, "qrc:/icons/action.png") // does NOT propagate
compare(control.action.checkable, true) // propagates
compare(control.action.checked, true) // propagates
compare(control.action.enabled, true) // does NOT propagate
compare(textSpy.count, 2)
- // remove the action so that only the button's text is left
+ // remove the action so that only the button's properties are left
control.action = null
compare(control.text, "Button")
compare(textSpy.count, 2)
- // setting an action while button has text shouldn't cause a change in the button's effective text
+ // setting an action while button has a particular property set
+ // shouldn't cause a change in the button's effective property value
var secondAction = createTemporaryObject(action, testCase)
verify(secondAction)
secondAction.text = "SecondAction"
@@ -363,7 +554,7 @@ TestCase {
compare(control.text, "Button")
compare(textSpy.count, 2)
- // test setting an action with empty text
+ // test setting an action whose properties aren't set
var thirdAction = createTemporaryObject(action, testCase)
verify(thirdAction)
control.action = thirdAction