View | Details | Raw Unified | Return to bug 57071
Collapse All | Expand All

(-)a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFPivotTable.java (-2 / +40 lines)
Lines 46-51 public class TestXSSFPivotTable extends TestCase { Link Here
46
        cell2.setCellValue("#");
46
        cell2.setCellValue("#");
47
        Cell cell7 = row1.createCell(2);
47
        Cell cell7 = row1.createCell(2);
48
        cell7.setCellValue("Data");
48
        cell7.setCellValue("Data");
49
        Cell cell10 = row1.createCell(3);
50
        cell10.setCellValue("Value");
49
51
50
        Row row2 = sheet.createRow(1);
52
        Row row2 = sheet.createRow(1);
51
        Cell cell3 = row2.createCell(0);
53
        Cell cell3 = row2.createCell(0);
Lines 54-59 public class TestXSSFPivotTable extends TestCase { Link Here
54
        cell4.setCellValue(10);
56
        cell4.setCellValue(10);
55
        Cell cell8 = row2.createCell(2);
57
        Cell cell8 = row2.createCell(2);
56
        cell8.setCellValue("Apa");
58
        cell8.setCellValue("Apa");
59
        Cell cell11 = row1.createCell(3);
60
        cell11.setCellValue(11.11);
57
61
58
        Row row3 = sheet.createRow(2);
62
        Row row3 = sheet.createRow(2);
59
        Cell cell5 = row3.createCell(0);
63
        Cell cell5 = row3.createCell(0);
Lines 62-69 public class TestXSSFPivotTable extends TestCase { Link Here
62
        cell6.setCellValue(9);
66
        cell6.setCellValue(9);
63
        Cell cell9 = row3.createCell(2);
67
        Cell cell9 = row3.createCell(2);
64
        cell9.setCellValue("Bepa");
68
        cell9.setCellValue("Bepa");
69
        Cell cell12 = row1.createCell(3);
70
        cell12.setCellValue(12.12);
65
71
66
        AreaReference source = new AreaReference("A1:B2");
72
        AreaReference source = new AreaReference("A1:C2");
67
        pivotTable = sheet.createPivotTable(source, new CellReference("H5"));
73
        pivotTable = sheet.createPivotTable(source, new CellReference("H5"));
68
    }
74
    }
69
75
Lines 117-122 public class TestXSSFPivotTable extends TestCase { Link Here
117
    }
123
    }
118
124
119
    /**
125
    /**
126
     * Verify that it's possible to create three column labels with different DataConsolidateFunction
127
     */
128
    public void testAddThreeDifferentColumnLabelsToPivotTable() {
129
        int columnOne = 0;
130
        int columnTwo = 1;
131
        int columnThree = 2;
132
133
        pivotTable.addColumnLabel(DataConsolidateFunction.SUM, columnOne);
134
        pivotTable.addColumnLabel(DataConsolidateFunction.MAX, columnTwo);
135
        pivotTable.addColumnLabel(DataConsolidateFunction.MIN, columnThree);
136
        CTPivotTableDefinition defintion = pivotTable.getCTPivotTableDefinition();
137
138
        assertEquals(defintion.getDataFields().getDataFieldList().size(), 3);
139
    }
140
    
141
    
142
    /**
143
     * Verify that it's possible to create three column labels with the same DataConsolidateFunction
144
     */
145
    public void testAddThreeSametColumnLabelsToPivotTable() {
146
        int columnOne = 0;
147
        int columnTwo = 1;
148
        int columnThree = 2;
149
150
        pivotTable.addColumnLabel(DataConsolidateFunction.SUM, columnOne);
151
        pivotTable.addColumnLabel(DataConsolidateFunction.SUM, columnTwo);
152
        pivotTable.addColumnLabel(DataConsolidateFunction.SUM, columnThree);
153
        CTPivotTableDefinition defintion = pivotTable.getCTPivotTableDefinition();
154
155
        assertEquals(defintion.getDataFields().getDataFieldList().size(), 3);
156
    }
157
    
158
    /**
120
     * Verify that when creating two column labels, a col field is being created and X is set to -2.
159
     * Verify that when creating two column labels, a col field is being created and X is set to -2.
121
     */
160
     */
122
    public void testAddTwoColumnLabelsToPivotTable() {
161
    public void testAddTwoColumnLabelsToPivotTable() {
123
- 

Return to bug 57071