sprite-factory-custom 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/Gemfile +12 -0
  4. data/LICENSE +20 -0
  5. data/README.md +351 -0
  6. data/RELEASE_NOTES.md +60 -0
  7. data/Rakefile +73 -0
  8. data/bin/sf +57 -0
  9. data/lib/sprite_factory/layout/horizontal.rb +44 -0
  10. data/lib/sprite_factory/layout/packed.rb +118 -0
  11. data/lib/sprite_factory/layout/vertical.rb +44 -0
  12. data/lib/sprite_factory/library/chunky_png.rb +31 -0
  13. data/lib/sprite_factory/library/image_magick.rb +74 -0
  14. data/lib/sprite_factory/library/rmagick.rb +32 -0
  15. data/lib/sprite_factory/runner.rb +287 -0
  16. data/lib/sprite_factory/style.rb +74 -0
  17. data/lib/sprite_factory.rb +85 -0
  18. data/sprite_factory.gemspec +27 -0
  19. data/test/images/custom/custom.css +4 -0
  20. data/test/images/custom/running.png +0 -0
  21. data/test/images/custom/stopped.png +0 -0
  22. data/test/images/empty/readme.txt +1 -0
  23. data/test/images/formats/alice.gif +0 -0
  24. data/test/images/formats/codeincomplete.ico +0 -0
  25. data/test/images/formats/github.ico +0 -0
  26. data/test/images/formats/monkey.gif +0 -0
  27. data/test/images/formats/spies.jpg +0 -0
  28. data/test/images/formats/stackoverflow.ico +0 -0
  29. data/test/images/formats/thief.png +0 -0
  30. data/test/images/hover/div.bar__img.icon--active.png +0 -0
  31. data/test/images/hover/div.bar__img.icon--focus.png +0 -0
  32. data/test/images/hover/div.bar__img.icon--hover.png +0 -0
  33. data/test/images/hover/div.bar__img.icon--link.png +0 -0
  34. data/test/images/hover/div.bar__img.icon--visited.png +0 -0
  35. data/test/images/hover/div.bar__img.icon.png +0 -0
  36. data/test/images/hover/div.foo__img.icon--active.png +0 -0
  37. data/test/images/hover/div.foo__img.icon--focus.png +0 -0
  38. data/test/images/hover/div.foo__img.icon--hover.png +0 -0
  39. data/test/images/hover/div.foo__img.icon--link.png +0 -0
  40. data/test/images/hover/div.foo__img.icon--visited.png +0 -0
  41. data/test/images/hover/div.foo__img.icon.png +0 -0
  42. data/test/images/irregular/irregular1.png +0 -0
  43. data/test/images/irregular/irregular2.png +0 -0
  44. data/test/images/irregular/irregular3.png +0 -0
  45. data/test/images/irregular/irregular4.png +0 -0
  46. data/test/images/irregular/irregular5.png +0 -0
  47. data/test/images/irregular/readme.txt +2 -0
  48. data/test/images/reference/custom.css +22 -0
  49. data/test/images/reference/custom.png +0 -0
  50. data/test/images/reference/formats.css +28 -0
  51. data/test/images/reference/formats.png +0 -0
  52. data/test/images/reference/hover.css +38 -0
  53. data/test/images/reference/hover.png +0 -0
  54. data/test/images/reference/index.html +182 -0
  55. data/test/images/reference/irregular.css +24 -0
  56. data/test/images/reference/irregular.fixed.css +24 -0
  57. data/test/images/reference/irregular.fixed.png +0 -0
  58. data/test/images/reference/irregular.horizontal.css +24 -0
  59. data/test/images/reference/irregular.horizontal.png +0 -0
  60. data/test/images/reference/irregular.margin.css +24 -0
  61. data/test/images/reference/irregular.margin.png +0 -0
  62. data/test/images/reference/irregular.packed.css +24 -0
  63. data/test/images/reference/irregular.packed.png +0 -0
  64. data/test/images/reference/irregular.padded.css +24 -0
  65. data/test/images/reference/irregular.padded.png +0 -0
  66. data/test/images/reference/irregular.png +0 -0
  67. data/test/images/reference/irregular.sassy.css +38 -0
  68. data/test/images/reference/irregular.sassy.png +0 -0
  69. data/test/images/reference/irregular.sassy.sass +40 -0
  70. data/test/images/reference/irregular.vertical.css +24 -0
  71. data/test/images/reference/irregular.vertical.png +0 -0
  72. data/test/images/reference/regular.css +24 -0
  73. data/test/images/reference/regular.custom.css +24 -0
  74. data/test/images/reference/regular.custom.png +0 -0
  75. data/test/images/reference/regular.fixed.css +24 -0
  76. data/test/images/reference/regular.fixed.png +0 -0
  77. data/test/images/reference/regular.horizontal.css +24 -0
  78. data/test/images/reference/regular.horizontal.png +0 -0
  79. data/test/images/reference/regular.margin.css +24 -0
  80. data/test/images/reference/regular.margin.png +0 -0
  81. data/test/images/reference/regular.nocomments.css +5 -0
  82. data/test/images/reference/regular.nocomments.png +0 -0
  83. data/test/images/reference/regular.packed.css +24 -0
  84. data/test/images/reference/regular.packed.png +0 -0
  85. data/test/images/reference/regular.padded.css +24 -0
  86. data/test/images/reference/regular.padded.png +0 -0
  87. data/test/images/reference/regular.png +0 -0
  88. data/test/images/reference/regular.sassy.css +38 -0
  89. data/test/images/reference/regular.sassy.png +0 -0
  90. data/test/images/reference/regular.sassy.sass +40 -0
  91. data/test/images/reference/regular.vertical.css +24 -0
  92. data/test/images/reference/regular.vertical.png +0 -0
  93. data/test/images/reference/s.gif +0 -0
  94. data/test/images/reference/subfolders.css +24 -0
  95. data/test/images/reference/subfolders.png +0 -0
  96. data/test/images/regular/regular1.PNG +0 -0
  97. data/test/images/regular/regular2.PNG +0 -0
  98. data/test/images/regular/regular3.PNG +0 -0
  99. data/test/images/regular/regular4.PNG +0 -0
  100. data/test/images/regular/regular5.PNG +0 -0
  101. data/test/images/subfolders/england/amy.png +0 -0
  102. data/test/images/subfolders/england/bob.png +0 -0
  103. data/test/images/subfolders/france/bob.png +0 -0
  104. data/test/images/subfolders/usa/amy.png +0 -0
  105. data/test/images/subfolders/usa/bob.png +0 -0
  106. data/test/integration_test.rb +167 -0
  107. data/test/layout/horizontal_test.rb +156 -0
  108. data/test/layout/packed_test.rb +283 -0
  109. data/test/layout/test_case.rb +56 -0
  110. data/test/layout/vertical_test.rb +156 -0
  111. data/test/library_test.rb +58 -0
  112. data/test/runner_test.rb +229 -0
  113. data/test/style_test.rb +72 -0
  114. data/test/test_case.rb +138 -0
  115. metadata +286 -0
