use of com.dexels.navajo.document.Selection in project navajo by Dexels.
the class TestProperty method tesSetSelected2.
@Test
public void tesSetSelected2() {
Property testSelectionProp1 = NavajoFactory.getInstance().createProperty(testDoc, "testselectionproperty", "+", "mydesc", Property.DIR_IN);
Selection s1 = NavajoFactory.getInstance().createSelection(testDoc, "myselection1", "0", false);
Selection s2 = NavajoFactory.getInstance().createSelection(testDoc, "myselection2", "1", false);
Selection s3 = NavajoFactory.getInstance().createSelection(testDoc, "myselection3", "2", false);
Selection s4 = NavajoFactory.getInstance().createSelection(testDoc, "myselection4", "3", false);
testSelectionProp1.addSelection(s1);
testSelectionProp1.addSelection(s2);
testSelectionProp1.addSelection(s3);
testSelectionProp1.addSelection(s4);
List<String> l = new ArrayList<>();
l.add("0");
l.add("3");
testSelectionProp1.setSelected(l);
Assert.assertTrue(s1.isSelected());
Assert.assertTrue(s4.isSelected());
Assert.assertTrue(!s2.isSelected());
Assert.assertTrue(!s3.isSelected());
}
use of com.dexels.navajo.document.Selection in project navajo by Dexels.
the class TestNavajo method testClearAllSelections.
@Test
public void testClearAllSelections() {
Property sel1 = NavajoFactory.getInstance().createProperty(testDoc, "sel1", "+", "", Property.DIR_IN);
Property sel2 = NavajoFactory.getInstance().createProperty(testDoc, "sel2", "+", "", Property.DIR_IN);
testDoc.getMessage("testmessage").addProperty(sel1);
testDoc.getMessage("testmessage").getMessage("testmessage_sub1").addProperty(sel2);
for (int i = 0; i < 5; i++) {
Selection s = NavajoFactory.getInstance().createSelection(testDoc, "sel" + i, i + "", true);
sel1.addSelection(s);
Selection s2 = NavajoFactory.getInstance().createSelection(testDoc, "selectie" + i, i + "", true);
sel2.addSelection(s2);
}
List<Selection> all = null;
all = testDoc.getMessage("testmessage").getProperty("sel1").getAllSelectedSelections();
Assert.assertEquals(5, all.size());
all = testDoc.getMessage("testmessage").getMessage("testmessage_sub1").getProperty("sel2").getAllSelectedSelections();
Assert.assertEquals(5, all.size());
testDoc.clearAllSelections();
all = testDoc.getMessage("testmessage").getProperty("sel1").getAllSelectedSelections();
Assert.assertEquals(0, all.size());
all = testDoc.getMessage("testmessage").getProperty("sel1").getAllSelections();
Assert.assertEquals(5, all.size());
all = testDoc.getMessage("testmessage").getMessage("testmessage_sub1").getProperty("sel2").getAllSelectedSelections();
Assert.assertEquals(0, all.size());
all = testDoc.getMessage("testmessage").getMessage("testmessage_sub1").getProperty("sel2").getAllSelections();
Assert.assertEquals(5, all.size());
}
use of com.dexels.navajo.document.Selection in project navajo by Dexels.
the class TestSelection method testSetValue.
@Test
public void testSetValue() {
Selection selectionRet = NavajoFactory.getInstance().createSelection(testDoc, "firstselection", "0", true);
selectionRet.setValue("1");
Assert.assertEquals(selectionRet.getValue(), "1");
}
use of com.dexels.navajo.document.Selection in project navajo by Dexels.
the class TestSelection method testIsSelectedWithInteger0.
@Test
public void testIsSelectedWithInteger0() {
Selection selectionRet = NavajoFactory.getInstance().createSelection(testDoc, "firstselection", "0", 1);
selectionRet.setValue("1");
Assert.assertTrue(selectionRet.isSelected());
}
use of com.dexels.navajo.document.Selection in project navajo by Dexels.
the class TestSelection method testCreate.
@Test
public void testCreate() {
Selection selectionRet = NavajoFactory.getInstance().createSelection(testDoc, "firstselection", "0", true);
Assert.assertEquals(selectionRet.getName(), "firstselection");
Assert.assertEquals(selectionRet.getValue(), "0");
Assert.assertEquals(selectionRet.isSelected(), true);
}
Aggregations