~ubuntu-branches/ubuntu/utopic/sweethome3d/utopic

« back to all changes in this revision

Viewing changes to test/com/eteks/sweethome3d/junit/PlanComponentTest.java

  • Committer: Package Import Robot
  • Author(s): Gabriele Giacone
  • Date: 2013-03-22 23:35:34 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20130322233534-k9g9mz1vch0dfy4y
Tags: 4.0+dfsg-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
113
113
    // Check they are selected
114
114
    assertSelectionContains(frame.home, wall1, wall2, wall3);
115
115
 
116
 
    // 3. Click at (30, 170), then double click at (50, 50) with Shift key depressed
 
116
    // 3. Click at (30, 170), then double click at (50, 50) without magnetism
117
117
    tester.actionClick(planComponent, 30, 170);
118
 
    tester.actionKeyPress(KeyEvent.VK_SHIFT);
 
118
    tester.actionKeyPress(TestUtilities.getMagnetismToggleKey());
119
119
    tester.actionClick(planComponent, 50, 50, InputEvent.BUTTON1_MASK, 2);
120
 
    tester.actionKeyRelease(KeyEvent.VK_SHIFT);
 
120
    tester.actionKeyRelease(TestUtilities.getMagnetismToggleKey());
121
121
    // Check a forth wall was created at (20, 300), (60, 60) coordinates
122
122
    Wall wall4 = orderedWalls.get(orderedWalls.size() - 1);
123
123
    assertCoordinatesEqualWallPoints(20, 300, 60, 60, wall4);
239
239
    // 13. Select first wall
240
240
    tester.actionClick(planComponent, 100, 100); // Give focus first
241
241
    tester.actionClick(planComponent, 40, 30);
242
 
    // Drag cursor from (30, 30) to (50, 50) with shift key pressed
 
242
    // Drag cursor from (30, 30) to (50, 50) without magnetism
243
243
    tester.actionMousePress(planComponent, 
244
244
        new ComponentLocation(new Point(30, 30))); 
245
245
    tester.actionMouseMove(planComponent, 
246
246
        new ComponentLocation(new Point(50, 50))); 
247
 
    tester.actionKeyPress(KeyEvent.VK_SHIFT);
 
247
    tester.actionKeyPress(TestUtilities.getMagnetismToggleKey());
248
248
    tester.waitForIdle();
249
249
    tester.actionMouseRelease(); 
250
 
    tester.actionKeyRelease(KeyEvent.VK_SHIFT);
 
250
    tester.actionKeyRelease(TestUtilities.getMagnetismToggleKey());
251
251
    // Check wall start point moved to (60, 60)
252
252
    assertCoordinatesEqualWallPoints(60, 60, 504, 20, wall1);
253
253
    assertCoordinatesEqualWallPoints(60, 60, 24, 300, wall4);
355
355
    // Take control with mouse
356
356
    tester.actionMouseMove(planComponent, 
357
357
        new ComponentLocation(new Point(200, 200)));
358
 
    tester.actionKeyPress(KeyEvent.VK_SHIFT);
 
358
    tester.actionKeyPress(TestUtilities.getMagnetismToggleKey());
359
359
    Wall wall7 = orderedWalls.get(7);
360
360
    assertCoordinatesEqualWallPoints(wall7.getXStart(), wall7.getYStart(), 
361
361
        planComponent.convertXPixelToModel(200), 
362
362
        planComponent.convertYPixelToModel(200), wall7);
363
363
    tester.waitForIdle();
364
 
    tester.actionKeyRelease(KeyEvent.VK_SHIFT);
 
364
    tester.actionKeyRelease(TestUtilities.getMagnetismToggleKey());
365
365
    // Take control again with keyboard and close the walls square
366
366
    tester.actionKeyStroke(KeyEvent.VK_ENTER);
367
367
    tester.actionKeyString("100");