[IMP web: improve list benchmarks

With this commit, we just slightly improve list benchmarks, to make them
go through a wider variery of code.

Since we aim to use these benchmarks to track changes in performance
through various versions, it is useful to have a good version in
saas-16.
This commit is contained in:
Géry Debongnie
2017-05-24 17:26:37 +02:00
parent a3441cfb56
commit 737a2618b5
@@ -23,7 +23,7 @@ QUnit.module('List View', {
},
};
this.arch = null;
this.run = function (assert, done) {
this.run = function (assert, done, cb) {
var data = this.data;
var arch = this.arch;
new Benchmark.Suite({})
@@ -34,6 +34,9 @@ QUnit.module('List View', {
data: data,
arch: arch,
});
if (cb) {
cb(list);
}
list.destroy();
})
.on('cycle', function(event) {
@@ -82,7 +85,7 @@ QUnit.module('List View', {
this.run(assert, done);
});
QUnit.test('simple readonly list with 200 rows 4 fields', function (assert) {
QUnit.test('editable list with 200 rows 4 fields', function (assert) {
var done = assert.async();
assert.expect(1);
@@ -94,8 +97,16 @@ QUnit.module('List View', {
bar: i % 2 === 0,
});
}
this.arch = '<tree><field name="foo"/><field name="int_field"/><field name="bar"/><field name="qux"/></tree>';
this.run(assert, done);
this.arch = '<tree editable="bottom">' +
'<field name="foo" attrs="{\'readonly\': [[\'bar\', \'=\', True]]}"/>' +
'<field name="int_field"/>' +
'<field name="bar"/>' +
'<field name="qux"/>' +
'</tree>';
this.run(assert, done, function (list) {
list.$buttons.find('.o_list_button_add').click();
list.$buttons.find('.o_list_button_discard').click();
});
});
});