eideticrml 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +55 -0
- data/lib/erml.rb +345 -0
- data/lib/erml_layout_managers.rb +667 -0
- data/lib/erml_rules.rb +104 -0
- data/lib/erml_styles.rb +304 -0
- data/lib/erml_support.rb +105 -0
- data/lib/erml_widget_factories.rb +38 -0
- data/lib/erml_widgets.rb +1895 -0
- data/samples/test10_rich_text.erml +17 -0
- data/samples/test11_table_layout.erml +30 -0
- data/samples/test12_shapes.erml +32 -0
- data/samples/test13_polygons.erml +28 -0
- data/samples/test14_images.erml +19 -0
- data/samples/test15_lines.erml +43 -0
- data/samples/test16_classes.erml +34 -0
- data/samples/test17_rules.erml +24 -0
- data/samples/test18_preformatted_text.erml +9 -0
- data/samples/test19_erb.erml.erb +26 -0
- data/samples/test1_empty_doc.erml +2 -0
- data/samples/test20_haml.erml.haml +20 -0
- data/samples/test21_shift_widgets.erml +47 -0
- data/samples/test22_multipage_flow_layout.erml +40 -0
- data/samples/test23_pageno.erml +17 -0
- data/samples/test24_headers_footers.erml.erb +37 -0
- data/samples/test25_overflow.erml.erb +37 -0
- data/samples/test26_columns.erml.erb +42 -0
- data/samples/test28_landscape.erml.erb +17 -0
- data/samples/test29_pages_up.erml.erb +17 -0
- data/samples/test2_empty_page.erml +6 -0
- data/samples/test30_encodings.erml.haml +35 -0
- data/samples/test3_hello_world.erml +7 -0
- data/samples/test4_two_pages.erml +10 -0
- data/samples/test5_rounded_rect.erml +10 -0
- data/samples/test6_bullets.erml +16 -0
- data/samples/test7_flow_layout.erml +20 -0
- data/samples/test8_vbox_layout.erml +23 -0
- data/samples/test9_hbox_layout.erml +22 -0
- data/samples/testimg.jpg +0 -0
- data/test/test_erml_layout_managers.rb +106 -0
- data/test/test_erml_rules.rb +116 -0
- data/test/test_erml_styles.rb +415 -0
- data/test/test_erml_support.rb +140 -0
- data/test/test_erml_widget_factories.rb +46 -0
- data/test/test_erml_widgets.rb +1235 -0
- data/test/test_helpers.rb +18 -0
- metadata +102 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
<erml>
|
2
|
+
<styles>
|
3
|
+
<font id="title" name="Clarendon" size="14" />
|
4
|
+
<font id="body" name="Clarendon-Light" size="12" />
|
5
|
+
<font id="copyright" name="Courier" size="8" />
|
6
|
+
<font id="pageno" name="Clarendon" size="12" />
|
7
|
+
<layout id="vbox" padding="10pt" />
|
8
|
+
</styles>
|
9
|
+
<rules>
|
10
|
+
<!--
|
11
|
+
p { font: body; text-align: justify }
|
12
|
+
header { display: always; margin-bottom: 10pt }
|
13
|
+
footer { display: always; layout: hbox }
|
14
|
+
.title { font: title }
|
15
|
+
.subtitle { display: first; text-align: center; width: 100% }
|
16
|
+
.copyright { font: copyright; text-align: left }
|
17
|
+
pageno { font: pageno }
|
18
|
+
-->
|
19
|
+
</rules>
|
20
|
+
<pages>
|
21
|
+
<define id="header" tag="div" align="top" width="100%" />
|
22
|
+
<define id="footer" tag="div" align="bottom" />
|
23
|
+
<page units="in" margin="1" layout="vbox" overflow="false">
|
24
|
+
<header>
|
25
|
+
<h class="title">Some Title</h>
|
26
|
+
<p class="subtitle">The paragraphs below will not wrap to a 2nd page.</p>
|
27
|
+
</header>
|
28
|
+
<% 10.times do |i| %>
|
29
|
+
<p><%= i + 1 %>. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
30
|
+
<% end %>
|
31
|
+
<footer>
|
32
|
+
<p class="copyright">Copyright (c) 2008 Eidetic Software. All rights reserved.</p>
|
33
|
+
<p width="1in" text_align="right">Page <pageno /></p>
|
34
|
+
</footer>
|
35
|
+
</page>
|
36
|
+
</pages>
|
37
|
+
</erml>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<erml>
|
2
|
+
<styles>
|
3
|
+
<font id="title" name="NewCenturySchlbk" size="14" />
|
4
|
+
<font id="body" name="NewCenturySchlbk" size="12" />
|
5
|
+
<font id="copyright" name="Courier" size="8" />
|
6
|
+
<font id="pageno" name="NewCenturySchlbk" size="12" />
|
7
|
+
<layout id="vbox" padding="10pt" />
|
8
|
+
</styles>
|
9
|
+
<rules>
|
10
|
+
<!--
|
11
|
+
p { font: body; text-align: justify }
|
12
|
+
header { display: always; margin-bottom: 10pt }
|
13
|
+
footer { display: always; layout: hbox }
|
14
|
+
.title { font: title }
|
15
|
+
.subtitle { display: first; text-align: center }
|
16
|
+
.copyright { font: copyright; text-align: left }
|
17
|
+
pageno { font: pageno }
|
18
|
+
-->
|
19
|
+
</rules>
|
20
|
+
<pages>
|
21
|
+
<define id="header" tag="div" align="top" />
|
22
|
+
<define id="footer" tag="div" align="bottom" />
|
23
|
+
<page units="in" margin="1" layout="vbox" overflow="false">
|
24
|
+
<header>
|
25
|
+
<h class="title">Some Title</h>
|
26
|
+
<p class="subtitle">The paragraphs below should appear in twin columns.</p>
|
27
|
+
</header>
|
28
|
+
<hbox height="7">
|
29
|
+
<div id="col1" width="50%" height="100%">
|
30
|
+
<% 10.times do |i| %>
|
31
|
+
<p><%= i + 1 %>. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
32
|
+
<% end %>
|
33
|
+
</div>
|
34
|
+
<div id="col2" source="col1" width="50%" height="100%" />
|
35
|
+
</hbox>
|
36
|
+
<footer>
|
37
|
+
<p class="copyright">Copyright (c) 2008 Eidetic Software. All rights reserved.</p>
|
38
|
+
<p width="1in" text_align="right">Page <pageno /></p>
|
39
|
+
</footer>
|
40
|
+
</page>
|
41
|
+
</pages>
|
42
|
+
</erml>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<erml>
|
2
|
+
<styles>
|
3
|
+
<font id="body" name="Clarendon-Light" size="12" />
|
4
|
+
<layout id="vbox" padding="10pt" />
|
5
|
+
</styles>
|
6
|
+
<rules>
|
7
|
+
<!--
|
8
|
+
p { font: body; text-align: justify }
|
9
|
+
-->
|
10
|
+
</rules>
|
11
|
+
<pages>
|
12
|
+
<page units="in" margin="1" layout="vbox" overflow="true" orientation="landscape" size="legal">
|
13
|
+
<p font.line_height="1">A. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
14
|
+
<p font.line_height="2">B. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
15
|
+
</page>
|
16
|
+
</pages>
|
17
|
+
</erml>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<erml>
|
2
|
+
<styles>
|
3
|
+
<font id="body" name="Clarendon-Light" size="12" />
|
4
|
+
</styles>
|
5
|
+
<rules>
|
6
|
+
<!--
|
7
|
+
p { font: body; }
|
8
|
+
-->
|
9
|
+
</rules>
|
10
|
+
<pages orientation="landscape" pages_up="2,2" pages_up_layout="down">
|
11
|
+
<% 4.times do %>
|
12
|
+
<page units="in" margin="0.25" padding="0.25" border="solid">
|
13
|
+
<p>Page <pageno /></p>
|
14
|
+
</page>
|
15
|
+
<% end %>
|
16
|
+
</pages>
|
17
|
+
</erml>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
%erml
|
2
|
+
%styles
|
3
|
+
%font{ :id => 'body', :name => 'Helvetica', :size => 12 }
|
4
|
+
%layout{ :id => 'vbox', :padding => '6pt' }
|
5
|
+
%rules
|
6
|
+
/
|
7
|
+
:sass
|
8
|
+
p
|
9
|
+
:font body
|
10
|
+
.en, .da, .es, .fr, .no, .pt, .fi, .sv
|
11
|
+
:font.encoding CP1252
|
12
|
+
.hr, .hu, .pl, .ro, .sl, .sk, .cs
|
13
|
+
:font.encoding CP1250
|
14
|
+
.tr
|
15
|
+
:font.encoding CP1254
|
16
|
+
%pages
|
17
|
+
%page{ :units => 'in', :margin => 0.5, :layout => 'vbox' }
|
18
|
+
%p <u>Encodings</u>
|
19
|
+
%br/
|
20
|
+
%p.en <b>English:</b> The information listed on this page reflects the assessments that have been assigned and what has been completed.
|
21
|
+
%p.da <b>Danish:</b> Oplysningerne på denne side afspejler de vurderinger, der er blevet tildelt, og hvad der er blevet gennemført.
|
22
|
+
%p.es <b>Spanish:</b> La información mencionada en esta página refleja las evaluaciones que le han sido asignadas y las que usted ya ha terminado.
|
23
|
+
%p.fr <b>French:</b> Les informations listées sur cette page sont le reflet des évaluations qui ont été affectées et réalisées.
|
24
|
+
%p.hr <b>Croatian:</b> Informacija na ovoj stranici Vam pokazuje status vaše analize.
|
25
|
+
%p.hu <b>Hungarian:</b> Ezen az oldalon azokat a kérdőíveket találja, melynek kitöltésével már elkészült.
|
26
|
+
%p.no <b>Norwegian:</b> Informasjonen på denne siden viser analysene som du skal gjennomføre og hva som er gjennomført.
|
27
|
+
%p.pl <b>Polish:</b> Informacja znajdująca się na tej stronie przedstawia ocenę postępów, oszacowania, które zostały oznaczone i co zostało uzupełnione.
|
28
|
+
%p.pt <b>Portuguese:</b> As informações apresentadas nesta página refletem as avaliações disponibilizadas e o que já foi concluído.
|
29
|
+
%p.ro <b>Romanian:</b> Informaţiile afişate pe pagina asta reflectă evaluările alocate si cele care au fost deja completate.
|
30
|
+
%p.sl <b>Slovene:</b> Poročilo na tej strani odraža oceno, ki je bila dodeljena in kaj je bilo dokončano.
|
31
|
+
%p.sk <b>Slovak:</b> Informácie uvedené na tejto stránke popisujú hodnotiace testy, ktoré boli určené a ktoré boli ukončené.
|
32
|
+
%p.fi <b>Finnish:</b> Tällä sivulla oleva informaatio koskee arviointeja, jotka on annettu ja päätetty.
|
33
|
+
%p.sv <b>Swedish:</b> Informationen på den här sidan visar vilka moment som är aktiva och vilka som är slutförda.
|
34
|
+
%p.tr <b>Turkish:</b> Bu sayfada sıralanan bilgiler sizin için seçilmiş ölçme ve değerlendirme araçlarını ve bunlardan doldurup tamamladıklarınızı yansıtır.
|
35
|
+
%p.cs <b>Czech:</b> Informace uvedené na této stránce popisují hodnotící testy, které byly přiděleny a vyplněny.
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<erml>
|
2
|
+
<styles>
|
3
|
+
<font id="zapf" name="ZapfDingbats" size="12" />
|
4
|
+
<bullet id="bstar" font="zapf" text="N" />
|
5
|
+
<para id="pstar" bullet="bstar" />
|
6
|
+
<layout id="vbox" padding="8" />
|
7
|
+
</styles>
|
8
|
+
<pages>
|
9
|
+
<page units="in" margin="1">
|
10
|
+
<p underline="true">Bullets</p>
|
11
|
+
<p bullet="bstar">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
12
|
+
<p style="pstar">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
13
|
+
<p bullet="bstar" font_style="BoldOblique">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
14
|
+
</page>
|
15
|
+
</pages>
|
16
|
+
</erml>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<erml>
|
2
|
+
<styles>
|
3
|
+
<layout id="flow" padding="12" />
|
4
|
+
<pen id="blue_dash" color="Blue" width="2" pattern="dashed" />
|
5
|
+
<pen id="red_dash" color="Red" width="2" pattern="dashed" />
|
6
|
+
</styles>
|
7
|
+
<pages>
|
8
|
+
<page units="in" margin="1" layout="flow">
|
9
|
+
<p underline="true">Flow Layout</p>
|
10
|
+
<p border="dotted" text_align="justify">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
11
|
+
<p border_right="dashed" width="3" text_align="justify">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
12
|
+
<p width="3.3" text_align="justify">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
13
|
+
<rect width="2" height="1" border="blue_dash" />
|
14
|
+
<rect width="2" height="2" border="red_dash" />
|
15
|
+
<rect width="2" height="1" border="blue_dash" />
|
16
|
+
<rect width="4" height="0.5" border="red_dash" />
|
17
|
+
<rect width="4" height="0.5" border="blue_dash" />
|
18
|
+
</page>
|
19
|
+
</pages>
|
20
|
+
</erml>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<erml>
|
2
|
+
<styles>
|
3
|
+
<layout id="vbox" padding="18" />
|
4
|
+
<pen id="blue_dash" color="Blue" width="2" pattern="dashed" />
|
5
|
+
<pen id="red_dash" color="Red" width="2" pattern="dashed" />
|
6
|
+
</styles>
|
7
|
+
<rules>
|
8
|
+
<!--
|
9
|
+
rect { width: 100%; }
|
10
|
+
-->
|
11
|
+
</rules>
|
12
|
+
<pages>
|
13
|
+
<page units="in" margin="1" layout="vbox">
|
14
|
+
<p underline="true" align="top">VBox Layout</p>
|
15
|
+
<p border="dotted" text_align="justify" align="top" padding="5pt">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
16
|
+
<p border="dashed" text_align="justify" padding="5pt">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
17
|
+
<rect height="0.5" border="blue_dash" corners="0.2" />
|
18
|
+
<rect height="1.0" border="red_dash" corners="0.2" />
|
19
|
+
<rect height="1.0" border="blue_dash" corners="0.2" />
|
20
|
+
<rect height="0.5" border="red_dash" corners="0.2" align="bottom" />
|
21
|
+
</page>
|
22
|
+
</pages>
|
23
|
+
</erml>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<erml>
|
2
|
+
<styles>
|
3
|
+
<layout id="vbox" padding="18" />
|
4
|
+
<layout id="hbox" padding="5" />
|
5
|
+
</styles>
|
6
|
+
<pages>
|
7
|
+
<page units="in" margin="1">
|
8
|
+
<p underline="true" align="top">HBox Layout</p>
|
9
|
+
<hbox padding="5pt" border="solid">
|
10
|
+
<p align="left" border="dotted" text_align="left" width="2" padding="5pt">
|
11
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
12
|
+
</p>
|
13
|
+
<p text_align="justify" width="100%" padding_top="5pt">
|
14
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
15
|
+
</p>
|
16
|
+
<p align="right" border="dashed" text_align="right" width="2" padding="5pt">
|
17
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
18
|
+
</p>
|
19
|
+
</hbox>
|
20
|
+
</page>
|
21
|
+
</pages>
|
22
|
+
</erml>
|
data/samples/testimg.jpg
ADDED
Binary file
|
@@ -0,0 +1,106 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created by Brent Rowland on 2008-01-21.
|
4
|
+
# Copyright (c) 2008 Eidetic Software. All rights reserved.
|
5
|
+
|
6
|
+
$: << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
7
|
+
require "minitest/autorun"
|
8
|
+
require 'erml_layout_managers'
|
9
|
+
require 'erml_widgets'
|
10
|
+
require 'erml_styles'
|
11
|
+
|
12
|
+
include EideticRML::LayoutManagers
|
13
|
+
include EideticRML::Widgets
|
14
|
+
include EideticRML::Styles
|
15
|
+
|
16
|
+
class TestLayout < LayoutManager
|
17
|
+
end
|
18
|
+
|
19
|
+
class LayoutManagerTestCases < Minitest::Test
|
20
|
+
def setup
|
21
|
+
LayoutManager.register('test', TestLayout)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_register
|
25
|
+
assert_equal(TestLayout, LayoutManager.class_eval("@@klasses['test']"))
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_for_name
|
29
|
+
assert_equal(TestLayout, LayoutManager.for_name('test'))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class AbsoluteLayoutTestCases < Minitest::Test
|
34
|
+
def setup
|
35
|
+
@style = LayoutStyle.new(nil)
|
36
|
+
@lm = LayoutManager.for_name('absolute').new(@style)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_initialize
|
40
|
+
refute_nil(@lm)
|
41
|
+
assert_kind_of(AbsoluteLayout, @lm)
|
42
|
+
end
|
43
|
+
|
44
|
+
# def test_layout(writer)
|
45
|
+
# end
|
46
|
+
end
|
47
|
+
|
48
|
+
class FlowLayoutTestCases < Minitest::Test
|
49
|
+
def setup
|
50
|
+
@style = LayoutStyle.new(nil)
|
51
|
+
@lm = LayoutManager.for_name('flow').new(@style)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_initialize
|
55
|
+
refute_nil(@lm)
|
56
|
+
assert_kind_of(FlowLayout, @lm)
|
57
|
+
end
|
58
|
+
|
59
|
+
# def test_layout(writer)
|
60
|
+
# end
|
61
|
+
end
|
62
|
+
|
63
|
+
class HBoxLayoutTestCases < Minitest::Test
|
64
|
+
def setup
|
65
|
+
@style = LayoutStyle.new(nil)
|
66
|
+
@lm = LayoutManager.for_name('hbox').new(@style)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_initialize
|
70
|
+
refute_nil(@lm)
|
71
|
+
assert_kind_of(HBoxLayout, @lm)
|
72
|
+
end
|
73
|
+
|
74
|
+
# def test_layout(writer)
|
75
|
+
# end
|
76
|
+
end
|
77
|
+
|
78
|
+
class VBoxLayoutTestCases < Minitest::Test
|
79
|
+
def setup
|
80
|
+
@style = LayoutStyle.new(nil)
|
81
|
+
@lm = LayoutManager.for_name('vbox').new(@style)
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_initialize
|
85
|
+
refute_nil(@lm)
|
86
|
+
assert_kind_of(VBoxLayout, @lm)
|
87
|
+
end
|
88
|
+
|
89
|
+
# def test_layout(writer)
|
90
|
+
# end
|
91
|
+
end
|
92
|
+
|
93
|
+
class TableLayoutTestCases < Minitest::Test
|
94
|
+
def setup
|
95
|
+
@style = LayoutStyle.new(nil)
|
96
|
+
@lm = LayoutManager.for_name('table').new(@style)
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_initialize
|
100
|
+
refute_nil(@lm)
|
101
|
+
assert_kind_of(TableLayout, @lm)
|
102
|
+
end
|
103
|
+
|
104
|
+
# def test_layout(writer)
|
105
|
+
# end
|
106
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created by Brent Rowland on 2008-02-22.
|
4
|
+
# Copyright (c) 2008, Eidetic Software. All rights reserved.
|
5
|
+
|
6
|
+
$: << File.dirname(__FILE__) + '/../'
|
7
|
+
require "minitest/autorun"
|
8
|
+
require 'erml'
|
9
|
+
require 'erml_rules'
|
10
|
+
|
11
|
+
include EideticRML::Rules
|
12
|
+
|
13
|
+
class RuleTestCases < Minitest::Test
|
14
|
+
def test_item_re_s
|
15
|
+
assert_equal('foo(#\\w+)?(\\.\\w+)*', Rule.item_re_s('foo'))
|
16
|
+
assert_equal('foo#bar(\\.\\w+)*', Rule.item_re_s('foo#bar'))
|
17
|
+
assert_equal('foo(#\\w+)?(\\.\\w+)*\\.bar(\\.\\w+)*', Rule.item_re_s('foo.bar'))
|
18
|
+
assert_equal('\w+#bar(\\.\\w+)*', Rule.item_re_s('#bar'))
|
19
|
+
assert_equal('\w+(#\\w+)?(\\.\\w+)*\\.bar(\\.\\w+)*', Rule.item_re_s('.bar'))
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_group_re_s
|
23
|
+
assert_equal('foo#bar(\\.\\w+)*\\/foo(#\\w+)?(\\.\\w+)*\\.bar(\\.\\w+)*', Rule.group_re_s('foo#bar>foo.bar'))
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_selector_re_s
|
27
|
+
assert_equal('foo#bar(\\.\\w+)*\\/([^\\/]+\\/)*foo(#\\w+)?(\\.\\w+)*\\.bar(\\.\\w+)*$', Rule.selector_re_s('foo#bar foo.bar'))
|
28
|
+
assert_equal('(foo(#\\w+)?(\\.\\w+)*$|bar(#\\w+)?(\\.\\w+)*$)', Rule.selector_re_s('foo, bar'))
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_foo
|
32
|
+
re = Regexp.compile Rule.selector_re_s('foo')
|
33
|
+
assert re =~ 'foo'
|
34
|
+
assert re =~ 'foo#bar'
|
35
|
+
assert re =~ 'foo.bar'
|
36
|
+
assert re =~ 'foo#bar.baz'
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_foo_comma_bar
|
40
|
+
re = Regexp.compile Rule.selector_re_s('foo, bar')
|
41
|
+
assert re =~ 'foo'
|
42
|
+
assert re =~ 'foo#bar'
|
43
|
+
assert re =~ 'bar'
|
44
|
+
assert re =~ 'bar.baz'
|
45
|
+
assert re !~ 'baz'
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_pound_bar
|
49
|
+
re = Regexp.compile Rule.selector_re_s('#bar')
|
50
|
+
assert re !~ 'foo'
|
51
|
+
assert re =~ 'foo#bar'
|
52
|
+
assert re !~ 'foo.bar'
|
53
|
+
assert re =~ 'foo#bar.baz'
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_dot_bar
|
57
|
+
re = Regexp.compile Rule.selector_re_s('.bar')
|
58
|
+
assert re !~ 'foo'
|
59
|
+
assert re !~ 'foo#bar'
|
60
|
+
assert re =~ 'foo.bar'
|
61
|
+
assert re !~ 'foo#bar.baz'
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_dot_baz
|
65
|
+
re = Regexp.compile Rule.selector_re_s('.baz')
|
66
|
+
assert re !~ 'foo'
|
67
|
+
assert re !~ 'foo#bar'
|
68
|
+
assert re !~ 'foo.bar'
|
69
|
+
assert re =~ 'foo#bar.baz'
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_direct_child
|
73
|
+
re = Regexp.compile Rule.selector_re_s('foo#bar>foo.bar')
|
74
|
+
assert re =~ 'foo#bar/foo.bar'
|
75
|
+
assert re !~ 'foo.bar/foo#bar'
|
76
|
+
assert re !~ 'foo#bar/foo#bar'
|
77
|
+
assert re !~ 'foo.bar/foo.bar'
|
78
|
+
assert re =~ 'foo#bar.baz/foo.bar'
|
79
|
+
assert re =~ 'foo#bar/foo.bar.baz'
|
80
|
+
assert re =~ 'foo#bar.baz/foo.bar.baz'
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_indirect_child
|
84
|
+
re = Regexp.compile Rule.selector_re_s('foo#bar foo.bar')
|
85
|
+
assert re =~ 'foo#bar/foo.bar'
|
86
|
+
assert re !~ 'foo.bar/foo#bar'
|
87
|
+
assert re !~ 'foo#bar/foo#bar'
|
88
|
+
assert re !~ 'foo.bar/foo.bar'
|
89
|
+
assert re =~ 'foo#bar.baz/foo.bar'
|
90
|
+
assert re =~ 'foo#bar/foo.bar.baz'
|
91
|
+
assert re =~ 'foo#bar.baz/foo.bar.baz'
|
92
|
+
|
93
|
+
assert re =~ 'foo#bar.baz/a/foo.bar.baz'
|
94
|
+
assert re =~ 'foo#bar.baz/a#b/foo.bar.baz'
|
95
|
+
assert re =~ 'foo#bar.baz/a.c/foo.bar.baz'
|
96
|
+
assert re =~ 'foo#bar.baz/a#b.c/foo.bar.baz'
|
97
|
+
assert re =~ 'foo#bar.baz/#b/foo.bar.baz'
|
98
|
+
assert re =~ 'foo#bar.baz/.c/foo.bar.baz'
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_parse
|
102
|
+
rules_text = <<-END
|
103
|
+
table label { border: solid; padding: 2pt }
|
104
|
+
.reverse { font.style: Bold; font.color: Gray; }
|
105
|
+
.rotated { rotate: 270; origin-y: bottom; }
|
106
|
+
.trouble { rotate: 30; origin-x: center; origin-y: middle; fill: White }
|
107
|
+
END
|
108
|
+
expected = [
|
109
|
+
["table label", {"border"=>"solid", "padding"=>"2pt"}],
|
110
|
+
[".reverse", {"font.style"=>"Bold", "font.color"=>"Gray"}],
|
111
|
+
[".rotated", {"rotate"=>"270", "origin_y"=>"bottom"}],
|
112
|
+
[".trouble", {"rotate"=>"30", "origin_x"=>"center", "origin_y"=>"middle", "fill"=>"White"}]
|
113
|
+
]
|
114
|
+
assert_equal(expected, Rule.parse(rules_text))
|
115
|
+
end
|
116
|
+
end
|