Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 280291
Collapse All | Expand All

(-)src/org/eclipse/swt/internal/custom/clabelkit/CLabelLCA.java (-2 / +6 lines)
Lines 83-91 Link Here
83
  }
83
  }
84
84
85
  private static void writeText( final CLabel label ) throws IOException {
85
  private static void writeText( final CLabel label ) throws IOException {
86
    if( WidgetLCAUtil.hasChanged( label, PROP_TEXT, label.getText(), "" ) ) {
86
    String text = label.getText();
87
    if( WidgetLCAUtil.hasChanged( label, PROP_TEXT, text, "" ) ) {
88
      if( text == null ) {
89
        text = "";
90
      }
91
      text = WidgetLCAUtil.escapeText( text, true );
87
      JSWriter writer = JSWriter.getWriterFor( label );
92
      JSWriter writer = JSWriter.getWriterFor( label );
88
      String text = WidgetLCAUtil.escapeText( label.getText(), true );
89
      writer.set( JSConst.QX_FIELD_LABEL, text );
93
      writer.set( JSConst.QX_FIELD_LABEL, text );
90
    }
94
    }
91
  }
95
  }
(-)src/org/eclipse/RWTQ07TestSuite.java (+2 lines)
Lines 26-31 Link Here
26
import org.eclipse.swt.internal.graphics.TextSizeDeterminationHandler_Test;
26
import org.eclipse.swt.internal.graphics.TextSizeDeterminationHandler_Test;
27
import org.eclipse.swt.internal.widgets.WidgetAdapter_Test;
27
import org.eclipse.swt.internal.widgets.WidgetAdapter_Test;
28
import org.eclipse.swt.internal.widgets.buttonkit.ButtonLCA_Test;
28
import org.eclipse.swt.internal.widgets.buttonkit.ButtonLCA_Test;
29
import org.eclipse.swt.internal.widgets.clabelkit.CLabelLCA_Test;
29
import org.eclipse.swt.internal.widgets.combokit.ComboLCA_Test;
30
import org.eclipse.swt.internal.widgets.combokit.ComboLCA_Test;
30
import org.eclipse.swt.internal.widgets.controlkit.ControlLCA_Test;
31
import org.eclipse.swt.internal.widgets.controlkit.ControlLCA_Test;
31
import org.eclipse.swt.internal.widgets.coolbarkit.CoolBarLCA_Test;
32
import org.eclipse.swt.internal.widgets.coolbarkit.CoolBarLCA_Test;
Lines 131-136 Link Here
131
    suite.addTestSuite( ExpandItemLCA_Test.class );
132
    suite.addTestSuite( ExpandItemLCA_Test.class );
132
    suite.addTestSuite( SliderLCA_Test.class );
133
    suite.addTestSuite( SliderLCA_Test.class );
133
    suite.addTestSuite( CComboLCA_Test.class );
134
    suite.addTestSuite( CComboLCA_Test.class );
135
    suite.addTestSuite( CLabelLCA_Test.class );
134
136
135
    return suite;
137
    return suite;
136
  }
138
  }
(-)src/org/eclipse/swt/internal/widgets/clabelkit/CLabelLCA_Test.java (+49 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 EclipseSource and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the
4
 * terms of the Eclipse Public License v1.0 which accompanies this distribution, 
5
 * and is available at http://www.eclipse.org/legal/epl-v10.html
6
 *
7
 * Contributors:
8
 *   EclipseSource - initial API and implementation
9
 ******************************************************************************/
10
package org.eclipse.swt.internal.widgets.clabelkit;
11
12
import java.io.IOException;
13
14
import junit.framework.TestCase;
15
16
import org.eclipse.rwt.Fixture;
17
import org.eclipse.rwt.lifecycle.*;
18
import org.eclipse.swt.RWTFixture;
19
import org.eclipse.swt.SWT;
20
import org.eclipse.swt.custom.CLabel;
21
import org.eclipse.swt.widgets.Display;
22
import org.eclipse.swt.widgets.Shell;
23
24
25
public class CLabelLCA_Test extends TestCase {
26
  
27
  /*
28
   * 280291: [CLabel] causes NullPointerException when rendered uninitialized
29
   * https://bugs.eclipse.org/bugs/show_bug.cgi?id=280291
30
   */
31
  public void testWriteText() throws IOException {
32
    Display display = new Display();
33
    Shell shell = new Shell( display );
34
    CLabel label = new CLabel( shell, SWT.NONE );
35
    AbstractWidgetLCA lca = WidgetUtil.getLCA( label );
36
    lca.renderChanges( label );
37
    // the purpose of this test is to ensure that the LCA works without throwing 
38
    // an exception - thus there is no assert
39
  }
40
41
  protected void setUp() throws Exception {
42
    RWTFixture.setUp();
43
    Fixture.fakeResponseWriter();
44
  }
45
46
  protected void tearDown() throws Exception {
47
    RWTFixture.tearDown();
48
  }
49
}

Return to bug 280291