101 Commits
Author SHA1 Message Date
Jos van den Oever cc52a758c8 Add xmled test to tests.js.
And fix the tests so that they pass.
2015-06-07 20:25:02 +02:00
Friedrich W. H. Kossebau 963eabf0af Move UnitTester code into test dirs, no longer compile into webodf.js 2015-03-14 01:37:32 +01:00
Philip Peitsch c0a1acc466 Cope with test names containing angle brackets 2014-09-24 09:04:00 +10:00
Philip Peitsch 741ea56a17 Add event subscription tracking object to simplify per-frame subscriptions
A common use-case for UI components is to only update the UI state just
before the next frame is rendered, irrespective of how many times a
signal is fired within a given batch of operations.

The event subscriptions object allows these to be easily created and
tracked, and also makes it easier to ensure all subscriptions are cleaned
up at the end.
2014-09-11 12:00:07 +10:00
Philip Peitsch eb93117fc6 Fix direct cursor styling behaviour
Recent changes to Formatting.getAppliedStyles return type were not correctly
spread through the DirectFormattingController. Update the CC types and fix
incorrect type usages in this controller.

To help preserve future sanity, some rough unit tests have been added for
the specifically fixed branches ONLY.

Fixes #723.
2014-07-29 20:27:32 +10:00
Philip Peitsch adc5a08759 Re-implement navigate-to-line-boundary cursor movement 2014-07-23 02:17:19 +10:00
Jos van den Oever 2ef7845f72 Add tests to check if dangerous input is loaded without executing javascript. 2014-06-04 13:35:06 +02:00
Philip Peitsch 2bc95f0a66 Add a very basic JS injection attack document & test 2014-06-04 13:35:05 +02:00
Friedrich W. H. Kossebau 7f80e8e163 Normalize license headers of editor/benchmark/tests/firefox-addon/viewer source files
* remove @license tag, for consistency with library source files
* use copyright@kogmbh.com email address everywhere
* remove "additional permission", to be added only to released stuff
* separate license header by empty line from following content
2014-06-02 17:49:46 +02:00
Philip Peitsch 94ae6ab7b4 Report the names of failing tests as well as the failed test count
Output from the headless Qt test runner is difficult to parse and
generally flows off screen very quickly. Appending the failed test names
makes it easier to troubleshoot which tests are problematic.
2014-05-28 20:36:16 +10:00
Friedrich W. H. Kossebau 5e3d2d708f Add gui.MetadataController 2014-05-27 15:03:53 +02:00
Philip Peitsch 70f0cbf5dc Apply merged paragraph styles using OpSetParagraphStyle
Reduce the complexity within the remove text operation and push it up to
the controller instead.
2014-05-23 00:34:59 +10:00
Friedrich W. H. Kossebau b7872fd00f Add StyleParseUtilsTests 2014-04-30 20:46:25 +02:00
Jos van den Oever 08648910e9 Convenience class for obtaining styling information for elements. 2014-04-24 23:25:54 +02:00
Friedrich W. H. Kossebau 8103490863 Add odf.ListStyleToCssTests 2014-04-15 01:16:09 +02:00
Philip Peitsch acef143923 Move ODT-specific logic out of StepsCache into the steps translator
This is purely a refactor laying the groundwork for fixing the failing
operations tests. There are no expected functional impacts.
2014-04-09 17:05:32 +10:00
Philip Peitsch f6adc2c867 Enable StepsCache verification in tests
The StepsCache verification feature verifies the cache after every
modification to ensure it does not contain any bad data. This is quite
slow to do in practice, but is very helpful for debugging, and for
tests.
2014-03-01 00:59:02 +11:00
Jos van den Oever c433187c0e Add new layout tests.
Layout tests can be added in layouttests.xml. A file is constructed from
ODF fragments and the loaded and layed out document is checked.
Only a few simple dimensions for are currently checked, more tests will follow.
2014-02-25 13:19:38 +01:00
Jos van den Oever be87ce71bc Fix loading of webodf.css in qtjsruntimetest.
If the <link/> element does not load the css, load the webodf.css in a <script/> element.
Also avoid loading webodf.css more than once.
2014-02-24 15:49:22 +01:00
Philip Peitsch ffb7d74ee4 Remove SelectionMover functions that are only used in tests
There are no worthwhile unit tests in SelectionMoverTests after these
are cleaned out, so for now the whole class file has been removed.

