pulsar/benchmark/benchmark-suite.coffee

78 lines
2.0 KiB
CoffeeScript

Buffer = require 'buffer'
fs = require 'fs'
require 'benchmark-helper'
$ = require 'jquery'
describe "editor.", ->
editor = null
beforeEach ->
window.rootViewParentSelector = '#jasmine-content'
window.startup()
rootView.project.setPath(require.resolve('fixtures'))
editor = rootView.activeEditor()
afterEach ->
$(window).off 'beforeunload'
window.shutdown()
delete atom.rootViewStates[$windowNumber]
describe "empty-file.", ->
benchmark "insert-delete", ->
editor.insertText('x')
editor.backspace()
describe "300-line-file.", ->
beforeEach ->
editor.edit rootView.project.open('fixtures/medium.coffee')
describe "at-begining.", ->
benchmark "insert-delete", ->
editor.insertText('x')
editor.backspace()
benchmark "insert-delete-rehighlight", ->
editor.insertText('"')
editor.backspace()
describe "at-end.", ->
beforeEach ->
editor.moveCursorToBottom()
benchmark "insert-delete", ->
editor.insertText('"')
editor.backspace()
describe "9000-line-file.", ->
benchmark "opening.", 5, ->
editor.edit rootView.project.open('fixtures/huge.js')
describe "after-opening.", ->
beforeEach ->
editor.edit rootView.project.open('fixtures/huge.js')
benchmark "moving-to-eof.", 1, ->
editor.moveCursorToBottom()
describe "on-first-line.", ->
benchmark "inserting-newline", 5, ->
editor.insertNewline()
describe "on-last-visible-line.", ->
beforeEach ->
editor.setCursorScreenPosition([editor.getLastVisibleScreenRow(), 0])
benchmark "move-down-and-scroll", 300, ->
editor.trigger 'move-down'
describe "at-eof.", ->
endPosition = null
beforeEach ->
editor.moveCursorToBottom()
endPosition = editor.getCursorScreenPosition()
benchmark "move-to-beginning-of-word", ->
editor.moveCursorToBeginningOfWord()
editor.setCursorScreenPosition(endPosition)