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

(-)src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFColor.java (-2 / +12 lines)
Lines 90-98 Link Here
90
    }
90
    }
91
    
91
    
92
    /**
92
    /**
93
     * A boolean value indicating if the ctColor has a tint or not
93
     * A boolean value indicating if the ctColor has a alpha or not
94
     */
94
     */
95
    public boolean hasTint() {
95
    public boolean hasAlpha() {
96
        if (! ctColor.isSetRgb()) {
96
        if (! ctColor.isSetRgb()) {
97
            return false;
97
            return false;
98
        }
98
        }
Lines 100-105 Link Here
100
    }
100
    }
101
101
102
    /**
102
    /**
103
     * A boolean value indicating if the ctColor has a tint or not
104
     */
105
    public boolean hasTint() {
106
        if (!ctColor.isSetTint()) {
107
            return false;
108
        }
109
        return ctColor.getTint() != 0;
110
    }
111
112
    /**
103
     * Indexed ctColor value. Only used for backwards compatibility. References a ctColor in indexedColors.
113
     * Indexed ctColor value. Only used for backwards compatibility. References a ctColor in indexedColors.
104
     */
114
     */
105
    @Override
115
    @Override
(-)src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFColor.java (+3 lines)
Lines 43-48 Link Here
43
      assertEquals(null, indexed.getRGB());
43
      assertEquals(null, indexed.getRGB());
44
      assertEquals(null, indexed.getRGBWithTint());
44
      assertEquals(null, indexed.getRGBWithTint());
45
      assertEquals(null, indexed.getARGBHex());
45
      assertEquals(null, indexed.getARGBHex());
46
      assertFalse(indexed.hasAlpha());
46
47
47
      // Now move to one with indexed rgb values
48
      // Now move to one with indexed rgb values
48
      indexed.setIndexed(59);
49
      indexed.setIndexed(59);
Lines 87-92 Link Here
87
      // Now check the XSSFColor
88
      // Now check the XSSFColor
88
      assertEquals(0, rgb3.getIndexed());
89
      assertEquals(0, rgb3.getIndexed());
89
      assertEquals(-0.34999, rgb3.getTint(), 0.00001);
90
      assertEquals(-0.34999, rgb3.getTint(), 0.00001);
91
      assertFalse(rgb3.hasAlpha());
90
92
91
      assertEquals("FFFFFFFF", rgb3.getARGBHex());
93
      assertEquals("FFFFFFFF", rgb3.getARGBHex());
92
      assertEquals(3, rgb3.getRGB().length);
94
      assertEquals(3, rgb3.getRGB().length);
Lines 140-145 Link Here
140
      // Now check the XSSFColor
142
      // Now check the XSSFColor
141
      assertEquals(0, rgb4.getIndexed());
143
      assertEquals(0, rgb4.getIndexed());
142
      assertEquals(0.0, rgb4.getTint(), 0);
144
      assertEquals(0.0, rgb4.getTint(), 0);
145
      assertTrue(rgb4.hasAlpha());
143
146
144
      assertEquals("FFFF0000", rgb4.getARGBHex());
147
      assertEquals("FFFF0000", rgb4.getARGBHex());
145
      assertEquals(3, rgb4.getRGB().length);
148
      assertEquals(3, rgb4.getRGB().length);

Return to bug 59224