Mid-term, the SelectionMover class is to be removed as soon as an
implementation of navigate-by-line-boundaries has been created for
the step-iterator approach.
2014-02-14 02:03:39 +11:00
Philip Peitsch b6242b50a5 Remove last usages of OdtCursor.move from tests
All remaining OdtCursor tests are really testing other parts of the system that
are already covered in their own unit tests. For now, this file has been removed
and should be replaced later when OdtCursor gains additional tests.
2014-02-14 02:03:38 +11:00
Andreas Obergrusberger 45ebc8e02a Add ctrl+arrow per-word cursor movement 2014-01-30 21:33:39 +01:00
Philip Peitsch 8c7de7c698 Refactor how style summary is retrieved to use cached values
When selecting or modifying large areas of content, the multiple
style information lookup becomes quite expensive. These can be greatly
sped up by using a common cached value + associated query object
instead.
2014-01-29 00:46:52 +11:00
Philip Peitsch b1189d1762 Add tests for the StepIterator class 2014-01-22 23:29:02 +11:00
Jos van den Oever c88e781eb1 Add a the ability to run tests outside of the tests.js script.
This is preparation for using Karma to run the tests.
2013-12-18 09:03:09 +01:00
Friedrich W. H. Kossebau 7ed71d4825 Add TransformerTests (to test directly resulting opspecs, not execution consistency)
Useful for ApplyDirectStyling vs. ApplyDirectStyling, as that in the current
simple implementation will result in inconsistent DOMs (e.g. names of automatic styles)
2013-11-15 15:30:32 +01:00
Philip Peitsch 4a11179b23 Extract StepsTranslator interface to allow a safe interface to start caching improvements 2013-11-14 20:28:32 +11:00
Friedrich W. H. Kossebau ea1db30669 Add ops.TransformationTests 2013-11-07 10:51:01 +01:00
Friedrich W. H. Kossebau c2a795e668 Update link to repo: now https://github.com/kogmbh/WebODF/ 2013-10-23 18:20:30 +02:00
Friedrich W. H. Kossebau 508570dab8 Add copy of the AGPL3 to sources (+ add to created zip files) 2013-10-21 17:55:16 +02:00
Friedrich W. H. Kossebau 22570d0dfe Remove outdated gui.XMLEdit and webodf/xmledit 2013-10-18 20:14:23 +02:00
Lu Li 3b5b28afd5 refactor StyleNameGenerator into ObjectNameGenerator
- moved getAllStyleNames from Formatting to ObjectNameGenerator
- renamed StyleNameGeneratorTest to ObjectNameGeneratorTest and added a couple of more unit tests
2013-10-02 13:39:35 +10:00
Philip Peitsch c994202366 Workaround some crazy qtjsruntimetest javascript problem
I hate you qt… I really do

qtjsruntimetest tests break if OdfCanvas is allowed to insert a
dynamic <link/> element. If a dynamic link is inserted, subsequent
dynamic style sheets (document.createElement('style')) fail to result in
new entries being added to document.styleSheets.

