提交 6d4ef9c7 编写于 作者: M Mathieu Bastian

Fix #2350

上级 8ae43a41
......@@ -207,6 +207,9 @@ public class LayoutModelImpl implements LayoutModel, Model {
}
public void loadProperties(Layout layout) {
// In case some properties are only locally defined (like cooling in ForceAtlas)
layout.resetPropertiesValues();
List<LayoutPropertyKey> layoutValues = new ArrayList<>();
for (LayoutPropertyKey val : savedProperties.keySet()) {
if (val.layoutClassName.equals(layout.getClass().getName())) {
......
package org.gephi.layout;
import org.gephi.layout.utils.MockLayout;
import org.gephi.layout.utils.MockLayoutBuilder;
import org.gephi.layout.utils.Utils;
import org.junit.Assert;
import org.junit.Test;
public class LayoutModelImplTest {
@Test
public void testLocalPropertyReset() throws Exception {
LayoutModelImpl layoutModel = Utils.newLayoutModel();
MockLayout layout = new MockLayoutBuilder().buildLayout();
Assert.assertNotEquals(42.0, layout.getLocalProperty(), 0.0);
layoutModel.setSelectedLayout(layout);
Assert.assertEquals(42.0, layout.getLocalProperty(), 0.0);
}
}
......@@ -15,6 +15,7 @@ public class MockLayout implements Layout {
private final MockLayoutBuilder builder;
private double angle;
private Column column;
private double localProperty = 0.0;
public MockLayout(MockLayoutBuilder builder) {
this.builder = builder;
......@@ -70,7 +71,11 @@ public class MockLayout implements Layout {
@Override
public void resetPropertiesValues() {
localProperty = 42.0;
}
public double getLocalProperty() {
return localProperty;
}
@Override
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册