@@ -0,0 +1,38 @@
1
+ /* Creating a sprite from following images:
2
+ *
3
+ * test/images/irregular/irregular1.png (60x60)
4
+ * test/images/irregular/irregular2.png (16x16)
5
+ * test/images/irregular/irregular3.png (48x48)
6
+ * test/images/irregular/irregular4.png (34x14)
7
+ * test/images/irregular/irregular5.png (46x25)
8
+ *
9
+ * Output files:
10
+ * test/images/irregular.sassy.png
11
+ * test/images/irregular.sassy.sass
12
+ *
13
+ * Output size:
14
+ * 204x60 */
15
+ img.sassy_irregular1 {
16
+ width: 60px;
17
+ height: 60px;
18
+ background: url(irregular.sassy.png) 0px 0px no-repeat; }
19
+
20
+ img.sassy_irregular2 {
21
+ width: 16px;
22
+ height: 16px;
23
+ background: url(irregular.sassy.png) -60px -22px no-repeat; }
24
+
25
+ img.sassy_irregular3 {
26
+ width: 48px;
27
+ height: 48px;
28
+ background: url(irregular.sassy.png) -76px -6px no-repeat; }
29
+
30
+ img.sassy_irregular4 {
31
+ width: 34px;
32
+ height: 14px;
33
+ background: url(irregular.sassy.png) -124px -23px no-repeat; }
34
+
35
+ img.sassy_irregular5 {
36
+ width: 46px;
37
+ height: 25px;
38
+ background: url(irregular.sassy.png) -158px -17px no-repeat; }
@@ -0,0 +1,40 @@
1
+ /*
2
+ Creating a sprite from following images:
3
+
4
+ test/images/irregular/irregular1.png (60x60)
5
+ test/images/irregular/irregular2.png (16x16)
6
+ test/images/irregular/irregular3.png (48x48)
7
+ test/images/irregular/irregular4.png (34x14)
8
+ test/images/irregular/irregular5.png (46x25)
9
+
10
+ Output files:
11
+ test/images/irregular.sassy.png
12
+ test/images/irregular.sassy.sass
13
+
14
+ Output size:
15
+ 204x60 */
16
+ img.sassy_irregular1
17
+ width: 60px
18
+ height: 60px
19
+ background: url(irregular.sassy.png) 0px 0px no-repeat
20
+
21
+ img.sassy_irregular2
22
+ width: 16px
23
+ height: 16px
24
+ background: url(irregular.sassy.png) -60px -22px no-repeat
25
+
26
+ img.sassy_irregular3
27
+ width: 48px
28
+ height: 48px
29
+ background: url(irregular.sassy.png) -76px -6px no-repeat
30
+
31
+ img.sassy_irregular4
32
+ width: 34px
33
+ height: 14px
34
+ background: url(irregular.sassy.png) -124px -23px no-repeat
35
+
36
+ img.sassy_irregular5
37
+ width: 46px
38
+ height: 25px
39
+ background: url(irregular.sassy.png) -158px -17px no-repeat
40
+
@@ -0,0 +1,24 @@
1
+ /*
2
+
3
+ Creating a sprite from following images:
4
+
5
+ test/images/irregular/irregular1.png (60x60)
6
+ test/images/irregular/irregular2.png (16x16)
7
+ test/images/irregular/irregular3.png (48x48)
8
+ test/images/irregular/irregular4.png (34x14)
9
+ test/images/irregular/irregular5.png (46x25)
10
+
11
+ Output files:
12
+ test/images/irregular.vertical.png
13
+ test/images/irregular.vertical.css
14
+
15
+ Output size:
16
+ 60x163
17
+
18
+
19
+ */
20
+ img.vertical_irregular1 { width: 60px; height: 60px; background: url(irregular.vertical.png) 0px 0px no-repeat; }
21
+ img.vertical_irregular2 { width: 16px; height: 16px; background: url(irregular.vertical.png) -22px -60px no-repeat; }
22
+ img.vertical_irregular3 { width: 48px; height: 48px; background: url(irregular.vertical.png) -6px -76px no-repeat; }
23
+ img.vertical_irregular4 { width: 34px; height: 14px; background: url(irregular.vertical.png) -13px -124px no-repeat; }
24
+ img.vertical_irregular5 { width: 46px; height: 25px; background: url(irregular.vertical.png) -7px -138px no-repeat; }
@@ -0,0 +1,24 @@
1
+ /*
2
+
3
+ Creating a sprite from following images:
4
+
5
+ test/images/regular/regular1.PNG (64x64)
6
+ test/images/regular/regular2.PNG (64x64)
7
+ test/images/regular/regular3.PNG (64x64)
8
+ test/images/regular/regular4.PNG (64x64)
9
+ test/images/regular/regular5.PNG (64x64)
10
+
11
+ Output files:
12
+ test/images/regular.png
13
+ test/images/regular.css
14
+
15
+ Output size:
16
+ 320x64
17
+
18
+
19
+ */
20
+ img.regular1 { width: 64px; height: 64px; background: url(regular.png) 0px 0px no-repeat; }
21
+ img.regular2 { width: 64px; height: 64px; background: url(regular.png) -64px 0px no-repeat; }
22
+ img.regular3 { width: 64px; height: 64px; background: url(regular.png) -128px 0px no-repeat; }
23
+ img.regular4 { width: 64px; height: 64px; background: url(regular.png) -192px 0px no-repeat; }
24
+ img.regular5 { width: 64px; height: 64px; background: url(regular.png) -256px 0px no-repeat; }
@@ -0,0 +1,24 @@
1
+ /*
2
+
3
+ Creating a sprite from following images:
4
+
5
+ test/images/regular/regular1.png (64x64)
6
+ test/images/regular/regular2.png (64x64)
7
+ test/images/regular/regular3.png (64x64)
8
+ test/images/regular/regular4.png (64x64)
9
+ test/images/regular/regular5.png (64x64)
10
+
11
+ Output files:
12
+ test/images/regular.custom.png
13
+ test/images/regular.custom.css
14
+
15
+ Output size:
16
+ 320x64
17
+
18
+
19
+ */
20
+ span.custom_regular1 { border: 4px solid green; display: inline-block; width: 64px; height: 64px; background: url(regular.custom.png) 0px 0px no-repeat; }
21
+ span.custom_regular2 { border: 4px solid blue; display: inline-block; width: 64px; height: 64px; background: url(regular.custom.png) -64px 0px no-repeat; }
22
+ span.custom_regular3 { border: 4px solid red; display: inline-block; width: 64px; height: 64px; background: url(regular.custom.png) -128px 0px no-repeat; }
23
+ span.custom_regular4 { border: 4px solid yellow; display: inline-block; width: 64px; height: 64px; background: url(regular.custom.png) -192px 0px no-repeat; }
24
+ span.custom_regular5 { border: 4px solid pink; display: inline-block; width: 64px; height: 64px; background: url(regular.custom.png) -256px 0px no-repeat; }
@@ -0,0 +1,24 @@
1
+ /*
2
+
3
+ Creating a sprite from following images:
4
+
5
+ test/images/regular/regular1.PNG (64x64)
6
+ test/images/regular/regular2.PNG (64x64)
7
+ test/images/regular/regular3.PNG (64x64)
8
+ test/images/regular/regular4.PNG (64x64)
9
+ test/images/regular/regular5.PNG (64x64)
10
+
11
+ Output files:
12
+ test/images/regular.fixed.png
13
+ test/images/regular.fixed.css
14
+
15
+ Output size:
16
+ 500x100
17
+
18
+
19
+ */
20
+ img.fixed_regular1 { width: 100px; height: 100px; background: url(regular.fixed.png) 0px 0px no-repeat; }
21
+ img.fixed_regular2 { width: 100px; height: 100px; background: url(regular.fixed.png) -100px 0px no-repeat; }
22
+ img.fixed_regular3 { width: 100px; height: 100px; background: url(regular.fixed.png) -200px 0px no-repeat; }
23
+ img.fixed_regular4 { width: 100px; height: 100px; background: url(regular.fixed.png) -300px 0px no-repeat; }
24
+ img.fixed_regular5 { width: 100px; height: 100px; background: url(regular.fixed.png) -400px 0px no-repeat; }
@@ -0,0 +1,24 @@
1
+ /*
2
+
3
+ Creating a sprite from following images:
4
+
5
+ test/images/regular/regular1.PNG (64x64)
6
+ test/images/regular/regular2.PNG (64x64)
7
+ test/images/regular/regular3.PNG (64x64)
8
+ test/images/regular/regular4.PNG (64x64)
9
+ test/images/regular/regular5.PNG (64x64)
10
+
11
+ Output files:
12
+ test/images/regular.horizontal.png
13
+ test/images/regular.horizontal.css
14
+
15
+ Output size:
16
+ 320x64
17
+
18
+
19
+ */
20
+ img.horizontal_regular1 { width: 64px; height: 64px; background: url(regular.horizontal.png) 0px 0px no-repeat; }
21
+ img.horizontal_regular2 { width: 64px; height: 64px; background: url(regular.horizontal.png) -64px 0px no-repeat; }
22
+ img.horizontal_regular3 { width: 64px; height: 64px; background: url(regular.horizontal.png) -128px 0px no-repeat; }
23
+ img.horizontal_regular4 { width: 64px; height: 64px; background: url(regular.horizontal.png) -192px 0px no-repeat; }
24
+ img.horizontal_regular5 { width: 64px; height: 64px; background: url(regular.horizontal.png) -256px 0px no-repeat; }
@@ -0,0 +1,24 @@
1
+ /*
2
+
3
+ Creating a sprite from following images:
4
+
5
+ test/images/regular/regular1.PNG (64x64)
6
+ test/images/regular/regular2.PNG (64x64)
7
+ test/images/regular/regular3.PNG (64x64)
8
+ test/images/regular/regular4.PNG (64x64)
9
+ test/images/regular/regular5.PNG (64x64)
10
+
11
+ Output files:
12
+ test/images/regular.margin.png
13
+ test/images/regular.margin.css
14
+
15
+ Output size:
16
+ 420x84
17
+
18
+
19
+ */
20
+ img.margin_regular1 { width: 64px; height: 64px; background: url(regular.margin.png) -10px -10px no-repeat; }
21
+ img.margin_regular2 { width: 64px; height: 64px; background: url(regular.margin.png) -94px -10px no-repeat; }
22
+ img.margin_regular3 { width: 64px; height: 64px; background: url(regular.margin.png) -178px -10px no-repeat; }
23
+ img.margin_regular4 { width: 64px; height: 64px; background: url(regular.margin.png) -262px -10px no-repeat; }
24
+ img.margin_regular5 { width: 64px; height: 64px; background: url(regular.margin.png) -346px -10px no-repeat; }
@@ -0,0 +1,5 @@
1
+ img.nocomments_regular1 { width: 64px; height: 64px; background: url(regular.nocomments.png) 0px 0px no-repeat; }
2
+ img.nocomments_regular2 { width: 64px; height: 64px; background: url(regular.nocomments.png) -64px 0px no-repeat; }
3
+ img.nocomments_regular3 { width: 64px; height: 64px; background: url(regular.nocomments.png) -128px 0px no-repeat; }
4
+ img.nocomments_regular4 { width: 64px; height: 64px; background: url(regular.nocomments.png) -192px 0px no-repeat; }
5
+ img.nocomments_regular5 { width: 64px; height: 64px; background: url(regular.nocomments.png) -256px 0px no-repeat; }
@@ -0,0 +1,24 @@
1
+ /*
2
+
3
+ Creating a sprite from following images:
4
+
5
+ test/images/regular/regular1.PNG (64x64)
6
+ test/images/regular/regular2.PNG (64x64)
7
+ test/images/regular/regular3.PNG (64x64)
8
+ test/images/regular/regular4.PNG (64x64)
9
+ test/images/regular/regular5.PNG (64x64)
10
+
11
+ Output files:
12
+ test/images/regular.packed.png
13
+ test/images/regular.packed.css
14
+
15
+ Output size:
16
+ 312x208
17
+
18
+
19
+ */
20
+ img.packed_regular1 { width: 84px; height: 84px; background: url(regular.packed.png) -10px -10px no-repeat; }
21
+ img.packed_regular2 { width: 84px; height: 84px; background: url(regular.packed.png) -114px -10px no-repeat; }
22
+ img.packed_regular3 { width: 84px; height: 84px; background: url(regular.packed.png) -10px -114px no-repeat; }
23
+ img.packed_regular4 { width: 84px; height: 84px; background: url(regular.packed.png) -114px -114px no-repeat; }
24
+ img.packed_regular5 { width: 84px; height: 84px; background: url(regular.packed.png) -218px -10px no-repeat; }
@@ -0,0 +1,24 @@
1
+ /*
2
+
3
+ Creating a sprite from following images:
4
+
5
+ test/images/regular/regular1.PNG (64x64)
6
+ test/images/regular/regular2.PNG (64x64)
7
+ test/images/regular/regular3.PNG (64x64)
8
+ test/images/regular/regular4.PNG (64x64)
9
+ test/images/regular/regular5.PNG (64x64)
10
+
11
+ Output files:
12
+ test/images/regular.padded.png
13
+ test/images/regular.padded.css
14
+
15
+ Output size:
16
+ 420x84
17
+
18
+
19
+ */
20
+ img.padded_regular1 { width: 84px; height: 84px; background: url(regular.padded.png) 0px 0px no-repeat; }
21
+ img.padded_regular2 { width: 84px; height: 84px; background: url(regular.padded.png) -84px 0px no-repeat; }
22
+ img.padded_regular3 { width: 84px; height: 84px; background: url(regular.padded.png) -168px 0px no-repeat; }
23
+ img.padded_regular4 { width: 84px; height: 84px; background: url(regular.padded.png) -252px 0px no-repeat; }
24
+ img.padded_regular5 { width: 84px; height: 84px; background: url(regular.padded.png) -336px 0px no-repeat; }
Binary file
@@ -0,0 +1,38 @@
1
+ /* Creating a sprite from following images:
2
+ *
3
+ * test/images/regular/regular1.png (64x64)
4
+ * test/images/regular/regular2.png (64x64)
5
+ * test/images/regular/regular3.png (64x64)
6
+ * test/images/regular/regular4.png (64x64)
7
+ * test/images/regular/regular5.png (64x64)
8
+ *
9
+ * Output files:
10
+ * test/images/regular.sassy.png
11
+ * test/images/regular.sassy.sass
12
+ *
13
+ * Output size:
14
+ * 320x64 */
15
+ img.sassy_regular1 {
16
+ width: 64px;
17
+ height: 64px;
18
+ background: url(regular.sassy.png) 0px 0px no-repeat; }
19
+
20
+ img.sassy_regular2 {
21
+ width: 64px;
22
+ height: 64px;
23
+ background: url(regular.sassy.png) -64px 0px no-repeat; }
24
+
25
+ img.sassy_regular3 {
26
+ width: 64px;
27
+ height: 64px;
28
+ background: url(regular.sassy.png) -128px 0px no-repeat; }
29
+
30
+ img.sassy_regular4 {
31
+ width: 64px;
32
+ height: 64px;
33
+ background: url(regular.sassy.png) -192px 0px no-repeat; }
34
+
35
+ img.sassy_regular5 {
36
+ width: 64px;
37
+ height: 64px;
38
+ background: url(regular.sassy.png) -256px 0px no-repeat; }
@@ -0,0 +1,40 @@
1
+ /*
2
+ Creating a sprite from following images:
3
+
4
+ test/images/regular/regular1.PNG (64x64)
5
+ test/images/regular/regular2.PNG (64x64)
6
+ test/images/regular/regular3.PNG (64x64)
7
+ test/images/regular/regular4.PNG (64x64)
8
+ test/images/regular/regular5.PNG (64x64)
9
+
10
+ Output files:
11
+ test/images/regular.sassy.png
12
+ test/images/regular.sassy.sass
13
+
14
+ Output size:
15
+ 320x64 */
16
+ img.sassy_regular1
17
+ width: 64px
18
+ height: 64px
19
+ background: url(regular.sassy.png) 0px 0px no-repeat
20
+
21
+ img.sassy_regular2
22
+ width: 64px
23
+ height: 64px
24
+ background: url(regular.sassy.png) -64px 0px no-repeat
25
+
26
+ img.sassy_regular3
27
+ width: 64px
28
+ height: 64px
29
+ background: url(regular.sassy.png) -128px 0px no-repeat
30
+
31
+ img.sassy_regular4
32
+ width: 64px
33
+ height: 64px
34
+ background: url(regular.sassy.png) -192px 0px no-repeat
35
+
36
+ img.sassy_regular5
37
+ width: 64px
38
+ height: 64px
39
+ background: url(regular.sassy.png) -256px 0px no-repeat
40
+
@@ -0,0 +1,24 @@
1
+ /*
2
+
3
+ Creating a sprite from following images:
4
+
5
+ test/images/regular/regular1.PNG (64x64)
6
+ test/images/regular/regular2.PNG (64x64)
7
+ test/images/regular/regular3.PNG (64x64)
8
+ test/images/regular/regular4.PNG (64x64)
9
+ test/images/regular/regular5.PNG (64x64)
10
+
11
+ Output files:
12
+ test/images/regular.vertical.png
13
+ test/images/regular.vertical.css
14
+
15
+ Output size:
16
+ 64x320
17
+
18
+
19
+ */
20
+ img.vertical_regular1 { width: 64px; height: 64px; background: url(regular.vertical.png) 0px 0px no-repeat; }
21
+ img.vertical_regular2 { width: 64px; height: 64px; background: url(regular.vertical.png) 0px -64px no-repeat; }
22
+ img.vertical_regular3 { width: 64px; height: 64px; background: url(regular.vertical.png) 0px -128px no-repeat; }
23
+ img.vertical_regular4 { width: 64px; height: 64px; background: url(regular.vertical.png) 0px -192px no-repeat; }
24
+ img.vertical_regular5 { width: 64px; height: 64px; background: url(regular.vertical.png) 0px -256px no-repeat; }
Binary file
@@ -0,0 +1,24 @@
1
+ /*
2
+
3
+ Creating a sprite from following images:
4
+
5
+ test/images/subfolders/england/amy.png (64x64)
6
+ test/images/subfolders/england/bob.png (64x64)
7
+ test/images/subfolders/france/bob.png (64x64)
8
+ test/images/subfolders/usa/amy.png (64x64)
9
+ test/images/subfolders/usa/bob.png (64x64)
10
+
11
+ Output files:
12
+ test/images/subfolders.png
13
+ test/images/subfolders.css
14
+
15
+ Output size:
16
+ 320x64
17
+
18
+
19
+ */
20
+ img.england_amy { width: 64px; height: 64px; background: url(subfolders.png) 0px 0px no-repeat; }
21
+ img.england_bob { width: 64px; height: 64px; background: url(subfolders.png) -64px 0px no-repeat; }
22
+ img.france_bob { width: 64px; height: 64px; background: url(subfolders.png) -128px 0px no-repeat; }
23
+ img.usa_amy { width: 64px; height: 64px; background: url(subfolders.png) -192px 0px no-repeat; }
24
+ img.usa_bob { width: 64px; height: 64px; background: url(subfolders.png) -256px 0px no-repeat; }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,167 @@
1
+ require File.expand_path('test_case', File.dirname(__FILE__))
2
+
3
+ module SpriteFactory
4
+ class IntegrationTest < SpriteFactory::TestCase
5
+
6
+ #----------------------------------------------------------------------------
7
+
8
+ def test_generate_regular_sprite
9
+ integration_test(REGULAR_PATH)
10
+ end
11
+
12
+ def test_generate_horizontal_regular_sprite
13
+ integration_test(REGULAR_PATH, :output => output_path('regular.horizontal'),
14
+ :selector => 'img.horizontal_',
15
+ :layout => :horizontal)
16
+ end
17
+
18
+ def test_generate_vertical_regular_sprite
19
+ integration_test(REGULAR_PATH, :output => output_path('regular.vertical'),
20
+ :selector => 'img.vertical_',
21
+ :layout => :vertical)
22
+ end
23
+
24
+ def test_generate_packed_regular_sprite
25
+ integration_test(REGULAR_PATH, :output => output_path('regular.packed'),
26
+ :selector => 'img.packed_',
27
+ :layout => :packed,
28
+ :padding => 10,
29
+ :margin => 10)
30
+ end
31
+
32
+ def test_generate_regular_sprite_with_padding
33
+ integration_test(REGULAR_PATH, :output => output_path('regular.padded'),
34
+ :selector => 'img.padded_',
35
+ :padding => 10)
36
+ end
37
+
38
+ def test_generate_regular_sprite_with_margin
39
+ integration_test(REGULAR_PATH, :output => output_path('regular.margin'),
40
+ :selector => 'img.margin_',
41
+ :margin => 10)
42
+ end
43
+
44
+ def test_generate_regular_sprite_with_fixed_size
45
+ integration_test(REGULAR_PATH, :output => output_path('regular.fixed'),
46
+ :selector => 'img.fixed_',
47
+ :width => 100,
48
+ :height => 100)
49
+ end
50
+
51
+ def test_generate_regular_sprite_with_sassy_style
52
+ integration_test(REGULAR_PATH, :output => output_path('regular.sassy'),
53
+ :selector => 'img.sassy_',
54
+ :style => :sass)
55
+ end
56
+
57
+ def test_generate_regular_with_nocomments
58
+ integration_test(REGULAR_PATH, :output => output_path('regular.nocomments'),
59
+ :selector => 'img.nocomments_',
60
+ :nocomments => true)
61
+ end
62
+
63
+ #----------------------------------------------------------------------------
64
+
65
+ def test_generate_irregular_sprite
66
+ integration_test(IRREGULAR_PATH)
67
+ end
68
+
69
+ def test_generate_horizontal_irregular_sprite
70
+ integration_test(IRREGULAR_PATH, :output => output_path('irregular.horizontal'),
71
+ :selector => 'img.horizontal_',
72
+ :layout => :horizontal)
73
+ end
74
+
75
+ def test_generate_vertical_irregular_sprite
76
+ integration_test(IRREGULAR_PATH, :output => output_path('irregular.vertical'),
77
+ :selector => 'img.vertical_',
78
+ :layout => :vertical)
79
+ end
80
+
81
+ def test_generate_packed_irregular_sprite
82
+ integration_test(IRREGULAR_PATH, :output => output_path('irregular.packed'),
83
+ :selector => 'img.packed_',
84
+ :layout => :packed,
85
+ :padding => 10,
86
+ :margin => 10)
87
+ end
88
+
89
+ def test_generate_irregular_sprite_with_padding
90
+ integration_test(IRREGULAR_PATH, :output => output_path('irregular.padded'),
91
+ :selector => 'img.padded_',
92
+ :padding => 10)
93
+ end
94
+
95
+ def test_generate_irregular_sprite_with_margin
96
+ integration_test(IRREGULAR_PATH, :output => output_path('irregular.margin'),
97
+ :selector => 'img.margin_',
98
+ :margin => 10)
99
+ end
100
+
101
+ def test_generate_irregular_sprite_with_fixed_size
102
+ integration_test(IRREGULAR_PATH, :output => output_path('irregular.fixed'),
103
+ :selector => 'img.fixed_',
104
+ :width => 100,
105
+ :height => 100)
106
+ end
107
+
108
+ def test_generate_irregular_sprite_with_sassy_style
109
+ integration_test(IRREGULAR_PATH, :output => output_path('irregular.sassy'),
110
+ :selector => 'img.sassy_',
111
+ :style => :sass)
112
+ end
113
+
114
+ #----------------------------------------------------------------------------
115
+
116
+ def test_generate_custom_sprite
117
+ integration_test(CUSTOM_PATH) do |images|
118
+ rules = []
119
+ rules << "div.running img.button { cursor: pointer; #{images[:running][:style]} }"
120
+ rules << "div.stopped img.button { cursor: pointer; #{images[:stopped][:style]} }"
121
+ rules.join("\n")
122
+ end
123
+ end
124
+
125
+ #----------------------------------------------------------------------------
126
+
127
+ def test_generate_sprite_from_other_formats
128
+ integration_test(FORMATS_PATH, :library => :rmagick)
129
+ end
130
+
131
+ #----------------------------------------------------------------------------
132
+
133
+ def test_generate_sprite_using_images_in_subfolders
134
+ integration_test(SUBFOLDERS_PATH)
135
+ end
136
+
137
+ #----------------------------------------------------------------------------
138
+
139
+ def test_generate_sprites_with_hover_pseudo_class
140
+ integration_test(HOVER_PATH, :selector => 'div.hover ')
141
+ end
142
+
143
+ #----------------------------------------------------------------------------
144
+
145
+ def test_generate_sprite_with_nocss
146
+ input = REGULAR_PATH
147
+ output = File.basename(REGULAR_PATH)
148
+ with_clean_output do
149
+
150
+ assert_equal(false, File.exists?(output_path(output + ".png")), "preconditions")
151
+ assert_equal(false, File.exists?(output_path(output + ".css")), "preconditions")
152
+
153
+ css = SpriteFactory.run!(REGULAR_PATH, {:nocss => true})
154
+
155
+ assert_equal(true, File.exists?(output_path(output + ".png")), "output sprite IMAGE should exist")
156
+ assert_equal(false, File.exists?(output_path(output + ".css")), "output sprite CSS should NOT exist")
157
+ assert_equal(IO.read(reference_path(output+".css")), css, "expected return value from #run! to provide generated CSS content")
158
+
159
+ assert_reference_image(output + ".png")
160
+
161
+ end
162
+ end
163
+
164
+ #----------------------------------------------------------------------------
165
+
166
+ end
167
+ end