compass-sass37 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.markdown +1 -0
- data/Rakefile +237 -0
- data/VERSION +1 -0
- data/VERSION_NAME +1 -0
- data/bin/compass +45 -0
- data/features/command_line.feature +195 -0
- data/features/extensions.feature +27 -0
- data/features/step_definitions/command_line_steps.rb +268 -0
- data/features/step_definitions/extension_steps.rb +24 -0
- data/lib/compass/actions.rb +116 -0
- data/lib/compass/app_integration/stand_alone/configuration_defaults.rb +32 -0
- data/lib/compass/app_integration/stand_alone/installer.rb +83 -0
- data/lib/compass/app_integration/stand_alone.rb +22 -0
- data/lib/compass/app_integration.rb +39 -0
- data/lib/compass/commands/base.rb +44 -0
- data/lib/compass/commands/clean_project.rb +79 -0
- data/lib/compass/commands/create_project.rb +131 -0
- data/lib/compass/commands/default.rb +50 -0
- data/lib/compass/commands/extension_command.rb +60 -0
- data/lib/compass/commands/help.rb +85 -0
- data/lib/compass/commands/imports.rb +35 -0
- data/lib/compass/commands/installer_command.rb +32 -0
- data/lib/compass/commands/interactive.rb +61 -0
- data/lib/compass/commands/list_frameworks.rb +39 -0
- data/lib/compass/commands/print_version.rb +88 -0
- data/lib/compass/commands/project_base.rb +103 -0
- data/lib/compass/commands/project_stats.rb +178 -0
- data/lib/compass/commands/project_structure.rb +93 -0
- data/lib/compass/commands/registry.rb +40 -0
- data/lib/compass/commands/sprite.rb +89 -0
- data/lib/compass/commands/stamp_pattern.rb +90 -0
- data/lib/compass/commands/unpack_extension.rb +120 -0
- data/lib/compass/commands/update_project.rb +148 -0
- data/lib/compass/commands/validate_project.rb +77 -0
- data/lib/compass/commands/watch_project.rb +117 -0
- data/lib/compass/commands/write_configuration.rb +125 -0
- data/lib/compass/commands.rb +14 -0
- data/lib/compass/compiler.rb +249 -0
- data/lib/compass/configuration/comments.rb +62 -0
- data/lib/compass/configuration/file_data.rb +21 -0
- data/lib/compass/configuration/helpers.rb +113 -0
- data/lib/compass/configuration/serialization.rb +95 -0
- data/lib/compass/dependencies.rb +12 -0
- data/lib/compass/deprecation.rb +19 -0
- data/lib/compass/errors.rb +9 -0
- data/lib/compass/exec/command_option_parser.rb +23 -0
- data/lib/compass/exec/global_options_parser.rb +59 -0
- data/lib/compass/exec/helpers.rb +21 -0
- data/lib/compass/exec/project_options_parser.rb +74 -0
- data/lib/compass/exec/sub_command_ui.rb +51 -0
- data/lib/compass/exec.rb +23 -0
- data/lib/compass/generated_version.rb +4 -0
- data/lib/compass/installers/bare_installer.rb +58 -0
- data/lib/compass/installers/base.rb +187 -0
- data/lib/compass/installers/manifest.rb +161 -0
- data/lib/compass/installers/manifest_installer.rb +61 -0
- data/lib/compass/installers/template_context.rb +44 -0
- data/lib/compass/installers.rb +3 -0
- data/lib/compass/logger.rb +140 -0
- data/lib/compass/quick_cache.rb +15 -0
- data/lib/compass/rails.rb +2 -0
- data/lib/compass/sass_compiler.rb +152 -0
- data/lib/compass/sass_extensions/functions/sprites.rb +305 -0
- data/lib/compass/sass_extensions/functions.rb +15 -0
- data/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb +35 -0
- data/lib/compass/sass_extensions/sprites/engines.rb +25 -0
- data/lib/compass/sass_extensions/sprites/image.rb +162 -0
- data/lib/compass/sass_extensions/sprites/image_methods.rb +52 -0
- data/lib/compass/sass_extensions/sprites/image_row.rb +47 -0
- data/lib/compass/sass_extensions/sprites/images.rb +29 -0
- data/lib/compass/sass_extensions/sprites/layout/diagonal.rb +42 -0
- data/lib/compass/sass_extensions/sprites/layout/horizontal.rb +66 -0
- data/lib/compass/sass_extensions/sprites/layout/smart.rb +33 -0
- data/lib/compass/sass_extensions/sprites/layout/vertical.rb +68 -0
- data/lib/compass/sass_extensions/sprites/layout.rb +39 -0
- data/lib/compass/sass_extensions/sprites/layout_methods.rb +53 -0
- data/lib/compass/sass_extensions/sprites/row_fitter.rb +92 -0
- data/lib/compass/sass_extensions/sprites/sprite_map.rb +93 -0
- data/lib/compass/sass_extensions/sprites/sprite_methods.rb +136 -0
- data/lib/compass/sass_extensions/sprites.rb +21 -0
- data/lib/compass/sass_extensions.rb +9 -0
- data/lib/compass/sprite_importer/binding.rb +11 -0
- data/lib/compass/sprite_importer/content.erb +87 -0
- data/lib/compass/sprite_importer.rb +117 -0
- data/lib/compass/stats.rb +99 -0
- data/lib/compass/test_case.rb +38 -0
- data/lib/compass/validator.rb +16 -0
- data/lib/compass/version.rb +42 -0
- data/lib/compass.rb +39 -0
- data/test/fixtures/extensions/only_stylesheets/compass_init.rb +1 -0
- data/test/fixtures/extensions/only_stylesheets/scss/only_stylesheets/foo.scss +3 -0
- data/test/fixtures/fonts/bgrove.base64.txt +1 -0
- data/test/fixtures/fonts/bgrove.ttf +0 -0
- data/test/fixtures/sprites/public/images/bad_extensions/ten-by-ten.gif +0 -0
- data/test/fixtures/sprites/public/images/bad_extensions/twenty-by-twenty.jpg +0 -0
- data/test/fixtures/sprites/public/images/bool/false.png +0 -0
- data/test/fixtures/sprites/public/images/bool/true.png +0 -0
- data/test/fixtures/sprites/public/images/colors/blue.png +0 -0
- data/test/fixtures/sprites/public/images/colors/yellow.png +0 -0
- data/test/fixtures/sprites/public/images/focus/ten-by-ten.png +0 -0
- data/test/fixtures/sprites/public/images/focus/ten-by-ten_active.png +0 -0
- data/test/fixtures/sprites/public/images/focus/ten-by-ten_focus.png +0 -0
- data/test/fixtures/sprites/public/images/focus/ten-by-ten_hover.png +0 -0
- data/test/fixtures/sprites/public/images/focus/ten-by-ten_target.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/large.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/large_square.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/medium.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/small.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/tall.png +0 -0
- data/test/fixtures/sprites/public/images/ko/default_background.png +0 -0
- data/test/fixtures/sprites/public/images/ko/starbg26x27.png +0 -0
- data/test/fixtures/sprites/public/images/nested/squares/ten-by-ten.png +0 -0
- data/test/fixtures/sprites/public/images/numeric/200.png +0 -0
- data/test/fixtures/sprites/public/images/prefix/20-by-20.png +0 -0
- data/test/fixtures/sprites/public/images/prefix/ten-by-ten.png +0 -0
- data/test/fixtures/sprites/public/images/repeat_x/five.png +0 -0
- data/test/fixtures/sprites/public/images/repeat_x/four.png +0 -0
- data/test/fixtures/sprites/public/images/repeat_x/one.png +0 -0
- data/test/fixtures/sprites/public/images/repeat_x/three.png +0 -0
- data/test/fixtures/sprites/public/images/repeat_x/two.png +0 -0
- data/test/fixtures/sprites/public/images/selectors/ten-by-ten.png +0 -0
- data/test/fixtures/sprites/public/images/selectors/ten-by-ten_active.png +0 -0
- data/test/fixtures/sprites/public/images/selectors/ten-by-ten_hover.png +0 -0
- data/test/fixtures/sprites/public/images/selectors/ten-by-ten_target.png +0 -0
- data/test/fixtures/sprites/public/images/squares/ten-by-ten.png +0 -0
- data/test/fixtures/sprites/public/images/squares/twenty-by-twenty.png +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/config.rb +32 -0
- data/test/fixtures/stylesheets/busted_font_urls/css/screen.css +9 -0
- data/test/fixtures/stylesheets/busted_font_urls/fonts/feed.ttf +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/fonts/grid.ttf +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/fonts/sub/dk.ttf +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/sass/screen.sass +14 -0
- data/test/fixtures/stylesheets/busted_image_urls/config.rb +29 -0
- data/test/fixtures/stylesheets/busted_image_urls/css/screen.css +9 -0
- data/test/fixtures/stylesheets/busted_image_urls/images/feed.png +0 -0
- data/test/fixtures/stylesheets/busted_image_urls/images/flags/dk.png +0 -0
- data/test/fixtures/stylesheets/busted_image_urls/images/grid.png +0 -0
- data/test/fixtures/stylesheets/busted_image_urls/sass/screen.sass +14 -0
- data/test/fixtures/stylesheets/compass/100x150.jpg +0 -0
- data/test/fixtures/stylesheets/compass/config.rb +18 -0
- data/test/fixtures/stylesheets/compass/css/animation-with-legacy-ie.css +22 -0
- data/test/fixtures/stylesheets/compass/css/animation.css +22 -0
- data/test/fixtures/stylesheets/compass/css/appearance.css +3 -0
- data/test/fixtures/stylesheets/compass/css/background-clip.css +11 -0
- data/test/fixtures/stylesheets/compass/css/background-origin.css +11 -0
- data/test/fixtures/stylesheets/compass/css/background-size.css +17 -0
- data/test/fixtures/stylesheets/compass/css/border_radius.css +14 -0
- data/test/fixtures/stylesheets/compass/css/box-sizing.css +14 -0
- data/test/fixtures/stylesheets/compass/css/box.css +103 -0
- data/test/fixtures/stylesheets/compass/css/box_shadow.css +24 -0
- data/test/fixtures/stylesheets/compass/css/brightness.css +14 -0
- data/test/fixtures/stylesheets/compass/css/browser-support.css +335 -0
- data/test/fixtures/stylesheets/compass/css/color.css +18 -0
- data/test/fixtures/stylesheets/compass/css/columns.css +134 -0
- data/test/fixtures/stylesheets/compass/css/filters.css +53 -0
- data/test/fixtures/stylesheets/compass/css/flexbox.css +94 -0
- data/test/fixtures/stylesheets/compass/css/fonts.css +8 -0
- data/test/fixtures/stylesheets/compass/css/force-wrap.css +9 -0
- data/test/fixtures/stylesheets/compass/css/gradients.css +222 -0
- data/test/fixtures/stylesheets/compass/css/grid_background.css +79 -0
- data/test/fixtures/stylesheets/compass/css/hyphenation.css +16 -0
- data/test/fixtures/stylesheets/compass/css/image_size.css +15 -0
- data/test/fixtures/stylesheets/compass/css/images.css +8 -0
- data/test/fixtures/stylesheets/compass/css/layout.css +16 -0
- data/test/fixtures/stylesheets/compass/css/legacy_clearfix.css +26 -0
- data/test/fixtures/stylesheets/compass/css/lists.css +145 -0
- data/test/fixtures/stylesheets/compass/css/opacity.css +7 -0
- data/test/fixtures/stylesheets/compass/css/print.css +11 -0
- data/test/fixtures/stylesheets/compass/css/regions.css +9 -0
- data/test/fixtures/stylesheets/compass/css/replacement.css +66 -0
- data/test/fixtures/stylesheets/compass/css/reset.css +59 -0
- data/test/fixtures/stylesheets/compass/css/selection.css +50 -0
- data/test/fixtures/stylesheets/compass/css/sprites_with_explicit_separator.css +19 -0
- data/test/fixtures/stylesheets/compass/css/stretching.css +66 -0
- data/test/fixtures/stylesheets/compass/css/support.css +116 -0
- data/test/fixtures/stylesheets/compass/css/text_shadow.css +29 -0
- data/test/fixtures/stylesheets/compass/css/transform.css +341 -0
- data/test/fixtures/stylesheets/compass/css/transition.css +116 -0
- data/test/fixtures/stylesheets/compass/css/typography/links/hover-link.css +4 -0
- data/test/fixtures/stylesheets/compass/css/units.css +34 -0
- data/test/fixtures/stylesheets/compass/css/user-interface.css +52 -0
- data/test/fixtures/stylesheets/compass/css/utilities.css +71 -0
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm.css +42 -0
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm_with_ems.css +53 -0
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm_with_px.css +52 -0
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm_with_rems.css +67 -0
- data/test/fixtures/stylesheets/compass/images/100x150.gif +0 -0
- data/test/fixtures/stylesheets/compass/images/100x150.jpeg +0 -0
- data/test/fixtures/stylesheets/compass/images/100x150.jpg +0 -0
- data/test/fixtures/stylesheets/compass/images/100x150.png +0 -0
- data/test/fixtures/stylesheets/compass/images/4x6.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ad.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ae.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/af.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ag.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ai.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/al.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/am.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/an.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ao.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ar.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/as.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/at.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/au.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/aw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ax.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/az.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ba.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bb.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bd.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/be.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bh.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bi.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bj.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bo.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/br.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bs.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bv.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/by.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ca.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/catalonia.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cd.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ch.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ci.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ck.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cl.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/co.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cs.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cv.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cx.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cy.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/de.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/dj.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/dk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/dm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/do.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/dz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ec.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ee.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/eg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/eh.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/england.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/er.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/es.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/et.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/europeanunion.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fam.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fi.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fj.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fo.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ga.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gb.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gd.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ge.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gh.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gi.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gl.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gp.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gq.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gs.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gy.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/hk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/hm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/hn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/hr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ht.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/hu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/id-2.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ie.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/il.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/in.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/io.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/iq.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ir.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/is.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/it.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/jm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/jo.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/jp.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ke.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kh.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ki.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/km.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kp.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ky.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/la.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lb.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/li.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ls.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lv.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ly.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ma.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/md.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/me.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mh.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ml.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mo.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mp.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mq.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ms.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mv.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mx.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/my.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/na.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/nc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ne.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/nf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ng.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ni.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/nl.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/no.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/np.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/nr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/nu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/nz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/om.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pa.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pe.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ph.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pl.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ps.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/py.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/qa.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/re.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ro.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/rs.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ru.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/rw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sa.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sb.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/scotland.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sd.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/se.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sh.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/si.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sj.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sl.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/so.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/st.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sv.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sy.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/td.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/th.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tj.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tl.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/to.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tv.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ua.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ug.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/um.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/us.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/uy.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/uz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/va.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/vc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ve.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/vg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/vi.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/vn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/vu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/wales.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/wf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ws.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ye.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/yt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/za.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/zm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/zw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag-s5b4f509715.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag_states/foo.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag_states/foo_active.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag_states/foo_focus.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag_states/foo_hover.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag_states/foo_target.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag_states-sc42d7bf926.png +0 -0
- data/test/fixtures/stylesheets/compass/sass/animation-with-legacy-ie.scss +17 -0
- data/test/fixtures/stylesheets/compass/sass/animation.scss +13 -0
- data/test/fixtures/stylesheets/compass/sass/appearance.scss +5 -0
- data/test/fixtures/stylesheets/compass/sass/background-clip.scss +5 -0
- data/test/fixtures/stylesheets/compass/sass/background-origin.scss +5 -0
- data/test/fixtures/stylesheets/compass/sass/background-size.scss +7 -0
- data/test/fixtures/stylesheets/compass/sass/border_radius.scss +5 -0
- data/test/fixtures/stylesheets/compass/sass/box-sizing.scss +11 -0
- data/test/fixtures/stylesheets/compass/sass/box.sass +50 -0
- data/test/fixtures/stylesheets/compass/sass/box_shadow.scss +7 -0
- data/test/fixtures/stylesheets/compass/sass/brightness.scss +12 -0
- data/test/fixtures/stylesheets/compass/sass/browser-support.scss +30 -0
- data/test/fixtures/stylesheets/compass/sass/color.scss +25 -0
- data/test/fixtures/stylesheets/compass/sass/columns.scss +29 -0
- data/test/fixtures/stylesheets/compass/sass/filters.scss +25 -0
- data/test/fixtures/stylesheets/compass/sass/flexbox.scss +88 -0
- data/test/fixtures/stylesheets/compass/sass/fonts.sass +8 -0
- data/test/fixtures/stylesheets/compass/sass/force-wrap.scss +3 -0
- data/test/fixtures/stylesheets/compass/sass/gradients.sass +128 -0
- data/test/fixtures/stylesheets/compass/sass/grid_background.scss +34 -0
- data/test/fixtures/stylesheets/compass/sass/hyphenation.scss +11 -0
- data/test/fixtures/stylesheets/compass/sass/image_size.sass +15 -0
- data/test/fixtures/stylesheets/compass/sass/images.scss +9 -0
- data/test/fixtures/stylesheets/compass/sass/layout.sass +3 -0
- data/test/fixtures/stylesheets/compass/sass/legacy_clearfix.scss +14 -0
- data/test/fixtures/stylesheets/compass/sass/lists.scss +12 -0
- data/test/fixtures/stylesheets/compass/sass/opacity.scss +9 -0
- data/test/fixtures/stylesheets/compass/sass/print.sass +5 -0
- data/test/fixtures/stylesheets/compass/sass/regions.scss +4 -0
- data/test/fixtures/stylesheets/compass/sass/replacement.scss +22 -0
- data/test/fixtures/stylesheets/compass/sass/reset.sass +12 -0
- data/test/fixtures/stylesheets/compass/sass/selection.scss +41 -0
- data/test/fixtures/stylesheets/compass/sass/sprites_with_explicit_separator.scss +11 -0
- data/test/fixtures/stylesheets/compass/sass/stretching.sass +34 -0
- data/test/fixtures/stylesheets/compass/sass/support.scss +174 -0
- data/test/fixtures/stylesheets/compass/sass/text_shadow.scss +12 -0
- data/test/fixtures/stylesheets/compass/sass/transform.scss +87 -0
- data/test/fixtures/stylesheets/compass/sass/transition.scss +21 -0
- data/test/fixtures/stylesheets/compass/sass/typography/links/hover-link.scss +3 -0
- data/test/fixtures/stylesheets/compass/sass/units.scss +50 -0
- data/test/fixtures/stylesheets/compass/sass/user-interface.scss +28 -0
- data/test/fixtures/stylesheets/compass/sass/utilities.scss +33 -0
- data/test/fixtures/stylesheets/compass/sass/vertical_rhythm.scss +60 -0
- data/test/fixtures/stylesheets/compass/sass/vertical_rhythm_with_ems.scss +52 -0
- data/test/fixtures/stylesheets/compass/sass/vertical_rhythm_with_px.scss +50 -0
- data/test/fixtures/stylesheets/compass/sass/vertical_rhythm_with_rems.scss +50 -0
- data/test/fixtures/stylesheets/envtest/config.rb +9 -0
- data/test/fixtures/stylesheets/envtest/css/env.css +10 -0
- data/test/fixtures/stylesheets/envtest/sass/env.scss +19 -0
- data/test/fixtures/stylesheets/error/config.rb +10 -0
- data/test/fixtures/stylesheets/error/sass/screen.sass +2 -0
- data/test/fixtures/stylesheets/image_urls/config.rb +19 -0
- data/test/fixtures/stylesheets/image_urls/css/screen.css +5 -0
- data/test/fixtures/stylesheets/image_urls/images/grid.png +0 -0
- data/test/fixtures/stylesheets/image_urls/sass/screen.sass +8 -0
- data/test/fixtures/stylesheets/relative/assets/images/testing.png +0 -0
- data/test/fixtures/stylesheets/relative/config.rb +10 -0
- data/test/fixtures/stylesheets/relative/css/ie.css +1 -0
- data/test/fixtures/stylesheets/relative/css/print.css +1 -0
- data/test/fixtures/stylesheets/relative/css/screen.css +1 -0
- data/test/fixtures/stylesheets/relative/sass/ie.sass +5 -0
- data/test/fixtures/stylesheets/relative/sass/print.sass +3 -0
- data/test/fixtures/stylesheets/relative/sass/screen.sass +2 -0
- data/test/fixtures/stylesheets/sourcemaps/config.rb +10 -0
- data/test/fixtures/stylesheets/sourcemaps/css/another_simple.css +2 -0
- data/test/fixtures/stylesheets/sourcemaps/css/another_simple.css.map +7 -0
- data/test/fixtures/stylesheets/sourcemaps/css/simple.css +2 -0
- data/test/fixtures/stylesheets/sourcemaps/css/simple.css.map +7 -0
- data/test/fixtures/stylesheets/sourcemaps/css/with_libraries.css +2 -0
- data/test/fixtures/stylesheets/sourcemaps/css/with_libraries.css.map +7 -0
- data/test/fixtures/stylesheets/sourcemaps/sass/another_simple.scss +3 -0
- data/test/fixtures/stylesheets/sourcemaps/sass/simple.sass +2 -0
- data/test/fixtures/stylesheets/sourcemaps/sass/with_libraries.scss +5 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/config.rb +25 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/ie.scss +5 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/print.scss +3 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/screen.scss +6 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/ie.css +5 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/print.css +3 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/screen.css +68 -0
- data/test/fixtures/stylesheets/valid/config.rb +9 -0
- data/test/fixtures/stylesheets/valid/sass/another_simple.scss +3 -0
- data/test/fixtures/stylesheets/valid/sass/simple.sass +2 -0
- data/test/fixtures/stylesheets/with_sass_globbing/config.rb +26 -0
- data/test/fixtures/stylesheets/with_sass_globbing/css/screen.css +19 -0
- data/test/fixtures/stylesheets/with_sass_globbing/sass/partials/_1.scss +3 -0
- data/test/fixtures/stylesheets/with_sass_globbing/sass/partials/_2.scss +3 -0
- data/test/fixtures/stylesheets/with_sass_globbing/sass/partials/_3.scss +4 -0
- data/test/fixtures/stylesheets/with_sass_globbing/sass/screen.scss +3 -0
- data/test/helpers/command_line.rb +114 -0
- data/test/helpers/diff.rb +49 -0
- data/test/helpers/io.rb +36 -0
- data/test/helpers/rails.rb +55 -0
- data/test/helpers/test_case.rb +62 -0
- data/test/integrations/compass_test.rb +259 -0
- data/test/integrations/sprites_test.rb +1123 -0
- data/test/test_helper.rb +67 -0
- data/test/units/actions_test.rb +24 -0
- data/test/units/caniuse_test.rb +194 -0
- data/test/units/command_line_test.rb +60 -0
- data/test/units/compass_util_test.rb +11 -0
- data/test/units/compiler_test.rb +16 -0
- data/test/units/configuration_test.rb +618 -0
- data/test/units/regressions_test.rb +35 -0
- data/test/units/sass_extensions_test.rb +232 -0
- data/test/units/sass_extenstions/gradients_test.rb +30 -0
- data/test/units/sprites/engine_test.rb +48 -0
- data/test/units/sprites/image_row_test.rb +58 -0
- data/test/units/sprites/image_test.rb +116 -0
- data/test/units/sprites/images_test.rb +46 -0
- data/test/units/sprites/importer_test.rb +91 -0
- data/test/units/sprites/layout_test.rb +180 -0
- data/test/units/sprites/row_fitter_test.rb +66 -0
- data/test/units/sprites/sprite_command_test.rb +55 -0
- data/test/units/sprites/sprite_map_test.rb +169 -0
- metadata +1175 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class LayoutTest < Test::Unit::TestCase
|
|
4
|
+
include SpriteHelper
|
|
5
|
+
|
|
6
|
+
def setup
|
|
7
|
+
Hash.send(:include, Compass::SassExtensions::Functions::Sprites::VariableReader)
|
|
8
|
+
clean_up_sprites
|
|
9
|
+
create_sprite_temp
|
|
10
|
+
file = StringIO.new("images_path = #{@images_tmp_path.inspect}\n")
|
|
11
|
+
Compass.add_configuration(file, "sprite_config")
|
|
12
|
+
Compass.configure_sass_plugin!
|
|
13
|
+
@options = {'cleanup' => Sass::Script::Bool.new(true), 'layout' => Sass::Script::String.new('vertical')}
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def teardown
|
|
17
|
+
clean_up_sprites
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# HELPERS
|
|
21
|
+
|
|
22
|
+
def vertical
|
|
23
|
+
opts = @options.merge("layout" => Sass::Script::String.new('vertical'))
|
|
24
|
+
|
|
25
|
+
sprite_map_test(opts)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def smart
|
|
29
|
+
options = @options.merge("layout" => Sass::Script::String.new('smart'))
|
|
30
|
+
importer = Compass::SpriteImporter.new
|
|
31
|
+
uri = "image_row/*.png"
|
|
32
|
+
path, name = Compass::SpriteImporter.path_and_name(uri)
|
|
33
|
+
sprite_names = Compass::SpriteImporter.sprite_names(uri)
|
|
34
|
+
sass_engine = Compass::SpriteImporter.sass_engine(uri, name, importer, options)
|
|
35
|
+
map = Compass::SassExtensions::Sprites::SpriteMap.new(sprite_names.map {|n| "image_row/#{n}.png"}, path, name, sass_engine, options)
|
|
36
|
+
map.options = {:compass => {:logger => Compass::NullLogger.new}}
|
|
37
|
+
|
|
38
|
+
map
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def diagonal
|
|
42
|
+
opts = @options.merge("layout" => Sass::Script::String.new('diagonal'))
|
|
43
|
+
|
|
44
|
+
sprite_map_test(opts)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def horizontal(options= {}, uri=URI)
|
|
48
|
+
opts = @options.merge("layout" => Sass::Script::String.new('horizontal'))
|
|
49
|
+
opts.merge!(options)
|
|
50
|
+
|
|
51
|
+
sprite_map_test(opts, uri)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# REPEAT_X
|
|
55
|
+
|
|
56
|
+
test 'repeat-x layout single image' do
|
|
57
|
+
opts = {"repeat_x_three_repeat" => Sass::Script::String.new('repeat-x'), 'sort_by' => Sass::Script::String.new('width')}
|
|
58
|
+
map = sprite_map_test(@options.merge(opts), 'repeat_x/*.png')
|
|
59
|
+
assert_equal 6, map.width
|
|
60
|
+
assert_equal [0, 1, 3, 6, 10, 3, 3], map.images.map(&:top)
|
|
61
|
+
assert_equal [0, 0, 0, 0, 0, 0, 3], map.images.map(&:left)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
test 'repeat-x layout multi image' do
|
|
65
|
+
opts = {"repeat_x_three_repeat" => Sass::Script::String.new('repeat-x'), "repeat_x_four_repeat" => Sass::Script::String.new('repeat-x')}
|
|
66
|
+
map = sprite_map_test(@options.merge(opts), 'repeat_x/*.png')
|
|
67
|
+
assert_equal 12, map.width
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
test "repeat-y layout single image" do
|
|
71
|
+
opts = {"layout" => Sass::Script::String.new('horizontal'), "squares_ten_by_ten_repeat" => Sass::Script::String.new('repeat-y')}
|
|
72
|
+
map = sprite_map_test(@options.merge(opts), 'squares/*.png')
|
|
73
|
+
assert_equal 30, map.width
|
|
74
|
+
assert_equal 20, map.height
|
|
75
|
+
assert_equal 3, map.images.size
|
|
76
|
+
assert_equal [[0,0], [0,10], [10,0]], map.images.map { |img| [img.top, img.left] }
|
|
77
|
+
assert map.horizontal?
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
test "repeat-y layout multi image" do
|
|
81
|
+
opts = {"layout" => Sass::Script::String.new('horizontal'), "repeat_x_three_repeat" => Sass::Script::String.new('repeat-y'), "repeat_x_four_repeat" => Sass::Script::String.new('repeat-y')}
|
|
82
|
+
map = sprite_map_test(@options.merge(opts), 'repeat_x/*.png')
|
|
83
|
+
assert_equal [[0, 0], [0, 5], [0, 9], [0, 10], [0, 13], [4, 5], [8, 5], [3, 10], [6, 10], [9, 10]], map.images.map { |img| [img.top, img.left] }
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# VERTICAL LAYOUT
|
|
87
|
+
|
|
88
|
+
it "should have a vertical layout" do
|
|
89
|
+
vert = vertical
|
|
90
|
+
assert_equal [0, 10, 20, 30], vert.images.map(&:top)
|
|
91
|
+
assert_equal [0, 0, 0, 0], vert.images.map(&:left)
|
|
92
|
+
assert vert.vertical?
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
it "should have a vertical layout with spacing" do
|
|
96
|
+
vert = sprite_map_test(@options.merge({"spacing" => Sass::Script::Number.new(10, ['px'])}))
|
|
97
|
+
assert_equal [0, 20, 40, 60], vert.images.map(&:top)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
it "should layout vertical with position" do
|
|
101
|
+
vert = sprite_map_test("selectors_ten_by_ten_active_position" => Sass::Script::Number.new(10, ['px']))
|
|
102
|
+
assert_equal [0, 10, 0, 0], vert.images.map(&:left)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
it "should generate vertical sprites in decending order" do
|
|
106
|
+
sizes = vertical.images.map{|image| File.size(image.file) }
|
|
107
|
+
assert_equal sizes.min, File.size(vertical.images.first.file)
|
|
108
|
+
assert_equal sizes.max, File.size(vertical.images.last.file)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# SMART LAYOUT
|
|
112
|
+
|
|
113
|
+
it "should have a smart layout" do
|
|
114
|
+
base = smart
|
|
115
|
+
base.generate
|
|
116
|
+
assert base.smart?
|
|
117
|
+
assert_equal 400, base.width
|
|
118
|
+
assert_equal 60, base.height
|
|
119
|
+
assert_equal [[0, 0], [20, 120], [20, 0], [20, 100], [20, 160]], base.images.map {|i| [i.top, i.left]}
|
|
120
|
+
assert File.exist?(base.filename)
|
|
121
|
+
FileUtils.rm base.filename
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# DIAGONAL LAYOUT
|
|
125
|
+
|
|
126
|
+
it "should generate a diagonal sprite" do
|
|
127
|
+
base = diagonal
|
|
128
|
+
base.generate
|
|
129
|
+
assert base.diagonal?
|
|
130
|
+
assert_equal 40, base.width
|
|
131
|
+
assert_equal 40, base.height
|
|
132
|
+
assert_equal [[30, 0], [20, 10], [10, 20], [0, 30]], base.images.map {|i| [i.top, i.left]}
|
|
133
|
+
assert File.exist?(base.filename)
|
|
134
|
+
FileUtils.rm base.filename
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# HORIZONTAL LAYOUT
|
|
138
|
+
|
|
139
|
+
it "should have a horizontal layout" do
|
|
140
|
+
base = horizontal
|
|
141
|
+
assert base.horizontal?
|
|
142
|
+
assert_equal 10, base.height
|
|
143
|
+
assert_equal 40, base.width
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
it "should layout images horizontaly" do
|
|
147
|
+
base = horizontal
|
|
148
|
+
assert_equal [0, 10, 20, 30], base.images.map(&:left)
|
|
149
|
+
assert_equal [0, 0, 0, 0], base.images.map(&:top)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
it "should layout horizontaly with spacing" do
|
|
153
|
+
base = horizontal("spacing" => Sass::Script::Number.new(10, ['px']))
|
|
154
|
+
assert_equal [0, 20, 40, 60], base.images.map(&:left)
|
|
155
|
+
assert_equal [0, 0, 0, 0], base.images.map(&:top)
|
|
156
|
+
assert_equal 80, base.width
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
it "should layout horizontaly with spacing and and position" do
|
|
160
|
+
base = horizontal({"spacing" => Sass::Script::Number.new(10, ['px']), "position" => Sass::Script::Number.new(50, ['%'])}, 'squares/*.png')
|
|
161
|
+
assert_equal [0, 20], base.images.map(&:left)
|
|
162
|
+
assert_equal [5, 0], base.images.map(&:top)
|
|
163
|
+
assert_equal 50, base.width
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
it "should layout horizontaly with position" do
|
|
167
|
+
base = horizontal("selectors_ten_by_ten_active_position" => Sass::Script::Number.new(10, ['px']))
|
|
168
|
+
assert_equal [0, 10, 0, 0], base.images.map(&:top)
|
|
169
|
+
assert_equal 40, base.width
|
|
170
|
+
assert_equal 20, base.height
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
it "should generate a horrizontal sprite" do
|
|
174
|
+
base = horizontal
|
|
175
|
+
base.generate
|
|
176
|
+
assert File.exist?(base.filename)
|
|
177
|
+
FileUtils.rm base.filename
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
require 'compass/sass_extensions/sprites/row_fitter'
|
|
3
|
+
|
|
4
|
+
class RowFitterTest < Test::Unit::TestCase
|
|
5
|
+
include SpriteHelper
|
|
6
|
+
def setup
|
|
7
|
+
file = StringIO.new("images_path = #{@images_src_path.inspect}\n")
|
|
8
|
+
Compass.add_configuration(file, "sprite_config")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def row_fitter(images = nil)
|
|
12
|
+
@row_fitter ||= Compass::SassExtensions::Sprites::RowFitter.new(images)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def teardown
|
|
16
|
+
@row_fitter = nil
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def create_images(dims)
|
|
20
|
+
dims.collect { |width, height|
|
|
21
|
+
image = Compass::SassExtensions::Sprites::Image.new('blah', 'blah', {})
|
|
22
|
+
image.stubs(:width => width, :height => height)
|
|
23
|
+
image
|
|
24
|
+
}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def basic_dims
|
|
28
|
+
[
|
|
29
|
+
[ 100, 10 ],
|
|
30
|
+
[ 80, 10 ],
|
|
31
|
+
[ 50, 10 ],
|
|
32
|
+
[ 35, 10 ],
|
|
33
|
+
[ 20, 10 ]
|
|
34
|
+
]
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'should use the fast placement algorithm' do
|
|
38
|
+
images = create_images(basic_dims)
|
|
39
|
+
|
|
40
|
+
row_fitter(images)
|
|
41
|
+
assert_equal 100, row_fitter.width
|
|
42
|
+
|
|
43
|
+
row_fitter.fit!(:fast)
|
|
44
|
+
|
|
45
|
+
assert_equal 4, row_fitter.rows.length
|
|
46
|
+
|
|
47
|
+
assert_equal [ images[0] ], row_fitter[0].images
|
|
48
|
+
assert_equal [ images[1] ], row_fitter[1].images
|
|
49
|
+
assert_equal [ images[2], images[3] ], row_fitter[2].images
|
|
50
|
+
assert_equal [ images[4] ], row_fitter[3].images
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
it 'should use the scan placement algorithm' do
|
|
54
|
+
images = create_images(basic_dims)
|
|
55
|
+
|
|
56
|
+
row_fitter(images)
|
|
57
|
+
|
|
58
|
+
row_fitter.fit!(:scan)
|
|
59
|
+
|
|
60
|
+
assert_equal 3, row_fitter.rows.length
|
|
61
|
+
|
|
62
|
+
assert_equal [ images[0] ], row_fitter[0].images
|
|
63
|
+
assert_equal [ images[1], images[4] ], row_fitter[1].images
|
|
64
|
+
assert_equal [ images[2], images[3] ], row_fitter[2].images
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
require 'compass/exec'
|
|
3
|
+
class SpriteCommandTest < Test::Unit::TestCase
|
|
4
|
+
include Compass::TestCaseHelper
|
|
5
|
+
include Compass::CommandLineHelper
|
|
6
|
+
include Compass::IoHelper
|
|
7
|
+
|
|
8
|
+
attr_reader :test_dir
|
|
9
|
+
include SpriteHelper
|
|
10
|
+
def setup
|
|
11
|
+
@before_dir = ::Dir.pwd
|
|
12
|
+
create_temp_cli_dir
|
|
13
|
+
create_sprite_temp
|
|
14
|
+
@config_file = File.join(@test_dir, 'config.rb')
|
|
15
|
+
File.open(@config_file, 'w') do |f|
|
|
16
|
+
f << config_data
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def config_data
|
|
21
|
+
return <<-CONFIG
|
|
22
|
+
images_path = "#{@images_tmp_path}"
|
|
23
|
+
CONFIG
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def create_temp_cli_dir
|
|
27
|
+
directory = File.join(File.expand_path('../', __FILE__), 'test')
|
|
28
|
+
::FileUtils.mkdir_p directory
|
|
29
|
+
@test_dir = directory
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def run_compass_with_options(options)
|
|
33
|
+
output = 'foo'
|
|
34
|
+
::Dir.chdir @test_dir
|
|
35
|
+
compass *options
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def options_to_cli(options)
|
|
39
|
+
options.map.flatten!
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def teardown
|
|
43
|
+
::Dir.chdir @before_dir
|
|
44
|
+
clean_up_sprites
|
|
45
|
+
if File.exist?(@test_dir)
|
|
46
|
+
::FileUtils.rm_r @test_dir
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it "should create sprite file" do
|
|
51
|
+
assert_equal 0, run_compass_with_options(['sprite', "-f", 'stylesheet.scss', "squares/*.png"]).to_i
|
|
52
|
+
assert File.exist?(File.join(test_dir, 'stylesheet.scss'))
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class SpriteMapTest < Test::Unit::TestCase
|
|
4
|
+
include SpriteHelper
|
|
5
|
+
|
|
6
|
+
def setup
|
|
7
|
+
Hash.send(:include, Compass::SassExtensions::Functions::Sprites::VariableReader)
|
|
8
|
+
create_sprite_temp
|
|
9
|
+
file = StringIO.new(<<-CONFIG)
|
|
10
|
+
project_path = "#{@images_proj_path}"
|
|
11
|
+
images_dir = "#{@images_tmp_dir}"
|
|
12
|
+
CONFIG
|
|
13
|
+
Compass.add_configuration(file, "sprite_config")
|
|
14
|
+
Compass.configure_sass_plugin!
|
|
15
|
+
@options = {'cleanup' => Sass::Script::Bool.new(true), 'layout' => Sass::Script::String.new('vertical')}
|
|
16
|
+
@base = sprite_map_test(@options)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def teardown
|
|
20
|
+
clean_up_sprites
|
|
21
|
+
@base = nil
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should have the correct size" do
|
|
25
|
+
assert_equal [10,40], @base.size
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "should have the sprite names" do
|
|
29
|
+
assert_equal Compass::SpriteImporter.sprite_names(URI), @base.sprite_names
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it 'should have image filenames' do
|
|
33
|
+
assert_equal Dir["#{@images_tmp_path}/selectors/*.png"].sort, @base.image_filenames
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'should need generation' do
|
|
37
|
+
assert @base.generation_required?
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
test 'uniqueness_hash' do
|
|
41
|
+
assert_equal '4c703bbc05', @base.uniqueness_hash
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'should be outdated' do
|
|
45
|
+
assert @base.outdated?
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it 'should have correct filename' do
|
|
49
|
+
assert_equal File.join(@images_tmp_path, "#{@base.path}-s#{@base.uniqueness_hash}.png"), @base.filename
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "should return the 'ten-by-ten' image" do
|
|
53
|
+
assert_equal 'ten-by-ten', @base.image_for('ten-by-ten').name
|
|
54
|
+
assert @base.image_for('ten-by-ten').is_a?(Compass::SassExtensions::Sprites::Image)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
%w(target hover active).each do |selector|
|
|
58
|
+
it "should have a #{selector}" do
|
|
59
|
+
assert @base.send(:"has_#{selector}?", 'ten-by-ten')
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it "should return #{selector} image class" do
|
|
63
|
+
assert_equal "ten-by-ten_#{selector}", @base.image_for('ten-by-ten').send(:"#{selector}").name
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "should find file with '-' #{selector}" do
|
|
67
|
+
map = sprite_map_test(:seperator => '-')
|
|
68
|
+
map.images.each_index do |i|
|
|
69
|
+
if map.images[i].name != 'ten-by-ten'
|
|
70
|
+
name = map.images[i].name.gsub(/_/, '-')
|
|
71
|
+
map.images[i].stubs(:name).returns(name)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
assert_equal "ten-by-ten-#{selector}", map.image_for('ten-by-ten').send(:"#{selector}").name
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
it "should generate sprite" do
|
|
80
|
+
@base.generate
|
|
81
|
+
assert File.exist?(@base.filename)
|
|
82
|
+
assert !@base.generation_required?
|
|
83
|
+
assert !@base.outdated?
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
it "should remove old sprite when generating new" do
|
|
87
|
+
@base.generate
|
|
88
|
+
file = @base.filename
|
|
89
|
+
assert File.exist?(file), "Original file does not exist"
|
|
90
|
+
file_to_remove = File.join(@images_tmp_path, 'selectors', 'ten-by-ten.png')
|
|
91
|
+
FileUtils.rm file_to_remove
|
|
92
|
+
assert !File.exist?(file_to_remove), "Failed to remove sprite file"
|
|
93
|
+
@base = sprite_map_test(@options)
|
|
94
|
+
@base.generate
|
|
95
|
+
assert !File.exist?(file), "Sprite file did not get removed"
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
test "should get correct relative_name" do
|
|
99
|
+
Compass.reset_configuration!
|
|
100
|
+
uri = 'foo/*.png'
|
|
101
|
+
other_folder = File.join(@images_tmp_path, '../other-temp')
|
|
102
|
+
FileUtils.mkdir_p other_folder
|
|
103
|
+
FileUtils.mkdir_p File.join(other_folder, 'foo')
|
|
104
|
+
%w(my bar).each do |file|
|
|
105
|
+
FileUtils.touch(File.join(other_folder, "foo/#{file}.png"))
|
|
106
|
+
end
|
|
107
|
+
config = Compass::Configuration::Data.new('config')
|
|
108
|
+
config.images_path = @images_tmp_path
|
|
109
|
+
config.sprite_load_path = [@images_tmp_path, other_folder]
|
|
110
|
+
Compass.add_configuration(config, "sprite_config")
|
|
111
|
+
assert_equal 'foo/my.png', Compass::SassExtensions::Sprites::SpriteMap.relative_name(File.join(other_folder, 'foo/my.png'))
|
|
112
|
+
FileUtils.rm_rf other_folder
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
test "should get correct relative_name for directories with similar names" do
|
|
116
|
+
Compass.reset_configuration!
|
|
117
|
+
uri = 'foo/*.png'
|
|
118
|
+
other_folder = File.join(@images_tmp_path, '../other-temp')
|
|
119
|
+
other_folder2 = File.join(@images_tmp_path, '../other-temp2')
|
|
120
|
+
|
|
121
|
+
FileUtils.mkdir_p other_folder
|
|
122
|
+
FileUtils.mkdir_p other_folder2
|
|
123
|
+
|
|
124
|
+
FileUtils.mkdir_p File.join(other_folder2, 'foo')
|
|
125
|
+
%w(my bar).each do |file|
|
|
126
|
+
FileUtils.touch(File.join(other_folder2, "foo/#{file}.png"))
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
config = Compass::Configuration::Data.new('config')
|
|
130
|
+
config.images_path = @images_tmp_path
|
|
131
|
+
config.sprite_load_path = [@images_tmp_path, other_folder, other_folder2]
|
|
132
|
+
Compass.add_configuration(config, "sprite_config")
|
|
133
|
+
|
|
134
|
+
assert_equal 'foo/my.png', Compass::SassExtensions::Sprites::SpriteMap.relative_name(File.join(other_folder2, 'foo/my.png'))
|
|
135
|
+
FileUtils.rm_rf other_folder
|
|
136
|
+
FileUtils.rm_rf other_folder2
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
test "should create map for nested" do
|
|
140
|
+
base = Compass::SassExtensions::Sprites::SpriteMap.from_uri OpenStruct.new(:value => 'nested/squares/*.png'), @base.instance_variable_get(:@evaluation_context), @options
|
|
141
|
+
assert_equal 'squares', base.name
|
|
142
|
+
assert_equal 'nested/squares', base.path
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
test "should have correct position on ten-by-ten" do
|
|
146
|
+
percent = Sass::Script::Number.new(50, ['%'])
|
|
147
|
+
base = sprite_map_test(@options.merge('selectors_ten_by_ten_position' => percent))
|
|
148
|
+
assert_equal percent, base.image_for('ten-by-ten').position
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
test 'gets name for sprite in search path' do
|
|
152
|
+
Compass.reset_configuration!
|
|
153
|
+
uri = 'foo/*.png'
|
|
154
|
+
other_folder = File.join(@images_tmp_path, '../other-temp')
|
|
155
|
+
FileUtils.mkdir_p other_folder
|
|
156
|
+
FileUtils.mkdir_p File.join(other_folder, 'foo')
|
|
157
|
+
%w(my bar).each do |file|
|
|
158
|
+
FileUtils.touch(File.join(other_folder, "foo/#{file}.png"))
|
|
159
|
+
end
|
|
160
|
+
config = Compass::Configuration::Data.new('config')
|
|
161
|
+
config.images_path = @images_tmp_path
|
|
162
|
+
config.sprite_load_path = [@images_tmp_path, other_folder]
|
|
163
|
+
Compass.add_configuration(config, "sprite_config")
|
|
164
|
+
image = Compass::SassExtensions::Sprites::Image.new(@base, "foo/my.png", {})
|
|
165
|
+
assert_equal File.join(other_folder, 'foo/my.png'), image.file
|
|
166
|
+
assert_equal 0, image.size
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
end
|