On Fri, Jul 10, 2009 at 18:50, Vincent Massol<vincent(a)massol.net> wrote:
On Jul 8, 2009, at 7:17 PM, tmortagne (SVN) wrote:
Author: tmortagne
Date: 2009-07-08 19:17:52 +0200 (Wed, 08 Jul 2009)
New Revision: 21856
Modified:
platform/core/trunk/xwiki-core/src/test/java/com/xpn/xwiki/doc/
XWikiDocumentTest.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/
java/org/xwiki/rendering/block/AbstractBlock.java
Log:
XWIKI-4071: Error on save after removing all content from a document
section
Modified: platform/core/trunk/xwiki-core/src/test/java/com/xpn/xwiki/
doc/XWikiDocumentTest.java
===================================================================
--- platform/core/trunk/xwiki-core/src/test/java/com/xpn/xwiki/doc/
XWikiDocumentTest.java 2009-07-08 14:25:48 UTC (rev 21855)
+++ platform/core/trunk/xwiki-core/src/test/java/com/xpn/xwiki/doc/
XWikiDocumentTest.java 2009-07-08 17:17:52 UTC (rev 21856)
@@ -504,6 +504,7 @@
+ "== header 2==\nheader 2 content");
this.document.setSyntaxId("xwiki/2.0");
+ // Modify section content
String content1 = this.document.updateDocumentSection(2, "==
header 2==\nmodified header 2 content");
assertEquals(
@@ -517,6 +518,11 @@
assertEquals(
"content not in section\n\n= header 1 =\n\nmodified also
header 1 content\n\n== header 2 ==\n\nheader 2 content",
content2);
+
+ // Remove a section
+ String content3 = this.document.updateDocumentSection(2, "");
+
+ assertEquals("content not in section\n\n= header 1 =\n
\nheader 1 content", content3);
}
public void testDisplay10()
Modified: platform/core/trunk/xwiki-rendering/xwiki-rendering-api/
src/main/java/org/xwiki/rendering/block/AbstractBlock.java
===================================================================
--- platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/
java/org/xwiki/rendering/block/AbstractBlock.java 2009-07-08
14:25:48 UTC (rev 21855)
+++ platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/
java/org/xwiki/rendering/block/AbstractBlock.java 2009-07-08
17:17:52 UTC (rev 21856)
@@ -150,7 +150,7 @@
block.setParent(this);
}
blocks.addAll(pos, newBlocks);
- blocks.remove(pos + 1);
+ blocks.remove(pos + newBlocks.size());
Are we missing a unit test in BlockTest for this?
I suppose or i would not have to fix it :)
I was focused on section so i forgot to add one specifically at
BlockTest level. I'm adding one.
Thanks
-Vincent
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs