Class: GraphicalTestsForRails::GraphicArrayOrderings::InWorkflowOrder

Inherits:
GraphicOrderer show all
Includes:
Graffle
Defined in:
lib/graphical_tests_for_rails/orderings.rb

Overview

(The following is much more obvious if you look at a sample document.)

The sheet contains one or more rivulets of Graffle::ShapedGraphic objects connected with Graffle::LineGraphic objects. All together, they’re supposed to represent a user workflow. (The gap between one rivulet and the next typically means that the user has gone away from the app, then returned.)

graphics produces a concatenated array of the rivulets (both the Graffle::ShapedGraphic and Graffle::LineGraphic objects).

Suppose there’s more than one rivulet on the Graffle::Sheet. graphics produces all the elements of the first, followed by all the elements of the second, etc. The first rivulet is the one headed by the highest object on the page. After all of its elements have been placed in the graphics array, the next rivulet is headed by the highest remaining element on the Graffle::Sheet.

Within a single rivulet, location is irrelevant. All that matters is where lines start and end.

Notice that the head of the second rivulet may be higher than some element of the first.

A rivulet may have a single element.

Constant Summary

Constants included from Graffle

Graffle::Version

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Graffle

data_from, parse, parse_file, parse_xml, stereotype

Constructor Details

#initialize(sheet) ⇒ InWorkflowOrder

Returns a new instance of InWorkflowOrder.



50
51
52
# File 'lib/graphical_tests_for_rails/orderings.rb', line 50

def initialize(sheet)
  @sheet = sheet
end

Class Method Details

.delete_this_id(graffle_id) ⇒ Object



57
58
59
# File 'lib/graphical_tests_for_rails/orderings.rb', line 57

def @source.delete_this_id(graffle_id)
  delete_if { |g| g.graffle_id == graffle_id }
end

Instance Method Details

#graphicsObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/graphical_tests_for_rails/orderings.rb', line 54

def graphics()
  @retval = []
  @source = @sheet.graphics_without_labels.sort_by {|g| g.origin}
  def @source.delete_this_id(graffle_id)
    delete_if { |g| g.graffle_id == graffle_id }
  end

  while (not @source.empty?)
    something = @source.shift
    @retval << something
    trace_from_something(something)
  end
  @retval
end