graffle 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +2 -0
- data/LICENSE.txt +34 -0
- data/Manifest.txt +53 -0
- data/README.txt +19 -0
- data/Rakefile +32 -0
- data/Rakefile.hoe +23 -0
- data/bin/bin-skeleton +23 -0
- data/graffle.tmproj +335 -0
- data/lib/graffle.rb +43 -0
- data/lib/graffle/.document +4 -0
- data/lib/graffle/lib-skeleton +3 -0
- data/lib/graffle/nodoc/hacks.rb +69 -0
- data/lib/graffle/point.rb +42 -0
- data/lib/graffle/stereotypes.rb +446 -0
- data/lib/graffle/styled-text-reader.rb +52 -0
- data/lib/graffle/third-party/s4t-utils.rb +21 -0
- data/lib/graffle/third-party/s4t-utils/capturing-globals.rb +78 -0
- data/lib/graffle/third-party/s4t-utils/claims.rb +14 -0
- data/lib/graffle/third-party/s4t-utils/command-line.rb +15 -0
- data/lib/graffle/third-party/s4t-utils/error-handling.rb +20 -0
- data/lib/graffle/third-party/s4t-utils/friendly-format.rb +27 -0
- data/lib/graffle/third-party/s4t-utils/hacks.rb +32 -0
- data/lib/graffle/third-party/s4t-utils/load-path-auto-adjuster.rb +120 -0
- data/lib/graffle/third-party/s4t-utils/more-assertions.rb +29 -0
- data/lib/graffle/third-party/s4t-utils/os.rb +28 -0
- data/lib/graffle/third-party/s4t-utils/rake-task-helpers.rb +75 -0
- data/lib/graffle/third-party/s4t-utils/rakefile-common.rb +106 -0
- data/lib/graffle/third-party/s4t-utils/svn-file-movement.rb +101 -0
- data/lib/graffle/third-party/s4t-utils/test-util.rb +19 -0
- data/lib/graffle/third-party/s4t-utils/version.rb +3 -0
- data/lib/graffle/version.rb +8 -0
- data/setup.rb +1585 -0
- data/test/abstract-graphic-tests.rb +56 -0
- data/test/array-and-hash-stereotyping-tests.rb +49 -0
- data/test/document-tests.rb +117 -0
- data/test/graffle-file-types/as-a-package.graffle/data.plist +953 -0
- data/test/graffle-file-types/as-a-package.graffle/image1.png +0 -0
- data/test/graffle-file-types/as-a-package.graffle/image2.png +0 -0
- data/test/graffle-file-types/as-a-package.graffle/image3.png +0 -0
- data/test/graffle-file-types/multiple-canvases.graffle +6821 -0
- data/test/graffle-file-types/opening-tests.rb +45 -0
- data/test/graffle-file-types/two-boxes-and-a-line.graffle +347 -0
- data/test/group-tests.rb +109 -0
- data/test/hacks-tests.rb +58 -0
- data/test/line-graphic-tests.rb +155 -0
- data/test/point-tests.rb +43 -0
- data/test/set-standalone-test-paths.rb +5 -0
- data/test/shaped-graphic-tests.rb +93 -0
- data/test/sheet-tests.rb +124 -0
- data/test/styled-text-reader-tests.rb +89 -0
- data/test/test-skeleton +19 -0
- data/test/text-tests.rb +55 -0
- data/test/util.rb +15 -0
- metadata +139 -0
data/test/hacks-tests.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created by Brian Marick on 2007-07-06.
|
4
|
+
# Copyright (c) 2007. All rights reserved.
|
5
|
+
|
6
|
+
require "set-standalone-test-paths.rb" unless $started_from_rakefile
|
7
|
+
require 'test/unit'
|
8
|
+
require 's4t-utils'
|
9
|
+
include S4tUtils
|
10
|
+
|
11
|
+
require 'graffle/nodoc/hacks'
|
12
|
+
|
13
|
+
class TestHacks < Test::Unit::TestCase
|
14
|
+
|
15
|
+
module Something
|
16
|
+
def foo
|
17
|
+
"foo"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def test_my_idiosyncratic_version_of_duck_type_extension
|
23
|
+
o = Object.new
|
24
|
+
o.behave_like(Something)
|
25
|
+
assert_equal("foo", o.foo)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_effete_chaining_terminology
|
29
|
+
o = Object.new.and_behave_like(Something)
|
30
|
+
assert_equal("foo", o.foo)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_duck_typing
|
34
|
+
o = Object.new
|
35
|
+
assert_false(o.behaves_like?(Something))
|
36
|
+
o.behave_like(Something)
|
37
|
+
assert_true(o.behaves_like?(Something))
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_module_base_name
|
41
|
+
assert_equal("Unit", Test::Unit.basename)
|
42
|
+
assert_equal("Test", Test.basename)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_self_description_includes_behavior
|
46
|
+
assert_match(/acts as Something/, Object.new.behave_like(Something).to_s)
|
47
|
+
assert_match(/acts as Something/, Object.new.behave_like(Something).inspect)
|
48
|
+
assert_match(/acts as Unit/, Object.new.behave_like(Test::Unit).pretty_inspect)
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_can_tell_what_its_stereotype_is
|
53
|
+
assert_equal(Something, Object.new.behave_like(Something).stereotype)
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created by Brian Marick on 2007-07-06.
|
4
|
+
# Copyright (c) 2007. All rights reserved.
|
5
|
+
|
6
|
+
|
7
|
+
require "set-standalone-test-paths.rb" unless $started_from_rakefile
|
8
|
+
require 'test/unit'
|
9
|
+
require 's4t-utils'
|
10
|
+
include S4tUtils
|
11
|
+
|
12
|
+
require 'graffle'
|
13
|
+
require 'extensions/string'
|
14
|
+
|
15
|
+
class TestLineGraphics < Test::Unit::TestCase
|
16
|
+
include Graffle
|
17
|
+
include Graffle::Builders
|
18
|
+
|
19
|
+
|
20
|
+
def test_creation
|
21
|
+
assert_true(line_graphic.behaves_like?(LineGraphic))
|
22
|
+
assert_equal("LineGraphic", line_graphic['Class'])
|
23
|
+
assert_equal({ 'Class' => 'LineGraphic'}, line_graphic)
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
def test_id
|
29
|
+
o = line_graphic { graffle_id_is 1 }
|
30
|
+
assert_equal(1, o.graffle_id)
|
31
|
+
assert_equal(1, o['ID'])
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_line_graphics_have_points
|
35
|
+
o = line_graphic {
|
36
|
+
points_at [5, 3.4], [1, 3]
|
37
|
+
}
|
38
|
+
|
39
|
+
assert_equal(["{5, 3.4}", "{1, 3}"], o['Points'])
|
40
|
+
assert_equal([Point.new(5, 3.4), Point.new(1, 3)], o.points)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_line_graphic_origin_is_first_point
|
44
|
+
o = line_graphic {
|
45
|
+
points_at [5, 3.4], [1, 3]
|
46
|
+
}
|
47
|
+
|
48
|
+
assert_equal(Point.new(5, 3.4), o.origin)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_joins_two_shaped_graphics
|
52
|
+
head_graphic = shaped_graphic { graffle_id_is 1 }
|
53
|
+
tail_graphic = shaped_graphic { graffle_id_is 2 }
|
54
|
+
connector = line_graphic {
|
55
|
+
go_from tail_graphic
|
56
|
+
go_to head_graphic
|
57
|
+
}
|
58
|
+
assert_equal(1, connector['Head']['ID'])
|
59
|
+
assert_equal(2, connector['Tail']['ID'])
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_can_join_graphic_by_their_ids
|
63
|
+
head_graphic = shaped_graphic { graffle_id_is 1 }
|
64
|
+
tail_graphic = shaped_graphic { graffle_id_is 2 }
|
65
|
+
connector = line_graphic {
|
66
|
+
go_from 2
|
67
|
+
go_to 1
|
68
|
+
}
|
69
|
+
|
70
|
+
assert_equal(1, connector['Head']['ID'])
|
71
|
+
assert_equal(2, connector['Tail']['ID'])
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_line_in_sheet_returns_head_and_tail_as_objects
|
75
|
+
s = sheet {
|
76
|
+
with head_graphic = shaped_graphic { graffle_id_is 1 }
|
77
|
+
with tail_graphic = shaped_graphic { graffle_id_is 2 }
|
78
|
+
with line_graphic {
|
79
|
+
graffle_id_is 3
|
80
|
+
go_from tail_graphic
|
81
|
+
go_to head_graphic
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
line = s.find_by_id(3)
|
86
|
+
assert_equal(s.find_by_id(2), line.from)
|
87
|
+
assert_equal(s.find_by_id(1), line.to)
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_lines_can_span_grouping_levels
|
91
|
+
s = sheet {
|
92
|
+
with head = shaped_graphic { graffle_id_is 333 }
|
93
|
+
with g = group {
|
94
|
+
with tail = shaped_graphic { graffle_id_is 44 }
|
95
|
+
with line_graphic {
|
96
|
+
graffle_id_is 3
|
97
|
+
go_from tail
|
98
|
+
go_to head
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
s = Plist.parse_xml(s.to_plist)
|
104
|
+
Sheet.takes_on(s)
|
105
|
+
|
106
|
+
assert_equal(s.graphics[0],
|
107
|
+
s.graphics[1].graphics[1].to)
|
108
|
+
assert_equal(s.graphics[1].graphics[0],
|
109
|
+
s.graphics[1].graphics[1].from)
|
110
|
+
end
|
111
|
+
|
112
|
+
LINE_LABEL_TEXT = "
|
113
|
+
| {\\rtf1\\mac\\ansicpg10000\\cocoartf824\\cocoasubrtf420
|
114
|
+
| {\\fonttbl\\f0\\fswiss\\fcharset77 Helvetica;}
|
115
|
+
| {\\colortbl;\\red255\\green255\\blue255;}
|
116
|
+
| \\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\qc\\pardirnatural
|
117
|
+
|
|
118
|
+
| \\f0\\fs24 \\cf0 the line has a label}".trim("|")
|
119
|
+
|
120
|
+
|
121
|
+
def line_label_sheet
|
122
|
+
sheet {
|
123
|
+
with line_label { # Line labels are graphics at same level as lines.
|
124
|
+
for_line 1
|
125
|
+
with_text LINE_LABEL_TEXT
|
126
|
+
graffle_id_is 3
|
127
|
+
}
|
128
|
+
with line_graphic {
|
129
|
+
graffle_id_is 1
|
130
|
+
}
|
131
|
+
}
|
132
|
+
end
|
133
|
+
|
134
|
+
|
135
|
+
def test_lines_labels_are_distinct_graphics
|
136
|
+
label_graphic = line_label_sheet.find_by_id(3)
|
137
|
+
assert_true(label_graphic.behaves_like?(ShapedGraphic))
|
138
|
+
# TODO: graffle_class should be a method, not use hash all over the place
|
139
|
+
assert_equal("ShapedGraphic", label_graphic['Class'])
|
140
|
+
assert_equal(1, label_graphic['Line']['ID'])
|
141
|
+
|
142
|
+
assert_equal(1, label_graphic.line.graffle_id)
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_labels_can_nevertheless_be_treated_as_attached_to_line
|
146
|
+
line = line_label_sheet.find_by_id(1)
|
147
|
+
assert_equal(3, line.label.graffle_id)
|
148
|
+
|
149
|
+
assert_equal("the line has a label", line.label.content.as_plain_text)
|
150
|
+
# above is cumbersome, so...
|
151
|
+
assert_equal("the line has a label", line.label_rtf.as_plain_text)
|
152
|
+
end
|
153
|
+
|
154
|
+
|
155
|
+
end
|
data/test/point-tests.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created by Brian Marick on 2007-07-06.
|
4
|
+
# Copyright (c) 2007. All rights reserved.
|
5
|
+
|
6
|
+
require "set-standalone-test-paths.rb" unless $started_from_rakefile
|
7
|
+
require 'test/unit'
|
8
|
+
require 's4t-utils'
|
9
|
+
include S4tUtils
|
10
|
+
|
11
|
+
require 'graffle'
|
12
|
+
require 'extensions/string'
|
13
|
+
|
14
|
+
class TestPoint < Test::Unit::TestCase
|
15
|
+
include Graffle
|
16
|
+
|
17
|
+
def test_origin_parsing
|
18
|
+
o = Point.new("{{0.5, 11}, {irrelevant, irrelevant}}")
|
19
|
+
assert_equal(0.5, o.x)
|
20
|
+
assert_equal(11, o.y)
|
21
|
+
|
22
|
+
# alternately...
|
23
|
+
|
24
|
+
o = Point.new("{3, 2.2}")
|
25
|
+
assert_equal(3, o.x)
|
26
|
+
assert_equal(2.2, o.y)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_origin_spaceship
|
30
|
+
orig = Point.new("{{0.5, 11}, {-, -}}")
|
31
|
+
same = Point.new("{0.5, 11.0}")
|
32
|
+
vertically_before = Point.new("{0.5, 10.9}")
|
33
|
+
horizontally_before = Point.new("{0.4, 11}")
|
34
|
+
|
35
|
+
assert_equal(0, orig <=> same)
|
36
|
+
assert_equal(-1, vertically_before <=> orig)
|
37
|
+
assert_equal(1, same <=> horizontally_before)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_origins_are_fully_comparable
|
41
|
+
assert_true(Point.new("{{0, 0}, {5, 5}}") < Point.new("{1, 1}"))
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created by Brian Marick on 2007-07-06.
|
4
|
+
# Copyright (c) 2007. All rights reserved.
|
5
|
+
|
6
|
+
require "set-standalone-test-paths.rb" unless $started_from_rakefile
|
7
|
+
require 'test/unit'
|
8
|
+
require 's4t-utils'
|
9
|
+
include S4tUtils
|
10
|
+
|
11
|
+
require 'graffle'
|
12
|
+
require 'extensions/string'
|
13
|
+
|
14
|
+
class TestShapedGraphics < Test::Unit::TestCase
|
15
|
+
include Graffle
|
16
|
+
include Graffle::Builders
|
17
|
+
|
18
|
+
def test_creation
|
19
|
+
assert_true(shaped_graphic.behaves_like?(ShapedGraphic))
|
20
|
+
assert_equal("ShapedGraphic", shaped_graphic['Class'])
|
21
|
+
assert_equal({ 'Class' => 'ShapedGraphic'}, shaped_graphic)
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
def test_id
|
26
|
+
o = shaped_graphic { graffle_id_is 1 }
|
27
|
+
assert_equal(1, o.graffle_id)
|
28
|
+
assert_equal(1, o['ID'])
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
def test_bounds
|
33
|
+
o = shaped_graphic { bounded_by "351.323", "648.9", "149", "14" }
|
34
|
+
assert_equal(351.323, o.x)
|
35
|
+
assert_equal(648.9, o.y)
|
36
|
+
assert_equal(149, o.width)
|
37
|
+
assert_equal(14, o.height)
|
38
|
+
assert_equal("{{351.323, 648.9}, {149, 14}}", o['Bounds'])
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_origin
|
42
|
+
o = shaped_graphic { bounded_by "351", "648", "-", "-" }
|
43
|
+
assert_equal(Point.new(351, 648), o.origin)
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
def test_shaped_graphics_can_have_rtf_text_as_contents
|
48
|
+
|
49
|
+
rtf = %Q{
|
50
|
+
| {\\rtf1\\mac\\ansicpg10000\\cocoartf824\\cocoasubrtf420
|
51
|
+
| {\\fonttbl\\f0\\fswiss\\fcharset77 Helvetica;}
|
52
|
+
| {\\colortbl;\\red255\\green255\\blue255;}
|
53
|
+
| \\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\qc\\pardirnatural
|
54
|
+
|
|
55
|
+
| \\f0\\fs24 \\cf0 John follows "sign up" link}}.trim('|')
|
56
|
+
|
57
|
+
g = shaped_graphic {
|
58
|
+
with_text rtf
|
59
|
+
}
|
60
|
+
|
61
|
+
assert_true(g.has_content?)
|
62
|
+
assert_equal(rtf, g.content.as_rtf)
|
63
|
+
|
64
|
+
# It's sort of annoying that you use the 'contents' message to
|
65
|
+
# retrieve the text node.
|
66
|
+
assert_true(g.content.behaves_like?(Graffle::Text))
|
67
|
+
assert_equal(%Q{John follows "sign up" link}, g.content.as_plain_text)
|
68
|
+
assert_equal([['John follows', 'sign up', 'link']],
|
69
|
+
g.content.as_tokens_within_lines)
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_shaped_graphics_do_not_have_to_have_text
|
73
|
+
assert_false(shaped_graphic.has_content?)
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
def test_shaped_graphics_stereotypes_its_content
|
78
|
+
s = sheet {
|
79
|
+
with shaped_graphic {
|
80
|
+
graffle_id_is 333
|
81
|
+
with_text "foo"
|
82
|
+
}
|
83
|
+
with shaped_graphic { graffle_id_is 44 } # Check that this doesn't blow up
|
84
|
+
}
|
85
|
+
|
86
|
+
# buid correct structure, but without anything stereotyped.
|
87
|
+
s = Plist.parse_xml(s.to_plist)
|
88
|
+
Sheet.takes_on(s)
|
89
|
+
|
90
|
+
assert_true(s.find_by_id(333).content.behaves_like?(Graffle::Text))
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
data/test/sheet-tests.rb
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created by Brian Marick on 2007-07-06.
|
4
|
+
# Copyright (c) 2007. All rights reserved.
|
5
|
+
|
6
|
+
require "set-standalone-test-paths.rb" unless $started_from_rakefile
|
7
|
+
require 'test/unit'
|
8
|
+
require 's4t-utils'
|
9
|
+
include S4tUtils
|
10
|
+
require 'test/util'
|
11
|
+
|
12
|
+
require 'graffle'
|
13
|
+
|
14
|
+
class TestSheets < Test::Unit::TestCase
|
15
|
+
include Graffle
|
16
|
+
include Graffle::Builders
|
17
|
+
include Test::Util
|
18
|
+
|
19
|
+
def test_creation
|
20
|
+
assert_equal({ 'GraphicsList' => [] }, sheet)
|
21
|
+
assert_true(sheet.behaves_like?(Sheet))
|
22
|
+
assert_equal([], sheet.graphics)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_sheet_has_an_array_of_graphics
|
26
|
+
abstract = abstract_graphic
|
27
|
+
line = line_graphic
|
28
|
+
shaped = shaped_graphic
|
29
|
+
|
30
|
+
assert_equal([abstract, line, shaped],
|
31
|
+
sheet { with abstract, line, shaped }.graphics)
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
def test_sheet_elements_know_parent
|
36
|
+
abstract = abstract_graphic
|
37
|
+
line = line_graphic
|
38
|
+
shaped = shaped_graphic
|
39
|
+
s = sheet { with abstract, line, shaped }
|
40
|
+
|
41
|
+
assert_equal(s, abstract.container )
|
42
|
+
assert_equal(s, line.container)
|
43
|
+
assert_equal(s, shaped.container)
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_sheet_can_find_graphics_by_id
|
47
|
+
shaped = shaped_graphic { graffle_id_is 1 }
|
48
|
+
line = line_graphic { graffle_id_is 2 }
|
49
|
+
|
50
|
+
s = sheet { with shaped, line }
|
51
|
+
|
52
|
+
assert_equal(shaped, s.find_by_id(1))
|
53
|
+
assert_equal(1, s.find_by_id(1).graffle_id)
|
54
|
+
assert_equal(line, s.find_by_id(2))
|
55
|
+
assert_nil(s.find_by_id(3))
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_sheets_created_from_raw_data_can_stereotype_and_structure_their_contents
|
59
|
+
s = sheet {
|
60
|
+
with head = shaped_graphic { graffle_id_is 333 }
|
61
|
+
with tail = shaped_graphic { graffle_id_is 44 }
|
62
|
+
with line_graphic {
|
63
|
+
graffle_id_is 3
|
64
|
+
go_from tail
|
65
|
+
go_to head
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
# buid correct structure, but without anything stereotyped.
|
70
|
+
s = Plist.parse_xml(s.to_plist)
|
71
|
+
Sheet.takes_on(s)
|
72
|
+
|
73
|
+
assert_true(s.behaves_like?(Sheet))
|
74
|
+
|
75
|
+
assert_true(s.graphics[0].behaves_like?(ShapedGraphic))
|
76
|
+
assert_true(s.graphics[1].behaves_like?(ShapedGraphic))
|
77
|
+
assert_true(s.graphics[2].behaves_like?(LineGraphic))
|
78
|
+
|
79
|
+
# graphics link to their parent sheets.
|
80
|
+
assert_equal(s, s.graphics[0].container)
|
81
|
+
assert_equal(s, s.graphics[1].container)
|
82
|
+
assert_equal(s, s.graphics[2].container)
|
83
|
+
|
84
|
+
# links within a sheet work (this is no surprise)
|
85
|
+
assert_equal(s.graphics[0], s.graphics[2].to)
|
86
|
+
assert_equal(s.graphics[1], s.graphics[2].from)
|
87
|
+
end
|
88
|
+
|
89
|
+
|
90
|
+
def test_find_lines_when_lines_to_be_found
|
91
|
+
s = sheet {
|
92
|
+
with shaped_graphic
|
93
|
+
with line_graphic {
|
94
|
+
graffle_id_is 1
|
95
|
+
}
|
96
|
+
with shaped_graphic
|
97
|
+
with line_graphic {
|
98
|
+
graffle_id_is 2
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
assert_equal([1, 2], s.all_lines.collect { | l | l.graffle_id })
|
103
|
+
assert_equal(1, s.first_line.graffle_id)
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_find_lines_when_there_are_no_lines
|
107
|
+
assert_equal([], sheet.all_lines)
|
108
|
+
assert_equal(nil, sheet.first_line)
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_lines_within_groups_are_not_found
|
112
|
+
s = sheet {
|
113
|
+
with group {
|
114
|
+
with line_graphic {
|
115
|
+
graffle_id_is 1
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
assert_equal([], s.all_lines)
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
end
|