From 32839179c2662aa42f2a728e257900c301482655 Mon Sep 17 00:00:00 2001 From: Sergey Gaychuk Date: Wed, 2 Dec 2009 03:52:27 +0200 Subject: [PATCH] test: add filter test parsing --- app/test/aaUITestFrame.jsm | 84 ++++++++++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 28 deletions(-) diff --git a/app/test/aaUITestFrame.jsm b/app/test/aaUITestFrame.jsm index 7a1dc38..05507b7 100644 --- a/app/test/aaUITestFrame.jsm +++ b/app/test/aaUITestFrame.jsm @@ -420,12 +420,14 @@ function aaSortTest(input) { cid: Components.ID(), contractID: "", name:, - text:, - type:, - getFilterTypes: function() - return array of objects - { - clmnID: "", - type: "" + object: { + text:, + type:, + getFilterTypes: function() - return array of objects + { + clmnID: "", + type: "" + } } } */ @@ -436,7 +438,7 @@ function aaFilterTest(input) { base._contractID = input.contractID; base._name = input.name; - base._getFilterTypes = input.getFilterTypes; + base._getFilterTypes = input.object.getFilterTypes; base._text = input.object.text; base._type = input.object.type; @@ -478,37 +480,41 @@ function aaFilterTest(input) { } base._check = function (runner) { //find column id by type - var types = this._getFilterTypes(); - if (types.length > 0) { - var clmnID = null; - for (var i = 0; i < types.length; i++) { - if (this._type == types[i].type) { - clmnID = types[i].clmnID; - break; + if (this._getFilterTypes) { + var types = this._getFilterTypes(); + if (types.length > 0) { + var clmnID = null; + for (var i = 0; i < types.length; i++) { + if (this._type == types[i].type) { + clmnID = types[i].clmnID; + break; + } } - } - if (clmnID) { - var tree = getElement(runner, "page1.tree"); - if (tree) { - var column = tree.columns.getNamedColumn(clmnID); - if (column) { - for (var i = 0; i < tree.view.rowCount; i++) { - var rowTxt = tree.view.getCellText(i, column); - if (!this._defaultComparator(rowTxt, this._text)) { - this.addJSFailure(runner, "[aaFilterTest::_test] at row " + i + " text " + rowTxt + " is not contain string " + this._text); + if (clmnID) { + var tree = getElement(runner, "page1.tree"); + if (tree) { + var column = tree.columns.getNamedColumn(clmnID); + if (column) { + for (var i = 0; i < tree.view.rowCount; i++) { + var rowTxt = tree.view.getCellText(i, column); + if (!this._defaultComparator(rowTxt, this._text)) { + this.addJSFailure(runner, "[aaFilterTest::_check] at row " + i + " text " + rowTxt + " is not contain string " + this._text); + } } + } else { + this.addJSFailure(runner, "[aaFilterTest::_check] cann't find column with ID: " + clmnID); } } else { - this.addJSFailure(runner, "[aaFilterTest::_test] cann't find column with ID: " + clmnID); + this.addJSFailure(runner, "[aaFilterTest::_check] cann't find tree element"); } } else { - this.addJSFailure(runner, "[aaFilterTest::_test] cann't find tree element"); + this.addJSFailure(runner, "[aaFilterTest::_check] cann't find clmn id by type: " + this._type); } } else { - this.addJSFailure(runner, "[aaFilterTest::_check] cann't find clmn id by type: " + this._type); + this.addJSFailure(runner, "[aaFilterTest::_check] returned types coun is 0"); } } else { - this.addJSFailure(runner, "[aaFilterTest::_check] returned types coun is 0"); + this.addJSFailure(runner, "[aaFilterTest::_check] cann't find function getFilterTypes"); } } @@ -569,6 +575,16 @@ example for commands actions cid: Components.ID() } } +{ + name: 'filter', + data: { + cid: Components.ID(), + object: { + text: "" + type: "" + } + } +} */ function aaJSTestPagePage1Module(pageName) { var base = aaJSTestPageModule(pageName); @@ -622,6 +638,10 @@ function aaJSTestPagePage1Module(pageName) { this.addSortTest(action.data); return true; break; + case 'filter': + this.addFilterTest(action.data); + return true; + break; } return this.aaJSTestPageModule_parseAction(action); } @@ -639,7 +659,15 @@ function aaJSTestPagePage1Module(pageName) { data.getSortColumns = this.getSortColumns; this._add(aaSortTest(data)); } + base.addFilterTest = function (data) { + //sorting + data.contractID = this.generateContractID(data.object.type + "/filter"); + data.name = "aaPage_" + this._pageName + "_Filter_" + data.object.type; + data.object.getFilterTypes = this.getFilterTypes; + this._add(aaFilterTest(data)); + } base.getSortColumns = null; + base.getFilterTypes = null; base.addPage1CommandTest = function(cid, command, checkF) { if (cid in this._map) { this._repeat(this._map[cid]); -- 2.11.4.GIT