forked from fanruan/design
Browse Source
Merge in DESIGN/design from ~PENGDA/design:bugfix/10.0 to bugfix/10.0 * commit '4ca1e7cdfb2eda26dfca0523018d0838863caa5d': REPORT-34737 绝对画布中的组件可视状态下移到侧边后组件移出画布可见区域bugfix/10.0
pengda
4 years ago
2 changed files with 49 additions and 2 deletions
@ -0,0 +1,46 @@ |
|||||||
|
package com.fr.design.designer.beans.adapters.layout; |
||||||
|
|
||||||
|
import com.fr.config.dao.DaoContext; |
||||||
|
import com.fr.config.dao.impl.LocalClassHelperDao; |
||||||
|
import com.fr.config.dao.impl.LocalEntityDao; |
||||||
|
import com.fr.config.dao.impl.LocalXmlEntityDao; |
||||||
|
import com.fr.design.designer.creator.XButton; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.designer.creator.XWAbsoluteLayout; |
||||||
|
import com.fr.form.ui.Button; |
||||||
|
import com.fr.form.ui.container.WAbsoluteLayout; |
||||||
|
import java.awt.Dimension; |
||||||
|
import junit.framework.TestCase; |
||||||
|
import org.junit.Assert; |
||||||
|
|
||||||
|
public class FRAbsoluteLayoutAdapterTest extends TestCase { |
||||||
|
@Override |
||||||
|
protected void setUp() throws Exception { |
||||||
|
DaoContext.setEntityDao(new LocalEntityDao()); |
||||||
|
DaoContext.setClassHelperDao(new LocalClassHelperDao()); |
||||||
|
DaoContext.setXmlEntityDao(new LocalXmlEntityDao()); |
||||||
|
} |
||||||
|
|
||||||
|
public void testFix(){ |
||||||
|
WAbsoluteLayout layout =new WAbsoluteLayout(); |
||||||
|
XWAbsoluteLayout container =new XWAbsoluteLayout(layout); |
||||||
|
container.setBounds(0,320,400,160); |
||||||
|
FRAbsoluteLayoutAdapter frAbsoluteLayoutAdapter = new FRAbsoluteLayoutAdapter(container); |
||||||
|
XCreator button = new XButton(new Button(),new Dimension(88,40)); |
||||||
|
|
||||||
|
frAbsoluteLayoutAdapter.fix(button,-1,-1); |
||||||
|
Assert.assertEquals(0,button.getX()); |
||||||
|
Assert.assertEquals(0,button.getY()); |
||||||
|
|
||||||
|
frAbsoluteLayoutAdapter.fix(button,350,200); |
||||||
|
Assert.assertEquals(312,button.getX()); |
||||||
|
Assert.assertEquals(120,button.getY()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void tearDown() throws Exception { |
||||||
|
DaoContext.setEntityDao(null); |
||||||
|
DaoContext.setClassHelperDao(null); |
||||||
|
DaoContext.setXmlEntityDao(null); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue