* Test method for 'org.locationtech.udig.project.ui.FeatureIssue.fixIssue(IViewPart, IEditorPart)'
*/
@Ignore
@Test
public void testFixIssue() throws Exception {
final Layer layer= map.getLayersInternal().get(0);
layer.setCRS(DefaultGeographicCRS.WGS84);
CoordinateReferenceSystem crs = CRS.decode("EPSG:3005");//$NON-NLS-1$
map.getViewportModelInternal().setCRS(crs);
FeatureIssue issue=new FeatureIssue(Priority.LOW, "Description",layer, features[0], "test" ); //$NON-NLS-1$ //$NON-NLS-2$
if( issue.getViewPartId()!=null ){
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IViewPart view = activePage.findView(issue.getViewPartId());
activePage.hideView(view);
}
assertFalse(ApplicationGIS.getActiveMap()==map);
IssueHandler handler = IssueHandler.createHandler(issue);
handler.fixIssue();
map.sendCommandSync(new BlankCommand());
UDIGTestUtil.inDisplayThreadWait(10000,new WaitCondition(){
public boolean isTrue() {
try{
ReferencedEnvelope env = new ReferencedEnvelope(features[0].getBounds());
Envelope transformed = (Envelope)env.transform(layer.getCRS(), true,5);
return features[0].equals(map.getEditManager().getEditFeature()) &&
map.getViewportModel().getBounds().contains(transformed);
}catch (Exception e) {
throw (RuntimeException)new RuntimeException().initCause(e);
}
}
}, true);
assertTrue(layer.getFilter() instanceof Id);
assertEquals(features[0].getID(), ((Id)layer.getFilter()).getIDs().toArray(new String[0])[0]);
assertEquals(features[0], map.getEditManager().getEditFeature());
assertEquals("active map should be the map of the issue", map, ApplicationGIS.getActiveMap()); //$NON-NLS-1$
ReferencedEnvelope env = new ReferencedEnvelope(features[0].getBounds());
assertTrue("Map must contain feature", map.getViewportModel().getBounds().contains((Envelope)env.transform(layer.getCRS(), true,5))); //$NON-NLS-1$
}