Skip to content

Commit

Permalink
Move the WebGL lines speed test to the headless webgl test method.
Browse files Browse the repository at this point in the history
Clean up after some tests.
  • Loading branch information
manthey committed Dec 22, 2016
1 parent 62d5b48 commit 8bce80d
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 106 deletions.
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,6 @@ if(SELENIUM_TESTS)
set_property(TEST "selenium:glPointsSpeed" APPEND PROPERTY ENVIRONMENT "LOAD_SPEED_THRESHOLD=1000")
set_property(TEST "selenium:glPointsSpeed" APPEND PROPERTY ENVIRONMENT "FRAMERATE_THRESHOLD=5")

set_property(TEST "selenium:glLinesSpeed" APPEND PROPERTY ENVIRONMENT "LOAD_SPEED_THRESHOLD=1000")
set_property(TEST "selenium:glLinesSpeed" APPEND PROPERTY ENVIRONMENT "FRAMERATE_THRESHOLD=2")

add_custom_target(
selenium_tests
ALL
Expand Down
8 changes: 6 additions & 2 deletions karma-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,14 @@ module.exports = {
test_case,
{pattern: 'tests/data/**/*', included: false},
{pattern: 'tests/cases/**/*.js', included: false, served: false, watched: true},
{pattern: 'tests/gl-cases/**/*.js', included: false, served: false, watched: true}
{pattern: 'tests/gl-cases/**/*.js', included: false, served: false, watched: true},
{pattern: 'dist/data/**/*', included: false},
{pattern: 'dist/examples/**/*', included: false}
],
proxies: {
'/data/': '/base/tests/data/'
'/data/': '/base/tests/data/',
'/distdata/': '/base/dist/data/',
'/examples/': '/base/dist/examples/'
},
browsers: [
'PhantomJS'
Expand Down
3 changes: 0 additions & 3 deletions testing/test-cases/selenium-tests/glLinesSpeed/include.css

This file was deleted.

This file was deleted.

65 changes: 0 additions & 65 deletions testing/test-cases/selenium-tests/glLinesSpeed/testGlLinesSpeed.py

This file was deleted.

5 changes: 5 additions & 0 deletions tests/cases/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,11 @@ describe('geo.camera', function () {
var idparent = 'geo-test-parent',
idnode = 'geo-test-node';

afterAll(function () {
$('#' + idparent).remove();
$('#' + idnode).remove();
});

/**
* Generate a node on the current page with known transforms.
*/
Expand Down
4 changes: 4 additions & 0 deletions tests/cases/tileLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,10 @@ describe('geo.tileLayer', function () {
});

describe('HTML renderering', function () {
afterAll(function () {
$('.geo-test-container').remove();
});

function layer_html(opts) {
var node = $('<div class="geo-test-container" style="display: none"/>'), m, l;
opts = opts || {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,47 @@
window.startTest = function (done) {
'use strict';
var $ = require('jquery');

var mapOptions = { center: { y: 40.0, x: -105.0 } };
describe('glLinesSpeed', function () {
var imageTest = require('../image-test');
var common = require('../test-common');

var myMap = window.geoTests.createOsmMap(mapOptions);
var myMap;

var layer = myMap.createLayer('feature');
var feature = layer.createFeature('line', {
selectionAPI: false,
dynamicDraw: true
beforeEach(function () {
imageTest.prepareImageTest();
});

window.geoTests.loadCitiesData(function (citieslatlon) {
afterEach(function () {
myMap.exit();
});

it('speed test', function (done) {
var numLines = 100000,
lines = [], i, j, times = [], starttime, stoptime, totaltime = 0,
frames = 0, animTimes = [];
frames = 0, animTimes = [], firsttime;

var mapOptions = {center: {x: -105.0, y: 40.0}};
myMap = common.createOsmMap(mapOptions, {}, true);

var layer = myMap.createLayer('feature');
var feature = layer.createFeature('line', {
selectionAPI: false,
dynamicDraw: true
});

function postLoadTest() {
times.sort(function (a, b) { return a - b; });
if (times.length > 5) {
times = times.slice(1, times.length - 1);
}
totaltime = 0;
for (i = 0; i < times.length; i += 1) {
totaltime += times[i];
}
totaltime /= times.length;
console.log('Load time ' + totaltime + ' ms (average across ' +
times.length + ' loads)');
console.log(times);
expect(totaltime).toBeLessThan(1000);
/* Test animation time. */
starttime = new Date().getTime();
animationFrame();
Expand Down Expand Up @@ -61,6 +75,7 @@ window.startTest = function (done) {
fps = 1000.0 / frametime;
console.log('Usable framerate ' + fps);
console.log(animTimes);
expect(fps).toBeGreaterThan(1.5);
$('#map').append($('<div style="display: none" id="framerateResults">')
.attr('results', fps));

Expand All @@ -80,7 +95,7 @@ window.startTest = function (done) {
myMap.draw();
stoptime = new Date().getTime();
times.push(stoptime - starttime);
if (times.length < 12 && stoptime - starttime < 10000) {
if (times.length < 12 && stoptime - firsttime < 10000) {
window.setTimeout(loadTest, 1);
} else {
postLoadTest();
Expand Down Expand Up @@ -112,25 +127,27 @@ window.startTest = function (done) {
}
}

/* Connect various cities with lines */
for (j = 1; lines.length < numLines; j += 1) {
for (i = 0; i < citieslatlon.length - j && lines.length < numLines;
i += j + 1) {
lines.push([{
x: citieslatlon[i].lon,
y: citieslatlon[i].lat,
z: citieslatlon[i].elev,
strokeColor: {r: 0, g: 0, b: 1}
}, {
x: citieslatlon[i + j].lon,
y: citieslatlon[i + j].lat,
z: citieslatlon[i + j].elev,
strokeColor: {r: 1, g: 1, b: 0}
}]);
common.loadCitiesData(function (citieslatlon) {
/* Connect various cities with lines */
for (j = 1; lines.length < numLines; j += 1) {
for (i = 0; i < citieslatlon.length - j && lines.length < numLines;
i += j + 1) {
lines.push([{
x: citieslatlon[i].lon,
y: citieslatlon[i].lat,
z: citieslatlon[i].elev,
strokeColor: {r: 0, g: 0, b: 1}
}, {
x: citieslatlon[i + j].lon,
y: citieslatlon[i + j].lat,
z: citieslatlon[i + j].elev,
strokeColor: {r: 1, g: 1, b: 0}
}]);
}
}
}

loadTest();

});
};
firsttime = new Date().getTime();
loadTest();
});
}, 30000);
});
2 changes: 1 addition & 1 deletion tests/test-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ module.exports = {
// Load at most n rows of the cities dataset.
$.ajax({
type: 'GET',
url: '/data/cities.csv',
url: '/distdata/cities.csv',
dataType: 'text',
success: function (data) {
function processCSVData(csvdata) {
Expand Down

0 comments on commit 8bce80d

Please sign in to comment.