summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-05-14 16:47:59 +0200
committerJ-P Nurmi <jpnurmi@digia.com>2014-05-14 16:47:59 +0200
commitce4054c193ed3e6f578cbaa5dd30dfd69e765a6e (patch)
treeb17bbd0da004c5199a2eea5550e6a99d45bf26f0 /tests
parent5988cfda014ffbe8ab8640f84c4fc704335b205d (diff)
parentefbaa82fc79f3bee5486c12acf21e71cfaaed093 (diff)
downloadqtquickcontrols-ce4054c193ed3e6f578cbaa5dd30dfd69e765a6e.tar.gz
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: .qmake.conf src/controls/Private/TabBar.qml Change-Id: Id176e44fe8e402c1c2c021ecb63c8c5c75736d47
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/controls.pro5
-rw-r--r--tests/auto/controls/data/tst_calendar.qml113
-rw-r--r--tests/auto/controls/data/tst_combobox.qml14
-rw-r--r--tests/auto/controls/data/tst_keys.qml167
-rw-r--r--tests/auto/controls/data/tst_tableview.qml18
-rw-r--r--tests/auto/controls/data/tst_tabview.qml35
6 files changed, 330 insertions, 22 deletions
diff --git a/tests/auto/controls/controls.pro b/tests/auto/controls/controls.pro
index fedc36c4..1a3b0c0a 100644
--- a/tests/auto/controls/controls.pro
+++ b/tests/auto/controls/controls.pro
@@ -45,6 +45,5 @@ OTHER_FILES += \
$$PWD/data/tst_groupbox.qml \
$$PWD/data/tst_splitview.qml \
$$PWD/data/tst_styles.qml \
- $$PWD/data/tst_layout.qml
-
-win32-msvc2010:contains(QT_CONFIG, angle):CONFIG += insignificant_test # QTBUG-33029
+ $$PWD/data/tst_layout.qml \
+ $$PWD/data/tst_keys.qml
diff --git a/tests/auto/controls/data/tst_calendar.qml b/tests/auto/controls/data/tst_calendar.qml
index 843aed15..f2002844 100644
--- a/tests/auto/controls/data/tst_calendar.qml
+++ b/tests/auto/controls/data/tst_calendar.qml
@@ -642,13 +642,27 @@ Item {
dragTo(x, Math.floor(index / CalendarUtils.daysInAWeek), index, new Date(2014, 1, 24 + x));
}
- // Dragging into the next month should work.
- var firstDateInNextMonth = new Date(2014, 2, 1);
- dragTo(5, 4, 33, firstDateInNextMonth);
+ // Dragging into the next month shouldn't work, as it can lead to
+ // unwanted month changes if moving within a bunch of "next month" cells.
+ // We still emit the signals as usual, though.
+ var oldDate = calendar.selectedDate;
+ mouseMove(calendar, toPixelsX(5), toPixelsY(4), Qt.LeftButton);
+ compare(calendar.selectedDate, oldDate);
+ compare(calendar.__panel.pressedCellIndex, 32);
+ compare(calendar.__panel.hoveredCellIndex, 33);
+ compare(hoveredSignalSpy.count, 1);
+ compare(pressedSignalSpy.count, 1);
+ compare(releasedSignalSpy.count, 0);
+ compare(clickedSignalSpy.count, 0);
+
+ hoveredSignalSpy.clear();
+ pressedSignalSpy.clear();
+ releasedSignalSpy.clear();
+ clickedSignalSpy.clear();
- // Finish the drag.
- mouseRelease(calendar, toPixelsX(5), toPixelsY(0), Qt.LeftButton);
- compare(calendar.selectedDate, firstDateInNextMonth);
+ // Finish the drag over the day in the next month.
+ mouseRelease(calendar, toPixelsX(5), toPixelsY(4), Qt.LeftButton);
+ compare(calendar.selectedDate, oldDate);
compare(calendar.__panel.pressedCellIndex, -1);
compare(hoveredSignalSpy.count, 0);
compare(pressedSignalSpy.count, 0);
@@ -691,49 +705,68 @@ Item {
}
}
- function test_cellRectCalculation() {
+ function ensureGapsBetweenCells(columns, rows, availableWidth, availableHeight, gridLineWidth) {
+ for (var row = 1; row < rows; ++row) {
+ for (var col = 1; col < columns; ++col) {
+ var lastHorizontalRect = CalendarUtils.cellRectAt((row - 1) * columns + col - 1, columns, rows, availableWidth, availableHeight);
+ var thisHorizontalRect = CalendarUtils.cellRectAt((row - 1) * columns + col, columns, rows, availableWidth, availableHeight);
+ compare (lastHorizontalRect.x + lastHorizontalRect.width + gridLineWidth, thisHorizontalRect.x,
+ "No gap for grid line between column " + (col - 1) + " and " + col + " in a grid of " + columns + " columns and " + rows + " rows, "
+ + "with an availableWidth of " + availableWidth + " and availableHeight of " + availableHeight);
+
+ var lastVerticalRect = CalendarUtils.cellRectAt((row - 1) * columns + col - 1, columns, rows, availableWidth, availableHeight);
+ var thisVerticalRect = CalendarUtils.cellRectAt(row * columns + col - 1, columns, rows, availableWidth, availableHeight);
+ compare (lastVerticalRect.y + lastVerticalRect.height + gridLineWidth, thisVerticalRect.y,
+ "No gap for grid line between row " + (row - 1) + " and " + row + " in a grid of " + columns + " columns and " + rows + " rows, "
+ + "with an availableWidth of " + availableWidth + " and availableHeight of " + availableHeight);
+ }
+ }
+ }
+
+ function test_gridlessCellRectCalculation() {
var columns = CalendarUtils.daysInAWeek;
var rows = CalendarUtils.weeksOnACalendarMonth;
+ var gridLineWidth = 0;
// No extra space available.
var availableWidth = 10 * columns;
var availableHeight = 10 * rows;
- var rect = CalendarUtils.cellRectAt(0, columns, rows, availableWidth, availableHeight);
+ var rect = CalendarUtils.cellRectAt(0, columns, rows, availableWidth, availableHeight, gridLineWidth);
compare(rect.x, 0);
compare(rect.y, 0);
compare(rect.width, 10);
compare(rect.height, 10);
- rect = CalendarUtils.cellRectAt(columns - 1, columns, rows, availableWidth, availableHeight);
+ rect = CalendarUtils.cellRectAt(columns - 1, columns, rows, availableWidth, availableHeight, gridLineWidth);
compare(rect.x, (columns - 1) * 10);
compare(rect.y, 0);
compare(rect.width, 10);
compare(rect.height, 10);
- rect = CalendarUtils.cellRectAt(rows * columns - 1, columns, rows, availableWidth, availableHeight);
+ rect = CalendarUtils.cellRectAt(rows * columns - 1, columns, rows, availableWidth, availableHeight, gridLineWidth);
compare(rect.x, (columns - 1) * 10);
compare(rect.y, (rows - 1) * 10);
compare(rect.width, 10);
compare(rect.height, 10);
- ensureNoGapsBetweenCells(columns, rows, availableWidth, availableHeight);
+ ensureNoGapsBetweenCells(columns, rows, availableWidth, availableHeight, gridLineWidth);
// 1 extra pixel of space in both width and height.
availableWidth = 10 * columns + 1;
availableHeight = 10 * rows + 1;
- rect = CalendarUtils.cellRectAt(0, columns, rows, availableWidth, availableHeight);
+ rect = CalendarUtils.cellRectAt(0, columns, rows, availableWidth, availableHeight, gridLineWidth);
compare(rect.x, 0);
compare(rect.y, 0);
compare(rect.width, 10 + 1);
compare(rect.height, 10 + 1);
- rect = CalendarUtils.cellRectAt(columns - 1, columns, rows, availableWidth, availableHeight);
+ rect = CalendarUtils.cellRectAt(columns - 1, columns, rows, availableWidth, availableHeight, gridLineWidth);
compare(rect.x, (columns - 1) * 10 + 1);
compare(rect.y, 0);
compare(rect.width, 10);
compare(rect.height, 10 + 1);
- rect = CalendarUtils.cellRectAt(rows * columns - 1, columns, rows, availableWidth, availableHeight);
+ rect = CalendarUtils.cellRectAt(rows * columns - 1, columns, rows, availableWidth, availableHeight, gridLineWidth);
compare(rect.x, (columns - 1) * 10 + 1);
compare(rect.y, (rows - 1) * 10 + 1);
compare(rect.width, 10);
@@ -744,19 +777,19 @@ Item {
// 6 extra pixels in width, 5 in height.
availableWidth = 10 * columns + 6;
availableHeight = 10 * rows + 5;
- rect = CalendarUtils.cellRectAt(0, columns, rows, availableWidth, availableHeight);
+ rect = CalendarUtils.cellRectAt(0, columns, rows, availableWidth, availableHeight, gridLineWidth);
compare(rect.x, 0);
compare(rect.y, 0);
compare(rect.width, 10 + 1);
compare(rect.height, 10 + 1);
- rect = CalendarUtils.cellRectAt(columns - 1, columns, rows, availableWidth, availableHeight);
+ rect = CalendarUtils.cellRectAt(columns - 1, columns, rows, availableWidth, availableHeight, gridLineWidth);
compare(rect.x, (columns - 1) * 10 + 6);
compare(rect.y, 0);
compare(rect.width, 10);
compare(rect.height, 10 + 1);
- rect = CalendarUtils.cellRectAt(rows * columns - 1, columns, rows, availableWidth, availableHeight);
+ rect = CalendarUtils.cellRectAt(rows * columns - 1, columns, rows, availableWidth, availableHeight, gridLineWidth);
compare(rect.x, (columns - 1) * 10 + 6);
compare(rect.y, (rows - 1) * 10 + 5);
compare(rect.width, 10);
@@ -770,12 +803,54 @@ Item {
for (var i = 0; i < columns; ++i) {
++availableWidth;
- ensureNoGapsBetweenCells(columns, rows, availableWidth, availableHeight);
+ ensureNoGapsBetweenCells(columns, rows, availableWidth, availableHeight, gridLineWidth);
}
for (i = 0; i < columns; ++i) {
++availableHeight;
- ensureNoGapsBetweenCells(columns, rows, availableWidth, availableHeight);
+ ensureNoGapsBetweenCells(columns, rows, availableWidth, availableHeight, gridLineWidth);
+ }
+ }
+
+ function test_gridCellRectCalculation() {
+ var columns = CalendarUtils.daysInAWeek;
+ var rows = CalendarUtils.weeksOnACalendarMonth;
+ var gridLineWidth = 1;
+
+ var availableWidth = 10 * columns;
+ var availableHeight = 10 * rows;
+ var expectedXs = [0, 11, 21, 31, 41, 51, 61];
+ var expectedWidths = [10, 9, 9, 9, 9, 9, 9];
+ // Expected y positions and heights actually are the same as the x positions and widths in this case.
+ // The code below assumes that columns >= rows; if this becomes false, arrays for the expected
+ // y positions and heights must be created to avoid out of bounds accesses.
+ for (var row = 0; row < rows; ++row) {
+ for (var col = 0; col < columns; ++col) {
+ var index = row * columns + col;
+ var rect = CalendarUtils.cellRectAt(index, columns, rows, availableWidth, availableHeight, gridLineWidth);
+ compare(rect.x, expectedXs[col]);
+ compare(rect.y, expectedXs[row]);
+ compare(rect.width, expectedWidths[col]);
+ compare(rect.height, expectedWidths[row]);
+ }
+ }
+
+ // The available width and height of a 250x250 calendar (its implicit size).
+ availableWidth = 250;
+ availableHeight = 168;
+ expectedXs = [0, 36, 72, 108, 144, 180, 216];
+ var expectedYs = [0, 29, 57, 85, 113, 141];
+ expectedWidths = [35, 35, 35, 35, 35, 35, 34];
+ var expectedHeights = [28, 27, 27, 27, 27, 27];
+ for (row = 0; row < rows; ++row) {
+ for (col = 0; col < columns; ++col) {
+ index = row * columns + col;
+ rect = CalendarUtils.cellRectAt(index, columns, rows, availableWidth, availableHeight, gridLineWidth);
+ compare(rect.x, expectedXs[col]);
+ compare(rect.y, expectedYs[row]);
+ compare(rect.width, expectedWidths[col]);
+ compare(rect.height, expectedHeights[row]);
+ }
}
}
}
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
index 8910a30e..2052e676 100644
--- a/tests/auto/controls/data/tst_combobox.qml
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -698,6 +698,20 @@ TestCase {
}
}
+ function test_minusOneToZeroSelection_QTBUG_38036() {
+ var qmlObject = 'import QtQuick.Controls 1.2 ; ComboBox { model: ["A", "B", "C"] }'
+ var comboBox = Qt.createQmlObject(qmlObject, testCase, '');
+ compare(comboBox.currentIndex, 0)
+ compare(comboBox.currentText, "A")
+ comboBox.currentIndex = -1
+ compare(comboBox.currentIndex, -1)
+ compare(comboBox.currentText, "")
+ comboBox.currentIndex = 0
+ compare(comboBox.currentIndex, 0)
+ compare(comboBox.currentText, "A")
+ comboBox.destroy()
+ }
+
function test_keys() {
var component = Qt.createComponent("combobox/cb_keys.qml")
compare(component.status, Component.Ready)
diff --git a/tests/auto/controls/data/tst_keys.qml b/tests/auto/controls/data/tst_keys.qml
new file mode 100644
index 00000000..b1c0ed9c
--- /dev/null
+++ b/tests/auto/controls/data/tst_keys.qml
@@ -0,0 +1,167 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtTest 1.0
+
+TestCase {
+ id: testcase
+ name: "Tests_Keys"
+ when: windowShown
+ visible: true
+ width: 400
+ height: 400
+
+ function test_keys_data() {
+ return [
+ // note: test identical Keys behavior for TextInput and TextField
+ {tag:"TextInput", control: "TextInput", properties: "text: '0'"},
+ {tag:"TextField", control: "TextField", properties: "text: '0'"},
+
+ // note: test identical Keys behavior for TextEdit and TextArea
+ {tag:"TextEdit", control: "TextEdit", properties: "text: '0'"},
+ {tag:"TextArea", control: "TextArea", properties: "text: '0'"},
+
+ {tag:"SpinBox", control: "SpinBox", properties: "value: 0"},
+ {tag:"ComboBox", control: "ComboBox", properties: "currentIndex: 0; model: 3; editable: true;"},
+ ]
+ }
+
+ function test_keys(data) {
+ var qml = qsTr("import QtQuick 2.2;\
+ import QtQuick.Controls 1.2;\
+ Item {\
+ id: window;\
+ focus: true;\
+ width: 400; height: 400;\
+ property alias control: control;\
+ property var pressedKeys: [];\
+ property var releasedKeys: [];\
+ Keys.onPressed: { var keys = pressedKeys; keys.push(event.key); pressedKeys = keys; }\
+ Keys.onReleased: { var keys = releasedKeys; keys.push(event.key); releasedKeys = keys; }\
+ %1 {\
+ id: control;\
+ property bool accept: false;
+ property var pressedKeys: [];\
+ property var releasedKeys: [];\
+ Keys.onPressed: { var keys = pressedKeys; keys.push(event.key); pressedKeys = keys; event.accepted = accept; }\
+ Keys.onReleased: { var keys = releasedKeys; keys.push(event.key); releasedKeys = keys; event.accepted = accept; }\
+ %2\
+ }
+ }").arg(data.control).arg(data.properties)
+
+ var window = Qt.createQmlObject(qml, testcase, "")
+
+ verify(window)
+ verify(window.control)
+ waitForRendering(window)
+
+ window.forceActiveFocus()
+ verify(window.activeFocus)
+
+ // check that parent's key events don't end up in the control
+ keyPress(Qt.Key_0)
+ compare(window.pressedKeys, [Qt.Key_0])
+ compare(window.releasedKeys, [])
+ compare(window.control.pressedKeys, [])
+ compare(window.control.releasedKeys, [])
+ keyRelease(Qt.Key_0)
+ compare(window.pressedKeys, [Qt.Key_0])
+ compare(window.releasedKeys, [Qt.Key_0])
+ compare(window.control.pressedKeys, [])
+ compare(window.control.releasedKeys, [])
+
+ var editor = findEditor(window.control)
+ verify(editor)
+ editor.forceActiveFocus()
+ verify(editor.activeFocus)
+ compare(editor.text, "0")
+
+ editor.text = ""
+ window.control.accept = false
+
+ // check that editor's key events end up in the control, but not further.
+ // when a control doesn't accept the event, the editor does handle it.
+ keyPress(Qt.Key_1)
+ compare(window.control.pressedKeys, [Qt.Key_1])
+ compare(window.control.releasedKeys, [])
+ compare(window.pressedKeys, [Qt.Key_0])
+ compare(window.releasedKeys, [Qt.Key_0])
+ keyRelease(Qt.Key_1)
+ compare(window.control.pressedKeys, [Qt.Key_1])
+ // compare(window.control.releasedKeys, [Qt.Key_1]) // QTBUG-38289
+ compare(window.pressedKeys, [Qt.Key_0])
+ // compare(window.releasedKeys, [Qt.Key_0]) // QTBUG-38289
+ compare(editor.text, "1") // editor handled
+
+ editor.text = ""
+ window.control.accept = true
+
+ // check that editor's key events end up in the control, but not further.
+ // when a control accepts the event, the editor doesn't handle it.
+ keyPress(Qt.Key_2)
+ compare(window.control.pressedKeys, [Qt.Key_1, Qt.Key_2])
+ // compare(window.control.releasedKeys, [Qt.Key_1]) // QTBUG-38289
+ compare(window.pressedKeys, [Qt.Key_0])
+ // compare(window.releasedKeys, [Qt.Key_0]) // QTBUG-38289
+ keyRelease(Qt.Key_2)
+ compare(window.control.pressedKeys, [Qt.Key_1, Qt.Key_2])
+ // compare(window.control.releasedKeys, [Qt.Key_1, Qt.Key_2]) // QTBUG-38289
+ compare(window.pressedKeys, [Qt.Key_0])
+ // compare(window.releasedKeys, [Qt.Key_0]) // QTBUG-38289
+ compare(editor.text, "") // editor didn't handle
+
+ window.destroy()
+ }
+
+ function findEditor(parent) {
+ for (var i = 0; i < parent.children.length; ++i) {
+ var child = parent.children[i]
+ var editor = findEditor(child)
+ if (editor)
+ return editor
+ }
+ if (parent.hasOwnProperty("text") && parent.hasOwnProperty("readOnly")
+ && parent.hasOwnProperty("copy") && parent["copy"] instanceof Function
+ && parent.hasOwnProperty("paste") && parent["paste"] instanceof Function)
+ return parent
+ return null
+ }
+}
diff --git a/tests/auto/controls/data/tst_tableview.qml b/tests/auto/controls/data/tst_tableview.qml
index a9f07a8b..c99d2dcd 100644
--- a/tests/auto/controls/data/tst_tableview.qml
+++ b/tests/auto/controls/data/tst_tableview.qml
@@ -385,6 +385,24 @@ TestCase {
verify(table.selection.contains(8))
}
+ function test_initializedStyleData() {
+ var table = Qt.createQmlObject('import QtQuick.Controls 1.2; \
+ import QtQuick 2.2; \
+ TableView { \
+ model: 3; \
+ TableViewColumn{} \
+ property var items: []; \
+ property var rows: []; \
+ itemDelegate: Item{ Component.onCompleted: { items.push(styleData.row) } } \
+ rowDelegate: Item{ Component.onCompleted: { if (styleData.row !== undefined) rows.push(styleData.row) } } \
+ }'
+ , testCase, '')
+ waitForRendering(table)
+ compare(table.items, [0, 1, 2]);
+ compare(table.rows, [0, 1, 2]);
+ }
+
+
function test_usingcppqobjectmodel() {
var component = Qt.createComponent("tableview/table1_qobjectmodel.qml")
diff --git a/tests/auto/controls/data/tst_tabview.qml b/tests/auto/controls/data/tst_tabview.qml
index b7de67ba..9e556dd1 100644
--- a/tests/auto/controls/data/tst_tabview.qml
+++ b/tests/auto/controls/data/tst_tabview.qml
@@ -84,22 +84,53 @@ TestCase {
function test_addRemoveTab() {
var tabView = Qt.createQmlObject('import QtQuick 2.2; import QtQuick.Controls 1.2; TabView { }', testCase, '');
+
+ function verifyCurrentIndexCountDiff() {
+ verify(!tabView.currentIndex || tabView.count > tabView.currentIndex)
+ }
+ tabView.currentIndexChanged.connect(verifyCurrentIndexCountDiff)
+ tabView.countChanged.connect(verifyCurrentIndexCountDiff)
+
compare(tabView.count, 0)
+ compare(tabView.currentIndex, 0)
tabView.addTab("title 1", newTab)
compare(tabView.count, 1)
+ compare(tabView.currentIndex, 0)
tabView.addTab("title 2", newTab)
compare(tabView.count, 2)
+ compare(tabView.currentIndex, 0)
compare(tabView.getTab(0).title, "title 1")
compare(tabView.getTab(1).title, "title 2")
+ tabView.currentIndex = 1
+
tabView.insertTab(1, "title 3")
compare(tabView.count, 3)
+ compare(tabView.currentIndex, 2)
compare(tabView.getTab(0).title, "title 1")
compare(tabView.getTab(1).title, "title 3")
compare(tabView.getTab(2).title, "title 2")
tabView.insertTab(0, "title 4")
compare(tabView.count, 4)
+ compare(tabView.currentIndex, 3)
+ compare(tabView.getTab(0).title, "title 4")
+ compare(tabView.getTab(1).title, "title 1")
+ compare(tabView.getTab(2).title, "title 3")
+ compare(tabView.getTab(3).title, "title 2")
+
+ tabView.insertTab(tabView.count, "title 5")
+ compare(tabView.count, 5)
+ compare(tabView.currentIndex, 3)
+ compare(tabView.getTab(0).title, "title 4")
+ compare(tabView.getTab(1).title, "title 1")
+ compare(tabView.getTab(2).title, "title 3")
+ compare(tabView.getTab(3).title, "title 2")
+ compare(tabView.getTab(4).title, "title 5")
+
+ tabView.removeTab(tabView.count - 1)
+ compare(tabView.count, 4)
+ compare(tabView.currentIndex, 3)
compare(tabView.getTab(0).title, "title 4")
compare(tabView.getTab(1).title, "title 1")
compare(tabView.getTab(2).title, "title 3")
@@ -107,21 +138,25 @@ TestCase {
tabView.removeTab(0)
compare(tabView.count, 3)
+ compare(tabView.currentIndex, 2)
compare(tabView.getTab(0).title, "title 1")
compare(tabView.getTab(1).title, "title 3")
compare(tabView.getTab(2).title, "title 2")
tabView.removeTab(1)
compare(tabView.count, 2)
+ compare(tabView.currentIndex, 1)
compare(tabView.getTab(0).title, "title 1")
compare(tabView.getTab(1).title, "title 2")
tabView.removeTab(1)
compare(tabView.count, 1)
+ compare(tabView.currentIndex, 0)
compare(tabView.getTab(0).title, "title 1")
tabView.removeTab(0)
compare(tabView.count, 0)
+ compare(tabView.currentIndex, 0)
tabView.destroy()
}