diff --git a/test/widget-play.js b/test/widget-play.js new file mode 100644 index 0000000..4a29416 --- /dev/null +++ b/test/widget-play.js @@ -0,0 +1,13 @@ +var blessed = require('../'); + +var screen = blessed.screen({ + dump: __dirname + '/logs/play.log', + smartCSR: true +}); + +var frames = require(__dirname + '/frames.json'); + +setInterval(function() { + if (!frames.length) return process.exit(0); + process.stdout.write(frames.shift()); +}, 100); diff --git a/test/widget-record.js b/test/widget-record.js new file mode 100644 index 0000000..b5b1122 --- /dev/null +++ b/test/widget-record.js @@ -0,0 +1,52 @@ +var blessed = require('../') + , fs = require('fs'); + +var screen = blessed.screen({ + dump: __dirname + '/logs/record.log', + smartCSR: true +}); + +var btext = blessed.box({ + parent: screen, + left: 'center', + top: 'center', + width: '80%', + height: '80%', + style: { + bg: 'green' + }, + border: 'line', + content: 'CSR should still work.' +}); + +var text = blessed.scrollabletext({ + parent: screen, + content: fs.readFileSync(__dirname + '/git.diff', 'utf8'), + border: 'line', + left: 'center', + top: 'center', + draggable: true, + width: '50%', + height: '50%', + mouse: true, + keys: true, + vi: true +}); + +text.focus(); + +screen.key('q', function() { + return process.exit(0); +}); + +screen.render(); + +var frames = []; + +setInterval(function() { + frames.push(screen.screenshot()); +}, 100); + +process.on('exit', function() { + fs.writeFileSync(__dirname + '/frames.json', JSON.stringify(frames)); +});