This can easily be seen by commenting out the following and running
ops.OdtCursorTests followed by ops.OdtDocumentTests. As ops.OdtDocumentTests
is the only test suite to rely on style behaviour functioning correctly and
will report failures.
2013-09-16 14:23:21 +02:00
Philip Peitsch a6a4973218 Extract combined Odf & SelectionMover tests into separate file
Adapted tests to use real Odf fragments and a real TextPositionFilter
2013-09-16 14:23:21 +02:00
Philip Peitsch 9d1aa531d5 Extract re-usable concepts
* The extracted style name generator and logic for creating derived
styles will ease the implementation of paragraph direct-format support.
2013-09-06 03:53:09 +10:00
Philip Peitsch 15a65b71ea Migrate tests for migrated StyleHelper => OdfUtils functions
* Added instructions on how to create new test classes, as this involves
a myriad of small file changes that can easily be missed overlooked :(
2013-08-05 16:33:05 +10:00
Jos van den Oever 64d57c96cf Fix issues exposed by latest JSLint. 2013-07-24 21:41:56 +02:00
Philip Peitsch 15effae773 Prevent range boundaries from being incorrectly reset during split
When splitting text nodes, a more stable point will need to be found
for the end point if the start point is split, as DOM modifications
can potentially cause the end point to be lost
2013-07-24 01:20:29 +02:00
Lu Li 0eff2c6a0a Refactor odf.Formatting class
* move getTextNode from OdfUtils to StyleHelper
* move some of the unit tests under FormattingTests to StyleHelperTests
2013-07-22 16:47:42 +02:00
Philip Peitsch 1d6637acc8 Created undo states to revert clumps of operations
These undo rules attempts to implement undo/redo behaviour similar to
how LibreOffice behaves.

An undo state starts on an edit Operation. An undo state can be:
- One or more text inserts in the same direction
- One or more text removes in the same direction
- Any other individual edit operation (e.g., split paragraph, style
text, modify paragraph style)
-An undo state includes any trailing non-edit operations such as cursor
move.

There are challenges going backwards and forwards on separate op stacks
and generating identical states each time. As such, this has been implemented
by storing the operation into the state it's relevant to upon execution (rather
than traversal), and never splitting or modifying these during movements forwards
and backwards.
2013-07-09 15:03:53 +02:00
Philip Peitsch c3a28b3ce3 Implemented support for direct formatting of selection
Applying a direct style to a range will result in new
automatic styles being created for each unique style
block with the desired text properties.

Formatted text is contained within a span element just
above each text node that is within an ODF container
element.

TODO
* Styles should be validated before being applied
* Empty spans should be removed when modifying styles
2013-07-02 21:19:36 +02:00
Philip Peitsch d7360bab22 getAppliedStyles returns unique computed styles for all text nodes within a given range
This is useful for determining whether all text within a given selection is bold or italic, or
has a uniform size or font name.
2013-06-14 18:16:15 +10:00
Philip Peitsch 12ec85769b Escape required XML chars in node content and attributes during serialization in the browser 2013-06-06 16:10:13 +02:00
Jos van den Oever 122a8547cd Update to Node.JS 0.10.8.
Due to stricter javascript interpretation, a few scripts were adapted.
2013-05-26 22:47:27 +02:00
Jos van den Oever f6e559ed3f Make it possible to run individual tests by supplying arguments. 2013-05-08 15:33:27 +02:00
Jos van den Oever afc4dbda5e Add ability to run single tests in the browser environment.
Each suite and test now has a link. Pressing the link will add a query to the tests page that will filter out only a particular suite or even a particular test.
2013-05-06 11:39:31 +02:00
Jos van den Oever 13b549e92e Add xml based operation tests. 2013-05-06 11:37:40 +02:00
Tobias Hintze 66eb0054d0 rename SessionImplementation to Session (and thus remove the Session-interface) 2013-03-26 14:15:02 +01:00
Friedrich W. H. Kossebau 6a568a8f58 Split ops.OdtCursor from core.Cursor & rename ops.Document to ops.OdtDocument
Also:
* rename gui.CaretTests to ops.OdtCursorTests (as it is testing ops.OdtCursor)
* remove test-less CaretTests.js, had broken setup now
2013-03-06 15:44:28 +01:00
Friedrich W. H. Kossebau b7c6a25935 Cleanup tests.js a little 2013-03-06 15:44:28 +01:00