예제 #1
0
파일: LayoutTest.java 프로젝트: oaperez/rap
  /** Run the test */
  protected void runTest() throws CoreException, WorkbenchException {

    widgetFactory.init();
    final Composite widget = widgetFactory.getControl();
    final Point maxSize = widgetFactory.getMaxSize();
    Rectangle initialBounds = widget.getBounds();
    final Rectangle newBounds = Geometry.copy(initialBounds);

    // This test is different now duw to trim API changes so 'gray' it...
    setDegradationComment(
        "<a href=https://bugs.eclipse.org/bugs/show_bug.cgi?id=129001>See Bug 129001</a> ");

    for (int xIteration = 0; xIteration < xIterations; xIteration++) {

      processEvents();

      startMeasuring();

      for (int yIteration = 0; yIteration < yIterations; yIteration++) {
        // Avoid giving the same x value twice in a row in order to make
        // it hard to cache
        int xSize = maxSize.x * ((xIteration + yIteration) % xIterations) / xIterations;
        int ySize = maxSize.y * yIteration / yIterations;

        newBounds.width = xSize;
        newBounds.height = ySize;

        widget.setBounds(newBounds);
        widget.layout(flushState);
      }

      stopMeasuring();
    }

    commitMeasurements();
    assertPerformance();

    widget.setBounds(initialBounds);
    widgetFactory.done();
  }
  /** Run the test */
  @Override
  protected void runTest() throws CoreException, WorkbenchException {

    tagIfNecessary(tagString, Dimension.ELAPSED_PROCESS);

    widgetFactory.init();
    final Composite widget = widgetFactory.getControl();
    Rectangle initialBounds = widget.getBounds();
    final Point maxSize = widgetFactory.getMaxSize();

    waitForBackgroundJobs();
    processEvents();
    for (int j = 0; j < 50; j++) {

      startMeasuring();
      for (int i = 0; i < 2; i++) {

        for (int xIteration = 0; xIteration < xIterations; xIteration += 5) {

          for (int yIteration = 0; yIteration < yIterations; yIteration++) {
            // Avoid giving the same x value twice in a row in order
            // to make it hard to cache
            int xSize = maxSize.x * ((xIteration + yIteration) % xIterations) / xIterations;
            int ySize = maxSize.y * yIteration / yIterations;

            widget.setSize(xSize, ySize);

            processEvents();
          }
        }
      }
      stopMeasuring();
    }
    commitMeasurements();
    assertPerformance();

    widget.setBounds(initialBounds);
    widgetFactory.done();
  }