|
Lines 4-9
Link Here
|
| 4 |
import org.eclipse.swt.SWT; |
4 |
import org.eclipse.swt.SWT; |
| 5 |
import org.eclipse.swt.custom.CTabFolder; |
5 |
import org.eclipse.swt.custom.CTabFolder; |
| 6 |
import org.eclipse.swt.custom.CTabItem; |
6 |
import org.eclipse.swt.custom.CTabItem; |
|
|
7 |
import org.eclipse.swt.graphics.FontData; |
| 7 |
import org.eclipse.swt.graphics.RGB; |
8 |
import org.eclipse.swt.graphics.RGB; |
| 8 |
import org.eclipse.swt.layout.FillLayout; |
9 |
import org.eclipse.swt.layout.FillLayout; |
| 9 |
import org.eclipse.swt.widgets.Composite; |
10 |
import org.eclipse.swt.widgets.Composite; |
|
Lines 30-42
Link Here
|
| 30 |
|
31 |
|
| 31 |
CTabFolder folderToTest = new CTabFolder(panel, SWT.NONE); |
32 |
CTabFolder folderToTest = new CTabFolder(panel, SWT.NONE); |
| 32 |
CTabItem tab1 = new CTabItem(folderToTest, SWT.NONE); |
33 |
CTabItem tab1 = new CTabItem(folderToTest, SWT.NONE); |
| 33 |
tab1.setText("A TAB ITEM"); |
|
|
| 34 |
|
34 |
|
| 35 |
engine.applyStyles(shell, true); |
35 |
engine.applyStyles(shell, true); |
| 36 |
|
36 |
|
| 37 |
shell.pack(); |
37 |
shell.pack(); |
| 38 |
shell.open(); |
38 |
shell.open(); |
| 39 |
return folderToTest; |
39 |
return folderToTest; |
|
|
40 |
|
| 41 |
|
| 40 |
} |
42 |
} |
| 41 |
|
43 |
|
| 42 |
public void testBackgroundColor() throws Exception { |
44 |
public void testBackgroundColor() throws Exception { |
|
Lines 50-55
Link Here
|
| 50 |
assertEquals(BLUE, folderToTest.getForeground().getRGB()); |
52 |
assertEquals(BLUE, folderToTest.getForeground().getRGB()); |
| 51 |
folderToTest.getShell().close(); |
53 |
folderToTest.getShell().close(); |
| 52 |
} |
54 |
} |
|
|
55 |
|
| 56 |
public void testFontRegular() throws Exception { |
| 57 |
CTabFolder folderToTest = createTestCTabFolder("Label { font: Verdana 16px }"); |
| 58 |
assertEquals(1, folderToTest.getFont().getFontData().length); |
| 59 |
FontData fontData = folderToTest.getFont().getFontData()[0]; |
| 60 |
assertEquals("Verdana", fontData.getName()); |
| 61 |
assertEquals(16, fontData.getHeight()); |
| 62 |
assertEquals(SWT.NORMAL, fontData.getStyle()); |
| 63 |
folderToTest.getShell().close(); |
| 64 |
} |
| 65 |
|
| 66 |
public void testFontBold() throws Exception { |
| 67 |
CTabFolder folderToTest = createTestCTabFolder("Label { font: Arial 12px; font-weight: bold }"); |
| 68 |
assertEquals(1, folderToTest.getFont().getFontData().length); |
| 69 |
FontData fontData = folderToTest.getFont().getFontData()[0]; |
| 70 |
assertEquals("Arial", fontData.getName()); |
| 71 |
assertEquals(12, fontData.getHeight()); |
| 72 |
assertEquals(SWT.BOLD, fontData.getStyle()); |
| 73 |
folderToTest.getShell().close(); |
| 74 |
} |
| 75 |
|
| 76 |
public void testFontItalic() throws Exception { |
| 77 |
CTabFolder folderToTest = createTestCTabFolder("Label { font: Arial 12px; font-style: italic }"); |
| 78 |
assertEquals(1, folderToTest.getFont().getFontData().length); |
| 79 |
FontData fontData = folderToTest.getFont().getFontData()[0]; |
| 80 |
assertEquals("Arial", fontData.getName()); |
| 81 |
assertEquals(12, fontData.getHeight()); |
| 82 |
assertEquals(SWT.ITALIC, fontData.getStyle()); |
| 83 |
folderToTest.getShell().close(); |
| 84 |
} |
| 53 |
|
85 |
|
| 54 |
// public void testGradientColor() throws Exception { |
86 |
// public void testGradientColor() throws Exception { |
| 55 |
// CTabFolder folderToTest = createTestCTabFolder("CTabFolder { background-color: #FF0000 #0000FF }"); |
87 |
// CTabFolder folderToTest = createTestCTabFolder("CTabFolder { background-color: #FF0000 #0000FF }"); |
|
Lines 67-70
Link Here
|
| 67 |
assertEquals(GREEN, folderToTest.getSelectionBackground().getRGB()); |
99 |
assertEquals(GREEN, folderToTest.getSelectionBackground().getRGB()); |
| 68 |
folderToTest.getShell().close(); |
100 |
folderToTest.getShell().close(); |
| 69 |
} |
101 |
} |
|
|
102 |
|
| 103 |
public void testBorderVisible() throws Exception { |
| 104 |
CTabFolder folderToTest = createTestCTabFolder("CTabFolder { borderVisible: true}"); |
| 105 |
assertEquals(true, folderToTest.getBorderVisible()); |
| 106 |
folderToTest.getShell().close(); |
| 107 |
folderToTest = createTestCTabFolder("CTabFolder { borderVisible: false}"); |
| 108 |
assertEquals(false, folderToTest.getBorderVisible()); |
| 109 |
folderToTest.getShell().close(); |
| 110 |
} |
| 111 |
|
| 112 |
public void testSimple() throws Exception { |
| 113 |
CTabFolder folderToTest = createTestCTabFolder("CTabFolder { simple: true}"); |
| 114 |
assertEquals(true, folderToTest.getSimple()); |
| 115 |
folderToTest.getShell().close(); |
| 116 |
folderToTest = createTestCTabFolder("CTabFolder { simple: false}"); |
| 117 |
assertEquals(false, folderToTest.getSimple()); |
| 118 |
folderToTest.getShell().close(); |
| 119 |
} |
| 120 |
|
| 121 |
public void testMaximizeVisible() throws Exception { |
| 122 |
CTabFolder folderToTest = createTestCTabFolder("CTabFolder { maximizeVisible: true}"); |
| 123 |
assertEquals(true, folderToTest.getMaximizeVisible()); |
| 124 |
folderToTest.getShell().close(); |
| 125 |
folderToTest = createTestCTabFolder("CTabFolder { maximizeVisible: false}"); |
| 126 |
assertEquals(false, folderToTest.getMaximizeVisible()); |
| 127 |
folderToTest.getShell().close(); |
| 128 |
} |
| 129 |
|
| 130 |
public void testMinimizeVisible() throws Exception { |
| 131 |
CTabFolder folderToTest = createTestCTabFolder("CTabFolder { minimizeVisible: true}"); |
| 132 |
assertEquals(true, folderToTest.getMinimizeVisible()); |
| 133 |
folderToTest.getShell().close(); |
| 134 |
folderToTest = createTestCTabFolder("CTabFolder { minimizeVisible: false}"); |
| 135 |
assertEquals(false, folderToTest.getMinimizeVisible()); |
| 136 |
folderToTest.getShell().close(); |
| 137 |
} |
| 138 |
|
| 139 |
public void testMRUVisible() throws Exception { |
| 140 |
CTabFolder folderToTest = createTestCTabFolder("CTabFolder { mruVisible: true}"); |
| 141 |
assertEquals(true, folderToTest.getMRUVisible()); |
| 142 |
folderToTest.getShell().close(); |
| 143 |
folderToTest = createTestCTabFolder("CTabFolder { mruVisible: false}"); |
| 144 |
assertEquals(false, folderToTest.getMRUVisible()); |
| 145 |
folderToTest.getShell().close(); |
| 146 |
} |
| 147 |
|
| 148 |
public void testMaximized() throws Exception { |
| 149 |
CTabFolder folderToTest = createTestCTabFolder("CTabFolder { maximized: true}"); |
| 150 |
assertEquals(true, folderToTest.getMaximized()); |
| 151 |
folderToTest.getShell().close(); |
| 152 |
folderToTest = createTestCTabFolder("CTabFolder { maximized: false}"); |
| 153 |
assertEquals(false, folderToTest.getMaximized()); |
| 154 |
folderToTest.getShell().close(); |
| 155 |
} |
| 156 |
|
| 157 |
public void testMinimized() throws Exception { |
| 158 |
CTabFolder folderToTest = createTestCTabFolder("CTabFolder { minimized: true}"); |
| 159 |
assertEquals(true, folderToTest.getMinimized()); |
| 160 |
folderToTest.getShell().close(); |
| 161 |
folderToTest = createTestCTabFolder("CTabFolder { minimized: false}"); |
| 162 |
assertEquals(false, folderToTest.getMinimized()); |
| 163 |
folderToTest.getShell().close(); |
| 164 |
} |
| 165 |
|
| 166 |
public void testSingle() throws Exception { |
| 167 |
CTabFolder folderToTest = createTestCTabFolder("CTabFolder { single: true}"); |
| 168 |
assertEquals(true, folderToTest.getSingle()); |
| 169 |
folderToTest.getShell().close(); |
| 170 |
folderToTest = createTestCTabFolder("CTabFolder { single: false}"); |
| 171 |
assertEquals(false, folderToTest.getSingle()); |
| 172 |
folderToTest.getShell().close(); |
| 173 |
} |
| 174 |
|
| 175 |
public void testUnselectedCloseVisible() throws Exception { |
| 176 |
CTabFolder folderToTest = createTestCTabFolder("CTabFolder { unselectedCloseVisible: true}"); |
| 177 |
assertEquals(true, folderToTest.getUnselectedCloseVisible()); |
| 178 |
folderToTest.getShell().close(); |
| 179 |
folderToTest = createTestCTabFolder("CTabFolder { unselectedCloseVisible: false}"); |
| 180 |
assertEquals(false, folderToTest.getUnselectedCloseVisible()); |
| 181 |
folderToTest.getShell().close(); |
| 182 |
} |
| 183 |
|
| 184 |
public void testUnselectedImageVisible() throws Exception { |
| 185 |
CTabFolder folderToTest = createTestCTabFolder("CTabFolder { unselectedImageVisible: true}"); |
| 186 |
assertEquals(true, folderToTest.getUnselectedImageVisible()); |
| 187 |
folderToTest.getShell().close(); |
| 188 |
folderToTest = createTestCTabFolder("CTabFolder { unselectedImageVisible: false}"); |
| 189 |
assertEquals(false, folderToTest.getUnselectedImageVisible()); |
| 190 |
folderToTest.getShell().close(); |
| 191 |
} |
| 70 |
} |
192 |
} |