2014-12-09 22:46:03 +08:00
|
|
|
var torque = require('../lib/torque/core');
|
2013-11-19 00:34:50 +08:00
|
|
|
|
2014-12-09 22:46:03 +08:00
|
|
|
QUnit.module('torque');
|
2013-11-19 00:34:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
test('gets metadata from cartocss', function() {
|
|
|
|
var STYLE = [
|
|
|
|
"Map { ",
|
|
|
|
" buffer-size: 1;",
|
2013-11-25 20:05:07 +08:00
|
|
|
" -torque-frame-count: 1;",
|
2013-11-19 00:34:50 +08:00
|
|
|
" -torque-resolution: 2;",
|
|
|
|
" -torque-animation-duration: 31;",
|
|
|
|
" -torque-aggregation-function: 'avg(cartodb_id)';",
|
|
|
|
" -torque-time-attribute: 'time';",
|
|
|
|
" -torque-data-aggregation: 'cumulative';",
|
|
|
|
"}",
|
|
|
|
"#layer { ",
|
|
|
|
" polygon-fill: #FFF;",
|
|
|
|
"}"
|
|
|
|
].join('\n');
|
2013-11-20 22:09:45 +08:00
|
|
|
var opts = torque.common.TorqueLayer.optionsFromCartoCSS(STYLE);
|
2013-11-19 00:34:50 +08:00
|
|
|
equal(opts['buffer-size'], 1);
|
|
|
|
equal(opts['steps'], 1);
|
|
|
|
equal(opts['resolution'], 2);
|
|
|
|
equal(opts['animationDuration'], 31);
|
|
|
|
equal(opts['countby'], 'avg(cartodb_id)');
|
|
|
|
equal(opts['column'],'time');
|
|
|
|
equal(opts['data_aggregation'], 'cumulative');
|
|
|
|
})
|