How to test non-eclipse code [message #485871] |
Tue, 15 September 2009 10:54 |
Eclipse User |
|
|
|
Originally posted by: michael.danielsson.tieto.com
I have searched for a simple example where some non-eclipse GUI code is
tested, but I haven't found any.
Can someone please create a some tests where the following class is tested
package com.md.glosy.gui;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
public class QGroup {
private Group group;
private Text text;
public QGroup(Composite composite, int style) {
group = createQuestionGroup(composite, style);
}
private Group createQuestionGroup(Composite composite, int style) {
Group newGroup = new Group(composite, style);
newGroup.setText("QGroup");
newGroup.setLayout(new GridLayout());
Composite c = new Composite(newGroup, style);
c.setLayout(new GridLayout());
Label l = new Label(c, SWT.WRAP);
l.setText("Översätt följande:");
text = new Text(c, SWT.SINGLE | SWT.BORDER);
newGroup.pack();
return newGroup;
}
public void clearQuestion() {
text.setText("");
}
public void setQuestion(String question) {
text.setText(question);
}
public String getQuestion() {
return text.getText();
}
public void setTitle(String title) {
group.setText(title);
}
}
Regards, Michael
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04672 seconds