/** Test a simple set annotation */ public void testSetAnnotation() { init("<p>abcdef</p>"); doc.setAnnotation(3, 6, "style/color", "stix"); assertOperationResult( "<p>ab<?a \"style/color\"=\"stix\"?>cde<?a \"style/color\"?>f</p>"); }
/** Test that trying to add a zero range annotation does nothing */ public void testZeroRangeSetAnnotation() { init("<p>abcdef</p>"); doc.setAnnotation(3, 3, "style/color", "blum"); assertOperationResult("<p>abcdef</p>"); }
/** Test that trying to add a zero range annotation does nothing */ public void testZeroRangeSetAnnotation() { init("<p>abcdef</p>"); doc.setAnnotation(3, 3, "style/color", "blum"); assertOperationResult("<p>abcdef</p>"); }
/** Test a simple reset annotation */ public void testResetAnnotation() { init("<p>abcdef</p>"); doc.resetAnnotation(3, 6, "style/color", "pocoyo"); assertOperationResult( "<p>ab<?a \"style/color\"=\"pocoyo\"?>cde<?a \"style/color\"?>f</p>"); }
/** Test a simple reset annotation */ public void testResetAnnotation() { init("<p>abcdef</p>"); doc.resetAnnotation(3, 6, "style/color", "pocoyo"); assertOperationResult( "<p>ab<?a \"style/color\"=\"pocoyo\"?>cde<?a \"style/color\"?>f</p>"); }
/** Test a simple set annotation */ public void testSetAnnotation() { init("<p>abcdef</p>"); doc.setAnnotation(3, 6, "style/color", "stix"); assertOperationResult( "<p>ab<?a \"style/color\"=\"stix\"?>cde<?a \"style/color\"?>f</p>"); }
/** * Tests that createChildElement does as it says. */ public void testCreateChildElement() { init("<p>first child</p>"); Element root = doc.getDocumentElement(); doc.createChildElement(root, "child", Collections.<String, String> emptyMap()); assertOperationResult("<p>first child</p><child/>"); }
/** * Tests that createChildElement does as it says. */ public void testCreateChildElement() { init("<p>first child</p>"); Element root = doc.getDocumentElement(); doc.createChildElement(root, "child", Collections.<String, String> emptyMap()); assertOperationResult("<p>first child</p><child/>"); }
/** Test adding two non-overlapping settings of the same annotation */ public void testTwoNonOverlappingAnnotations() { init("<p>abcdef</p>"); doc.setAnnotation(2, 4, "style/color", "lola"); doc.setAnnotation(5, 6, "style/color", "lola"); assertOperationResult( "<p>a<?a \"style/color\"=\"lola\"?>bc<?a \"style/color\"?>d" + "<?a \"style/color\"=\"lola\"?>e<?a \"style/color\"?>f</p>"); }
/** Test adding two non-overlapping settings of the same annotation */ public void testTwoNonOverlappingAnnotations() { init("<p>abcdef</p>"); doc.setAnnotation(2, 4, "style/color", "lola"); doc.setAnnotation(5, 6, "style/color", "lola"); assertOperationResult( "<p>a<?a \"style/color\"=\"lola\"?>bc<?a \"style/color\"?>d" + "<?a \"style/color\"=\"lola\"?>e<?a \"style/color\"?>f</p>"); }
/** Test adding an annotation over the whole document */ public void testSetAnnotationOverWholeDocument() { init("<p>abcdef</p>"); doc.setAnnotation(0, doc.size(), "style/color", "flim"); assertOperationResult( "<?a \"style/color\"=\"flim\"?><p>abcdef</p><?a \"style/color\"?>"); }
/** Test adding two overlapping settings of the same annotation */ public void testTwoOverlappingAnnotations() { init("<p>abcdef</p>"); doc.setAnnotation(2, 4, "style/color", "charlie"); doc.setAnnotation(3, 6, "style/color", "charlie"); assertOperationResult( "<p>a<?a \"style/color\"=\"charlie\"?>bcde<?a \"style/color\"?>f</p>"); }
/** Test adding an annotation over the whole document */ public void testSetAnnotationOverWholeDocument() { init("<p>abcdef</p>"); doc.setAnnotation(0, doc.size(), "style/color", "flim"); assertOperationResult( "<?a \"style/color\"=\"flim\"?><p>abcdef</p><?a \"style/color\"?>"); }
/** Test adding two overlapping settings of the same annotation */ public void testTwoOverlappingAnnotations() { init("<p>abcdef</p>"); doc.setAnnotation(2, 4, "style/color", "charlie"); doc.setAnnotation(3, 6, "style/color", "charlie"); assertOperationResult( "<p>a<?a \"style/color\"=\"charlie\"?>bcde<?a \"style/color\"?>f</p>"); }
/** Test a simple set and reset annotation */ public void testSetAndResetAnnotation() { init("<p>abcdef</p>"); doc.setAnnotation(0, doc.size(), "style/color", "pato"); doc.resetAnnotation(3, 6, "style/color", "pato"); assertOperationResult( "<p>ab<?a \"style/color\"=\"pato\"?>cde<?a \"style/color\"?>f</p>"); }
/** Test a simple set and unset of an annotation */ public void testSetAndUnsetAnnotation() { init("<p>abcdef</p>"); doc.setAnnotation(3, 6, "style/color", "maisy"); doc.setAnnotation(0, doc.size(), "style/color", null); assertOperationResult("<p>abcdef</p>"); }
/** Test a simple set and reset annotation */ public void testSetAndResetAnnotation() { init("<p>abcdef</p>"); doc.setAnnotation(0, doc.size(), "style/color", "pato"); doc.resetAnnotation(3, 6, "style/color", "pato"); assertOperationResult( "<p>ab<?a \"style/color\"=\"pato\"?>cde<?a \"style/color\"?>f</p>"); }
/** Test a simple set and unset of an annotation */ public void testSetAndUnsetAnnotation() { init("<p>abcdef</p>"); doc.setAnnotation(3, 6, "style/color", "maisy"); doc.setAnnotation(0, doc.size(), "style/color", null); assertOperationResult("<p>abcdef</p>"); }
/** * Test that using a zero range reset annotation clears the annotation over * the whole document. */ public void testZeroRangeResetAnnotationClearsDocument() { init("<p>abcdef</p>"); doc.setAnnotation(1, 4, "style/color", "spot"); doc.resetAnnotation(0, 0, "style/color", "spot"); assertOperationResult("<p>abcdef</p>"); init("<p>abcdef</p>"); doc.setAnnotation(1, 4, "style/color", "spot"); doc.resetAnnotation(2, 2, "style/color", "spot"); assertOperationResult("<p>abcdef</p>"); init("<p>abcdef</p>"); doc.setAnnotation(1, 4, "style/color", "spot"); doc.resetAnnotation(doc.size(), doc.size(), "style/color", "spot"); assertOperationResult("<p>abcdef</p>"); }
/** * Test that using a zero range reset annotation clears the annotation over * the whole document. */ public void testZeroRangeResetAnnotationClearsDocument() { init("<p>abcdef</p>"); doc.setAnnotation(1, 4, "style/color", "spot"); doc.resetAnnotation(0, 0, "style/color", "spot"); assertOperationResult("<p>abcdef</p>"); init("<p>abcdef</p>"); doc.setAnnotation(1, 4, "style/color", "spot"); doc.resetAnnotation(2, 2, "style/color", "spot"); assertOperationResult("<p>abcdef</p>"); init("<p>abcdef</p>"); doc.setAnnotation(1, 4, "style/color", "spot"); doc.resetAnnotation(doc.size(), doc.size(), "style/color", "spot"); assertOperationResult("<p>abcdef</p>"); }