|
11 | 11 | import com.powsybl.iidm.network.Network; |
12 | 12 | import com.powsybl.nad.AbstractTest; |
13 | 13 | import com.powsybl.nad.layout.LayoutParameters; |
14 | | -import com.powsybl.nad.svg.iidm.CustomStyleProvider; |
| 14 | +import com.powsybl.nad.svg.CustomStyleProvider.CustomBusNodeStyles; |
| 15 | +import com.powsybl.nad.svg.CustomStyleProvider.CustomEdgeStyles; |
| 16 | +import com.powsybl.nad.svg.CustomStyleProvider.CustomThreeWtStyles; |
15 | 17 | import com.powsybl.nad.svg.iidm.DefaultLabelProvider; |
16 | 18 | import org.junit.jupiter.api.BeforeEach; |
17 | 19 | import org.junit.jupiter.api.Test; |
@@ -44,32 +46,41 @@ protected StyleProvider getStyleProvider(Network network) { |
44 | 46 | @Override |
45 | 47 | protected LabelProvider getLabelProvider(Network network) { |
46 | 48 | return new DefaultLabelProvider(network, getSvgParameters()); |
| 49 | + |
47 | 50 | } |
48 | 51 |
|
49 | 52 | @Test |
50 | | - void testCustomLabelProvider() { |
| 53 | + void testCustomStyleProvider() { |
51 | 54 | Network network = Networks.createNodeBreakerNetworkWithBranchStatus("TestNodeDecorators", "test"); |
52 | 55 |
|
53 | | - Map<String, CustomStyleProvider.CustomBusNodeStyles> busNodesStyles = new HashMap<>(); |
54 | | - busNodesStyles.put("VL1_10", new CustomStyleProvider.CustomBusNodeStyles("yellow", "blue", null)); |
55 | | - busNodesStyles.put("VL2_30", new CustomStyleProvider.CustomBusNodeStyles("red", "black", "4px")); |
| 56 | + Map<String, CustomBusNodeStyles> busNodesStyles = new HashMap<>(); |
| 57 | + busNodesStyles.put("VL1_10", new CustomBusNodeStyles("yellow", null, null)); |
| 58 | + busNodesStyles.put("VL2_30", new CustomBusNodeStyles("red", "black", "4px")); |
56 | 59 |
|
57 | | - Map<String, CustomStyleProvider.CustomEdgeStyles> edgesStyles = new HashMap<>(); |
58 | | - edgesStyles.put("L11", new CustomStyleProvider.CustomEdgeStyles("blue", "2px", null, "blue", "2px", null)); |
59 | | - edgesStyles.put("L12", new CustomStyleProvider.CustomEdgeStyles("green", "4px", "8,4", "green", "4px", "8,4")); |
60 | | - edgesStyles.put("T11", new CustomStyleProvider.CustomEdgeStyles("red", "8px", null, "brown", "8px", null)); |
61 | | - edgesStyles.put("T12", new CustomStyleProvider.CustomEdgeStyles("orange", null, null, "orange", null, null)); |
| 60 | + Map<String, CustomEdgeStyles> edgesStyles = new HashMap<>(); |
| 61 | + edgesStyles.put("L11", new CustomEdgeStyles("blue", "2px", null, "blue", "2px", null)); |
| 62 | + edgesStyles.put("L12", new CustomEdgeStyles("green", "4px", "8,4", "green", "4px", "8,4")); |
| 63 | + edgesStyles.put("T11", new CustomEdgeStyles("red", "8px", null, "brown", "8px", null)); |
| 64 | + edgesStyles.put("T12", new CustomEdgeStyles("orange", null, null, "orange", null, null)); |
62 | 65 |
|
63 | | - Map<String, CustomStyleProvider.CustomThreeWtStyles> threeWtsStyles = new HashMap<>(); |
| 66 | + Map<String, CustomThreeWtStyles> threeWtsStyles = new HashMap<>(); |
64 | 67 | threeWtsStyles.put("T3_12", |
65 | | - new CustomStyleProvider.CustomThreeWtStyles( |
| 68 | + new CustomThreeWtStyles( |
66 | 69 | "gray", "4px", null, |
67 | 70 | "purple", "4px", "4,4", |
68 | | - "darkgray", "4px", null |
| 71 | + "pink", "6px", null |
69 | 72 | ) |
70 | 73 | ); |
71 | 74 |
|
72 | | - styleProvider = new CustomStyleProvider(network, busNodesStyles, edgesStyles, threeWtsStyles); |
| 75 | + styleProvider = new CustomStyleProvider(busNodesStyles, edgesStyles, threeWtsStyles); |
73 | 76 | assertSvgEquals("/custom_style_provider.svg", network); |
74 | 77 | } |
| 78 | + |
| 79 | + @Test |
| 80 | + void testCustomStyleProviderEmpty() { |
| 81 | + Network network = Networks.createNodeBreakerNetworkWithBranchStatus("TestNodeDecorators", "test"); |
| 82 | + styleProvider = new CustomStyleProvider(new HashMap<>(), new HashMap<>(), new HashMap<>()); |
| 83 | + assertSvgEquals("/custom_style_provider_empty.svg", network); |
| 84 | + } |
| 85 | + |
75 | 86 | } |
0 commit comments