aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2018-05-02 14:12:42 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2018-05-02 13:43:26 +0000
commit5ef9d74f8329786505c9db615c40e39d3942e935 (patch)
treef66507a2c339fb59768b848290006a0934b894c3
parent6858d4e9873644c255b19d251e5522c7cf4b7160 (diff)
TextArea: add support for background insets
Same as 5adce042 for QQuickControl. [ChangeLog][Controls][TextArea] Added topInset, bottomInset, leftInset, and rightInset properties to control the geometry of the background similarly to how paddings control the geometry of the contentItem. Change-Id: I1e1b3a79a9f477ec7b64ec4c6cc8021bbf48adc0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/imports/controls/TextArea.qml4
-rw-r--r--src/imports/controls/fusion/TextArea.qml4
-rw-r--r--src/imports/controls/imagine/TextArea.qml4
-rw-r--r--src/imports/controls/material/TextArea.qml6
-rw-r--r--src/imports/controls/universal/TextArea.qml4
-rw-r--r--src/quicktemplates2/qquicktextarea.cpp210
-rw-r--r--src/quicktemplates2/qquicktextarea_p.h28
-rw-r--r--src/quicktemplates2/qquicktextarea_p_p.h22
-rw-r--r--tests/auto/controls/data/tst_textarea.qml145
9 files changed, 395 insertions, 32 deletions
diff --git a/src/imports/controls/TextArea.qml b/src/imports/controls/TextArea.qml
index 1446ba29..2250cb5e 100644
--- a/src/imports/controls/TextArea.qml
+++ b/src/imports/controls/TextArea.qml
@@ -43,10 +43,10 @@ T.TextArea {
id: control
implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
- implicitBackgroundWidth,
+ implicitBackgroundWidth + leftInset + rightInset,
placeholder.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
- implicitBackgroundHeight,
+ implicitBackgroundHeight + topInset + bottomInset,
placeholder.implicitHeight + topPadding + bottomPadding)
padding: 6
diff --git a/src/imports/controls/fusion/TextArea.qml b/src/imports/controls/fusion/TextArea.qml
index e3314e94..04b25cb3 100644
--- a/src/imports/controls/fusion/TextArea.qml
+++ b/src/imports/controls/fusion/TextArea.qml
@@ -45,10 +45,10 @@ T.TextArea {
id: control
implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
- implicitBackgroundWidth,
+ implicitBackgroundWidth + leftInset + rightInset,
placeholder.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
- implicitBackgroundHeight,
+ implicitBackgroundHeight + topInset + bottomInset,
placeholder.implicitHeight + topPadding + bottomPadding)
padding: 6
diff --git a/src/imports/controls/imagine/TextArea.qml b/src/imports/controls/imagine/TextArea.qml
index c7f54f61..dbbc7c35 100644
--- a/src/imports/controls/imagine/TextArea.qml
+++ b/src/imports/controls/imagine/TextArea.qml
@@ -45,10 +45,10 @@ T.TextArea {
id: control
implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
- implicitBackgroundWidth,
+ implicitBackgroundWidth + leftInset + rightInset,
placeholder.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
- implicitBackgroundHeight,
+ implicitBackgroundHeight + topInset + bottomInset,
placeholder.implicitHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
diff --git a/src/imports/controls/material/TextArea.qml b/src/imports/controls/material/TextArea.qml
index 82554b16..7fbc5cbc 100644
--- a/src/imports/controls/material/TextArea.qml
+++ b/src/imports/controls/material/TextArea.qml
@@ -45,10 +45,10 @@ T.TextArea {
id: control
implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
- implicitBackgroundWidth,
+ implicitBackgroundWidth + leftInset + rightInset,
placeholder.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(contentHeight + 1 + topPadding + bottomPadding,
- implicitBackgroundHeight,
+ implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
+ implicitBackgroundHeight + topInset + bottomInset,
placeholder.implicitHeight + 1 + topPadding + bottomPadding)
topPadding: 8
diff --git a/src/imports/controls/universal/TextArea.qml b/src/imports/controls/universal/TextArea.qml
index 3a4e8752..83602426 100644
--- a/src/imports/controls/universal/TextArea.qml
+++ b/src/imports/controls/universal/TextArea.qml
@@ -44,10 +44,10 @@ T.TextArea {
id: control
implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
- implicitBackgroundWidth,
+ implicitBackgroundWidth + leftInset + rightInset,
placeholder.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
- implicitBackgroundHeight,
+ implicitBackgroundHeight + topInset + bottomInset,
placeholder.implicitHeight + topPadding + bottomPadding)
// TextControlThemePadding + 2 (border)
diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp
index 87a7c5e4..46619342 100644
--- a/src/quicktemplates2/qquicktextarea.cpp
+++ b/src/quicktemplates2/qquicktextarea.cpp
@@ -153,26 +153,74 @@ QQuickTextAreaPrivate::~QQuickTextAreaPrivate()
#endif
}
-void QQuickTextAreaPrivate::resizeBackground()
+void QQuickTextAreaPrivate::setTopInset(qreal value, bool reset)
{
Q_Q(QQuickTextArea);
- if (background) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(background);
- if (!p->widthValid && qFuzzyIsNull(background->x())) {
- if (flickable)
- background->setWidth(flickable->width());
- else
- background->setWidth(q->width());
- p->widthValid = false;
- }
- if (!p->heightValid && qFuzzyIsNull(background->y())) {
- if (flickable)
- background->setHeight(flickable->height());
- else
- background->setHeight(q->height());
- p->heightValid = false;
- }
+ const QMarginsF oldInset = getInset();
+ extra.value().topInset = value;
+ extra.value().hasTopInset = !reset;
+ if (!qFuzzyCompare(oldInset.top(), value)) {
+ emit q->topInsetChanged();
+ q->insetChange(getInset(), oldInset);
+ }
+}
+
+void QQuickTextAreaPrivate::setLeftInset(qreal value, bool reset)
+{
+ Q_Q(QQuickTextArea);
+ const QMarginsF oldInset = getInset();
+ extra.value().leftInset = value;
+ extra.value().hasLeftInset = !reset;
+ if (!qFuzzyCompare(oldInset.left(), value)) {
+ emit q->leftInsetChanged();
+ q->insetChange(getInset(), oldInset);
+ }
+}
+
+void QQuickTextAreaPrivate::setRightInset(qreal value, bool reset)
+{
+ Q_Q(QQuickTextArea);
+ const QMarginsF oldInset = getInset();
+ extra.value().rightInset = value;
+ extra.value().hasRightInset = !reset;
+ if (!qFuzzyCompare(oldInset.right(), value)) {
+ emit q->rightInsetChanged();
+ q->insetChange(getInset(), oldInset);
+ }
+}
+
+void QQuickTextAreaPrivate::setBottomInset(qreal value, bool reset)
+{
+ Q_Q(QQuickTextArea);
+ const QMarginsF oldInset = getInset();
+ extra.value().bottomInset = value;
+ extra.value().hasBottomInset = !reset;
+ if (!qFuzzyCompare(oldInset.bottom(), value)) {
+ emit q->bottomInsetChanged();
+ q->insetChange(getInset(), oldInset);
+ }
+}
+
+void QQuickTextAreaPrivate::resizeBackground()
+{
+ if (!background)
+ return;
+
+ resizingBackground = true;
+
+ QQuickItemPrivate *p = QQuickItemPrivate::get(background);
+ if (((!p->widthValid || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
+ || (extra.isAllocated() && (extra->hasLeftInset || extra->hasRightInset))) {
+ background->setX(getLeftInset());
+ background->setWidth(width - getLeftInset() - getRightInset());
+ }
+ if (((!p->heightValid || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
+ || (extra.isAllocated() && (extra->hasTopInset || extra->hasBottomInset))) {
+ background->setY(getTopInset());
+ background->setHeight(height - getTopInset() - getBottomInset());
}
+
+ resizingBackground = false;
}
/*!
@@ -502,7 +550,7 @@ QQuickTextArea::~QQuickTextArea()
Q_D(QQuickTextArea);
if (d->flickable)
d->detachFlickable();
- QQuickControlPrivate::removeImplicitSizeListener(d->background, d);
+ QQuickControlPrivate::removeImplicitSizeListener(d->background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
}
QQuickTextAreaAttached *QQuickTextArea::qmlAttachedProperties(QObject *object)
@@ -554,7 +602,12 @@ void QQuickTextArea::setBackground(QQuickItem *background)
const qreal oldImplicitBackgroundWidth = implicitBackgroundWidth();
const qreal oldImplicitBackgroundHeight = implicitBackgroundHeight();
- QQuickControlPrivate::removeImplicitSizeListener(d->background, d);
+ if (d->extra.isAllocated()) {
+ d->extra.value().hasBackgroundWidth = false;
+ d->extra.value().hasBackgroundHeight = false;
+ }
+
+ QQuickControlPrivate::removeImplicitSizeListener(d->background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
delete d->background;
d->background = background;
@@ -567,7 +620,12 @@ void QQuickTextArea::setBackground(QQuickItem *background)
background->setZ(-1);
if (isComponentComplete())
d->resizeBackground();
- QQuickControlPrivate::addImplicitSizeListener(background, d);
+ QQuickItemPrivate *p = QQuickItemPrivate::get(background);
+ if (p->widthValid || p->heightValid) {
+ d->extra.value().hasBackgroundWidth = p->widthValid;
+ d->extra.value().hasBackgroundHeight = p->heightValid;
+ }
+ QQuickControlPrivate::addImplicitSizeListener(background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
}
if (!qFuzzyCompare(oldImplicitBackgroundWidth, implicitBackgroundWidth()))
@@ -803,6 +861,110 @@ qreal QQuickTextArea::implicitBackgroundHeight() const
return d->background->implicitHeight();
}
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::TextArea::topInset
+
+ This property holds the top inset for the background.
+
+ \sa {Control Layout}, bottomInset
+*/
+qreal QQuickTextArea::topInset() const
+{
+ Q_D(const QQuickTextArea);
+ return d->getTopInset();
+}
+
+void QQuickTextArea::setTopInset(qreal inset)
+{
+ Q_D(QQuickTextArea);
+ d->setTopInset(inset);
+}
+
+void QQuickTextArea::resetTopInset()
+{
+ Q_D(QQuickTextArea);
+ d->setTopInset(0, true);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::TextArea::leftInset
+
+ This property holds the left inset for the background.
+
+ \sa {Control Layout}, rightInset
+*/
+qreal QQuickTextArea::leftInset() const
+{
+ Q_D(const QQuickTextArea);
+ return d->getLeftInset();
+}
+
+void QQuickTextArea::setLeftInset(qreal inset)
+{
+ Q_D(QQuickTextArea);
+ d->setLeftInset(inset);
+}
+
+void QQuickTextArea::resetLeftInset()
+{
+ Q_D(QQuickTextArea);
+ d->setLeftInset(0, true);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::TextArea::rightInset
+
+ This property holds the right inset for the background.
+
+ \sa {Control Layout}, leftInset
+*/
+qreal QQuickTextArea::rightInset() const
+{
+ Q_D(const QQuickTextArea);
+ return d->getRightInset();
+}
+
+void QQuickTextArea::setRightInset(qreal inset)
+{
+ Q_D(QQuickTextArea);
+ d->setRightInset(inset);
+}
+
+void QQuickTextArea::resetRightInset()
+{
+ Q_D(QQuickTextArea);
+ d->setRightInset(0, true);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::TextArea::bottomInset
+
+ This property holds the bottom inset for the background.
+
+ \sa {Control Layout}, topInset
+*/
+qreal QQuickTextArea::bottomInset() const
+{
+ Q_D(const QQuickTextArea);
+ return d->getBottomInset();
+}
+
+void QQuickTextArea::setBottomInset(qreal inset)
+{
+ Q_D(QQuickTextArea);
+ d->setBottomInset(inset);
+}
+
+void QQuickTextArea::resetBottomInset()
+{
+ Q_D(QQuickTextArea);
+ d->setBottomInset(0, true);
+}
+
void QQuickTextArea::classBegin()
{
Q_D(QQuickTextArea);
@@ -866,6 +1028,14 @@ void QQuickTextArea::geometryChanged(const QRectF &newGeometry, const QRectF &ol
d->resizeBackground();
}
+void QQuickTextArea::insetChange(const QMarginsF &newInset, const QMarginsF &oldInset)
+{
+ Q_D(QQuickTextArea);
+ Q_UNUSED(newInset);
+ Q_UNUSED(oldInset);
+ d->resizeBackground();
+}
+
QSGNode *QQuickTextArea::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
{
Q_D(QQuickTextArea);
diff --git a/src/quicktemplates2/qquicktextarea_p.h b/src/quicktemplates2/qquicktextarea_p.h
index 2f73265b..3c38dabf 100644
--- a/src/quicktemplates2/qquicktextarea_p.h
+++ b/src/quicktemplates2/qquicktextarea_p.h
@@ -73,11 +73,15 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTextArea : public QQuickTextEdit
Q_PROPERTY(bool hoverEnabled READ isHoverEnabled WRITE setHoverEnabled RESET resetHoverEnabled NOTIFY hoverEnabledChanged FINAL REVISION 1)
// 2.3 (Qt 5.10)
Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3)
- Q_CLASSINFO("DeferredPropertyNames", "background")
// 2.5 (Qt 5.12)
Q_PROPERTY(QColor placeholderTextColor READ placeholderTextColor WRITE setPlaceholderTextColor NOTIFY placeholderTextColorChanged FINAL REVISION 5)
Q_PROPERTY(qreal implicitBackgroundWidth READ implicitBackgroundWidth NOTIFY implicitBackgroundWidthChanged FINAL REVISION 5)
Q_PROPERTY(qreal implicitBackgroundHeight READ implicitBackgroundHeight NOTIFY implicitBackgroundHeightChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal topInset READ topInset WRITE setTopInset RESET resetTopInset NOTIFY topInsetChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal leftInset READ leftInset WRITE setLeftInset RESET resetLeftInset NOTIFY leftInsetChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal rightInset READ rightInset WRITE setRightInset RESET resetRightInset NOTIFY rightInsetChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal bottomInset READ bottomInset WRITE setBottomInset RESET resetBottomInset NOTIFY bottomInsetChanged FINAL REVISION 5)
+ Q_CLASSINFO("DeferredPropertyNames", "background")
public:
explicit QQuickTextArea(QQuickItem *parent = nullptr);
@@ -119,6 +123,22 @@ public:
qreal implicitBackgroundWidth() const;
qreal implicitBackgroundHeight() const;
+ qreal topInset() const;
+ void setTopInset(qreal inset);
+ void resetTopInset();
+
+ qreal leftInset() const;
+ void setLeftInset(qreal inset);
+ void resetLeftInset();
+
+ qreal rightInset() const;
+ void setRightInset(qreal inset);
+ void resetRightInset();
+
+ qreal bottomInset() const;
+ void setBottomInset(qreal inset);
+ void resetBottomInset();
+
Q_SIGNALS:
void fontChanged();
void implicitWidthChanged3();
@@ -138,6 +158,10 @@ Q_SIGNALS:
Q_REVISION(5) void placeholderTextColorChanged();
Q_REVISION(5) void implicitBackgroundWidthChanged();
Q_REVISION(5) void implicitBackgroundHeightChanged();
+ Q_REVISION(5) void topInsetChanged();
+ Q_REVISION(5) void leftInsetChanged();
+ Q_REVISION(5) void rightInsetChanged();
+ Q_REVISION(5) void bottomInsetChanged();
protected:
void classBegin() override;
@@ -145,6 +169,8 @@ protected:
void itemChange(ItemChange change, const ItemChangeData &value) override;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ virtual void insetChange(const QMarginsF &newInset, const QMarginsF &oldInset);
+
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) override;
void focusInEvent(QFocusEvent *event) override;
diff --git a/src/quicktemplates2/qquicktextarea_p_p.h b/src/quicktemplates2/qquicktextarea_p_p.h
index 90e4db7b..408cc391 100644
--- a/src/quicktemplates2/qquicktextarea_p_p.h
+++ b/src/quicktemplates2/qquicktextarea_p_p.h
@@ -80,6 +80,17 @@ public:
return static_cast<QQuickTextAreaPrivate *>(QObjectPrivate::get(item));
}
+ inline QMarginsF getInset() const { return QMarginsF(getLeftInset(), getTopInset(), getRightInset(), getBottomInset()); }
+ inline qreal getTopInset() const { return extra.isAllocated() ? extra->topInset : 0; }
+ inline qreal getLeftInset() const { return extra.isAllocated() ? extra->leftInset : 0; }
+ inline qreal getRightInset() const { return extra.isAllocated() ? extra->rightInset : 0; }
+ inline qreal getBottomInset() const { return extra.isAllocated() ? extra->bottomInset : 0; }
+
+ void setTopInset(qreal value, bool reset = false);
+ void setLeftInset(qreal value, bool reset = false);
+ void setRightInset(qreal value, bool reset = false);
+ void setBottomInset(qreal value, bool reset = false);
+
void resizeBackground();
void resolveFont();
@@ -138,11 +149,22 @@ public:
#endif
struct ExtraData {
+ bool hasTopInset = false;
+ bool hasLeftInset = false;
+ bool hasRightInset = false;
+ bool hasBottomInset = false;
+ bool hasBackgroundWidth = false;
+ bool hasBackgroundHeight = false;
+ qreal topInset = 0;
+ qreal leftInset = 0;
+ qreal rightInset = 0;
+ qreal bottomInset = 0;
QFont requestedFont;
QPalette requestedPalette;
};
QLazilyAllocated<ExtraData> extra;
+ bool resizingBackground = false;
QPalette resolvedPalette;
QQuickDeferredPointer<QQuickItem> background;
QString placeholder;
diff --git a/tests/auto/controls/data/tst_textarea.qml b/tests/auto/controls/data/tst_textarea.qml
index 719a1e0d..0a50e033 100644
--- a/tests/auto/controls/data/tst_textarea.qml
+++ b/tests/auto/controls/data/tst_textarea.qml
@@ -543,4 +543,149 @@ TestCase {
}
}
+ function test_inset() {
+ var control = createTemporaryObject(textArea, testCase, {background: rectangle.createObject(control)})
+ verify(control)
+
+ var topInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "topInsetChanged"})
+ verify(topInsetSpy.valid)
+
+ var leftInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "leftInsetChanged"})
+ verify(leftInsetSpy.valid)
+
+ var rightInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "rightInsetChanged"})
+ verify(rightInsetSpy.valid)
+
+ var bottomInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "bottomInsetChanged"})
+ verify(bottomInsetSpy.valid)
+
+ var topInsetChanges = 0
+ var leftInsetChanges = 0
+ var rightInsetChanges = 0
+ var bottomInsetChanges = 0
+
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+
+ control.width = 100
+ control.height = 100
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 100)
+ compare(control.background.height, 100)
+
+ control.topInset = 10
+ compare(control.topInset, 10)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, ++topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 10)
+ compare(control.background.width, 100)
+ compare(control.background.height, 90)
+
+ control.leftInset = 20
+ compare(control.topInset, 10)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, ++leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 10)
+ compare(control.background.width, 80)
+ compare(control.background.height, 90)
+
+ control.rightInset = 30
+ compare(control.topInset, 10)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, ++rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 10)
+ compare(control.background.width, 50)
+ compare(control.background.height, 90)
+
+ control.bottomInset = 40
+ compare(control.topInset, 10)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, ++bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 10)
+ compare(control.background.width, 50)
+ compare(control.background.height, 50)
+
+ control.topInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, ++topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 0)
+ compare(control.background.width, 50)
+ compare(control.background.height, 60)
+
+ control.leftInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, ++leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 70)
+ compare(control.background.height, 60)
+
+ control.rightInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, ++rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 100)
+ compare(control.background.height, 60)
+
+ control.bottomInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, ++bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 100)
+ compare(control.background.height, 100)
+ }
}