mirror of
https://github.com/webodf/WebODF.git
synced 2026-12-01 16:56:05 +01:00
60 lines
1.9 KiB
JavaScript
60 lines
1.9 KiB
JavaScript
/**
|
|
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
|
|
*
|
|
* @licstart
|
|
* This file is part of WebODF.
|
|
*
|
|
* WebODF is free software: you can redistribute it and/or modify it
|
|
* under the terms of the GNU Affero General Public License (GNU AGPL)
|
|
* as published by the Free Software Foundation, either version 3 of
|
|
* the License, or (at your option) any later version.
|
|
*
|
|
* WebODF is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with WebODF. If not, see <http://www.gnu.org/licenses/>.
|
|
* @licend
|
|
*
|
|
* @source: http://www.webodf.org/
|
|
* @source: https://github.com/kogmbh/WebODF/
|
|
*/
|
|
|
|
/*global define*/
|
|
|
|
define(["BenchmarkAction"], function(BenchmarkAction) {
|
|
"use strict";
|
|
|
|
/**
|
|
* Insert the letter A at the current position in the document
|
|
* @constructor
|
|
* @param {!number} times Number of times to insert the letter 'A'
|
|
*/
|
|
function InsertLetterA(times) {
|
|
var state = {description: "Insert the letter 'A' (x" + times + ")"},
|
|
action = new BenchmarkAction(state);
|
|
|
|
this.subscribe = action.subscribe;
|
|
this.state = state;
|
|
|
|
/**
|
|
* @param {!OdfBenchmarkContext} context
|
|
*/
|
|
this.start = function(context) {
|
|
var count;
|
|
context.storeCurrentPosition(state);
|
|
action.start();
|
|
for (count = 0; count < times; count += 1) {
|
|
context.sessionController.getTextController().insertText('A');
|
|
}
|
|
action.stop();
|
|
context.recordDistanceFromPreviousPosition(state);
|
|
action.complete(true);
|
|
};
|
|
}
|
|
|
|
return InsertLetterA;
|
|
});
|