mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Move binaries and text files from samples folder to fixtures
This commit is contained in:
@@ -34,10 +34,6 @@ module Linguist
|
||||
Dir.entries(ROOT).sort!.each do |category|
|
||||
next if category == '.' || category == '..'
|
||||
|
||||
# Skip text and binary for now
|
||||
# Possibly reconsider this later
|
||||
next if category == 'Text' || category == 'Binary'
|
||||
|
||||
dirname = File.join(ROOT, category)
|
||||
Dir.entries(dirname).each do |filename|
|
||||
next if filename == '.' || filename == '..'
|
||||
|
||||
@@ -1,703 +0,0 @@
|
||||
#==============================================================================
|
||||
#
|
||||
# <20><> Yanfly Engine Ace - Visual Battlers v1.01
|
||||
# -- Last Updated: 2012.07.24
|
||||
# -- Level: Easy
|
||||
# -- Requires: n/a
|
||||
#
|
||||
# <20><> Modified by:
|
||||
# -- Yami
|
||||
# -- Kread-Ex
|
||||
# -- Archeia_Nessiah
|
||||
#==============================================================================
|
||||
|
||||
$imported = {} if $imported.nil?
|
||||
$imported["YEA-VisualBattlers"] = true
|
||||
|
||||
#==============================================================================
|
||||
# <20><> Updates
|
||||
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
# 2012.12.18 - Added preset views and able to change direction in-game.
|
||||
# 2012.07.24 - Finished Script.
|
||||
# 2012.01.05 - Started Script.
|
||||
#
|
||||
#==============================================================================
|
||||
# <20><> Introduction
|
||||
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
# This script provides a visual for all actors by default charsets. The actions
|
||||
# and movements are alike Final Fantasy 1, only move forward and backward when
|
||||
# start and finish actions.
|
||||
#
|
||||
#==============================================================================
|
||||
# <20><> Instructions
|
||||
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
# To change the player direction in-game, use the snippet below in a script
|
||||
# call:
|
||||
#
|
||||
# $game_system.party_direction = n
|
||||
#
|
||||
# To install this script, open up your script editor and copy/paste this script
|
||||
# to an open slot below <20><> Materials but above <20><> Main. Remember to save.
|
||||
#
|
||||
#==============================================================================
|
||||
# <20><> Compatibility
|
||||
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
|
||||
# it will run with RPG Maker VX without adjusting.
|
||||
#
|
||||
#==============================================================================
|
||||
|
||||
module YEA
|
||||
module VISUAL_BATTLERS
|
||||
|
||||
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
# - Party Location Setting -
|
||||
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
# These settings are adjusted for Party Location. Each Actor will have
|
||||
# coordinates calculated by below formula. There are two samples coordinates
|
||||
# below, change PARTY_DIRECTION to the base index you want to use.
|
||||
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
PARTY_DIRECTION = 6 # This direction is opposite from actual direction.
|
||||
|
||||
PARTY_LOCATION_BASE_COORDINATES ={
|
||||
# Index => [base_x, base_y, mod_x, mod_y],
|
||||
2 => [ 250, 290, 40, 0], #UP
|
||||
4 => [ 150, 280, 20, -20], #LEFT
|
||||
3 => [ 460, 280, 30, -10], #RIGHT
|
||||
6 => [ 460, 230, 20, 20], #DEFAULT RIGHT
|
||||
8 => [ 260, 230, 40, 0], #DOWN
|
||||
} # Do not remove this.
|
||||
|
||||
PARTY_LOCATION_FORMULA_X = "base_x + index * mod_x"
|
||||
PARTY_LOCATION_FORMULA_Y = "base_y + index * mod_y"
|
||||
|
||||
end # VISUAL_BATTLERS
|
||||
end # YEA
|
||||
|
||||
#==============================================================================
|
||||
# <20><> Editting anything past this point may potentially result in causing
|
||||
# computer damage, incontinence, explosion of user's head, coma, death, and/or
|
||||
# halitosis so edit at your own risk.
|
||||
#==============================================================================
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Direction
|
||||
#==============================================================================
|
||||
|
||||
module Direction
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# self.correct
|
||||
#--------------------------------------------------------------------------
|
||||
def self.correct(direction)
|
||||
case direction
|
||||
when 1; return 4
|
||||
when 3; return 6
|
||||
when 7; return 4
|
||||
when 9; return 6
|
||||
else; return direction
|
||||
end
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# self.opposite
|
||||
#--------------------------------------------------------------------------
|
||||
def self.opposite(direction)
|
||||
case direction
|
||||
when 1; return 6
|
||||
when 2; return 8
|
||||
when 3; return 4
|
||||
when 4; return 6
|
||||
when 6; return 4
|
||||
when 7; return 6
|
||||
when 8; return 2
|
||||
when 9; return 4
|
||||
else; return direction
|
||||
end
|
||||
end
|
||||
|
||||
end # Direction
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Game_System
|
||||
#==============================================================================
|
||||
|
||||
class Game_System; attr_accessor :party_direction; end
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Game_BattleCharacter
|
||||
#==============================================================================
|
||||
|
||||
class Game_BattleCharacter < Game_Character
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# initialize
|
||||
#--------------------------------------------------------------------------
|
||||
def initialize(actor)
|
||||
super()
|
||||
setup_actor(actor)
|
||||
@move_x_rate = 0
|
||||
@move_y_rate = 0
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# setup_actor
|
||||
#--------------------------------------------------------------------------
|
||||
def setup_actor(actor)
|
||||
@actor = actor
|
||||
@step_anime = true
|
||||
set_graphic(@actor.character_name, @actor.character_index)
|
||||
setup_coordinates
|
||||
dr = $game_system.party_direction || YEA::VISUAL_BATTLERS::PARTY_DIRECTION
|
||||
direction = Direction.opposite(dr)
|
||||
set_direction(Direction.correct(direction))
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# sprite=
|
||||
#--------------------------------------------------------------------------
|
||||
def sprite=(sprite)
|
||||
@sprite = sprite
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# setup_coordinates
|
||||
#--------------------------------------------------------------------------
|
||||
def setup_coordinates
|
||||
location = ($game_system.party_direction ||
|
||||
YEA::VISUAL_BATTLERS::PARTY_DIRECTION)
|
||||
base_x = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][0]
|
||||
base_y = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][1]
|
||||
mod_x = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][2]
|
||||
mod_y = YEA::VISUAL_BATTLERS::PARTY_LOCATION_BASE_COORDINATES[location][3]
|
||||
@actor.screen_x = eval(YEA::VISUAL_BATTLERS::PARTY_LOCATION_FORMULA_X)
|
||||
@actor.screen_y = eval(YEA::VISUAL_BATTLERS::PARTY_LOCATION_FORMULA_Y)
|
||||
@actor.origin_x = @actor.screen_x
|
||||
@actor.origin_y = @actor.screen_y
|
||||
@actor.create_move_to(screen_x, screen_y, 1)
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# index
|
||||
#--------------------------------------------------------------------------
|
||||
def index
|
||||
return @actor.index
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# screen_x
|
||||
#--------------------------------------------------------------------------
|
||||
def screen_x
|
||||
return @actor.screen_x
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# screen_y
|
||||
#--------------------------------------------------------------------------
|
||||
def screen_y
|
||||
return @actor.screen_y
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# screen_z
|
||||
#--------------------------------------------------------------------------
|
||||
def screen_z
|
||||
return @actor.screen_z
|
||||
end
|
||||
|
||||
end # Game_BattleCharacter
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Game_Battler
|
||||
#==============================================================================
|
||||
|
||||
class Game_Battler < Game_BattlerBase
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# public instance variables
|
||||
#--------------------------------------------------------------------------
|
||||
attr_accessor :moved_back
|
||||
attr_accessor :origin_x
|
||||
attr_accessor :origin_y
|
||||
attr_accessor :screen_x
|
||||
attr_accessor :screen_y
|
||||
attr_accessor :started_turn
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# alias method: execute_damage
|
||||
#--------------------------------------------------------------------------
|
||||
alias game_battler_execute_damage_vb execute_damage
|
||||
def execute_damage(user)
|
||||
game_battler_execute_damage_vb(user)
|
||||
if @result.hp_damage > 0
|
||||
move_backward(24, 6) unless @moved_back
|
||||
@moved_back = true
|
||||
end
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# face_opposing_party
|
||||
#--------------------------------------------------------------------------
|
||||
def face_opposing_party
|
||||
direction = ($game_system.party_direction ||
|
||||
YEA::VISUAL_BATTLERS::PARTY_DIRECTION)
|
||||
character.set_direction(Direction.correct(direction)) rescue 0
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: face_coordinate
|
||||
#--------------------------------------------------------------------------
|
||||
def face_coordinate(destination_x, destination_y)
|
||||
x1 = Integer(@screen_x)
|
||||
x2 = Integer(destination_x)
|
||||
y1 = Graphics.height - Integer(@screen_y)
|
||||
y2 = Graphics.height - Integer(destination_y)
|
||||
return if x1 == x2 and y1 == y2
|
||||
#---
|
||||
angle = Integer(Math.atan2((y2-y1),(x2-x1)) * 1800 / Math::PI)
|
||||
if (0..225) === angle or (-225..0) === angle
|
||||
direction = 6
|
||||
elsif (226..675) === angle
|
||||
direction = 9
|
||||
elsif (676..1125) === angle
|
||||
direction = 8
|
||||
elsif (1126..1575) === angle
|
||||
direction = 7
|
||||
elsif (1576..1800) === angle or (-1800..-1576) === angle
|
||||
direction = 4
|
||||
elsif (-1575..-1126) === angle
|
||||
direction = 1
|
||||
elsif (-1125..-676) === angle
|
||||
direction = 2
|
||||
elsif (-675..-226) === angle
|
||||
direction = 3
|
||||
end
|
||||
#---
|
||||
character.set_direction(Direction.correct(direction)) rescue 0
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# create_move_to
|
||||
#--------------------------------------------------------------------------
|
||||
def create_move_to(destination_x, destination_y, frames = 12)
|
||||
@destination_x = destination_x
|
||||
@destination_y = destination_y
|
||||
frames = [frames, 1].max
|
||||
@move_x_rate = [(@screen_x - @destination_x).abs / frames, 2].max
|
||||
@move_y_rate = [(@screen_y - @destination_y).abs / frames, 2].max
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# update_move_to
|
||||
#--------------------------------------------------------------------------
|
||||
def update_move_to
|
||||
@move_x_rate = 0 if @screen_x == @destination_x || @move_x_rate.nil?
|
||||
@move_y_rate = 0 if @screen_y == @destination_y || @move_y_rate.nil?
|
||||
value = [(@screen_x - @destination_x).abs, @move_x_rate].min
|
||||
@screen_x += (@destination_x > @screen_x) ? value : -value
|
||||
value = [(@screen_y - @destination_y).abs, @move_y_rate].min
|
||||
@screen_y += (@destination_y > @screen_y) ? value : -value
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# move_forward
|
||||
#--------------------------------------------------------------------------
|
||||
def move_forward(distance = 24, frames = 12)
|
||||
direction = forward_direction
|
||||
move_direction(direction, distance, frames)
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# move_backward
|
||||
#--------------------------------------------------------------------------
|
||||
def move_backward(distance = 24, frames = 12)
|
||||
direction = Direction.opposite(forward_direction)
|
||||
move_direction(direction, distance, frames)
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# move_direction
|
||||
#--------------------------------------------------------------------------
|
||||
def move_direction(direction, distance = 24, frames = 12)
|
||||
case direction
|
||||
when 1; move_x = distance / -2; move_y = distance / 2
|
||||
when 2; move_x = distance * 0; move_y = distance * 1
|
||||
when 3; move_x = distance / -2; move_y = distance / 2
|
||||
when 4; move_x = distance * -1; move_y = distance * 0
|
||||
when 6; move_x = distance * 1; move_y = distance * 0
|
||||
when 7; move_x = distance / -2; move_y = distance / -2
|
||||
when 8; move_x = distance * 0; move_y = distance * -1
|
||||
when 9; move_x = distance / 2; move_y = distance / -2
|
||||
else; return
|
||||
end
|
||||
destination_x = @screen_x + move_x
|
||||
destination_y = @screen_y + move_y
|
||||
create_move_to(destination_x, destination_y, frames)
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# forward_direction
|
||||
#--------------------------------------------------------------------------
|
||||
def forward_direction
|
||||
return ($game_system.party_direction ||
|
||||
YEA::VISUAL_BATTLERS::PARTY_DIRECTION)
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# move_origin
|
||||
#--------------------------------------------------------------------------
|
||||
def move_origin
|
||||
create_move_to(@origin_x, @origin_y)
|
||||
face_coordinate(@origin_x, @origin_y)
|
||||
@moved_back = false
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# moving?
|
||||
#--------------------------------------------------------------------------
|
||||
def moving?
|
||||
return false if dead? || !exist?
|
||||
return @move_x_rate != 0 || @move_y_rate != 0
|
||||
end
|
||||
|
||||
end # Game_Battler
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Game_Actor
|
||||
#==============================================================================
|
||||
|
||||
class Game_Actor < Game_Battler
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# overwrite method: use_sprite?
|
||||
#--------------------------------------------------------------------------
|
||||
def use_sprite?
|
||||
return true
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: screen_x
|
||||
#--------------------------------------------------------------------------
|
||||
def screen_x
|
||||
return @screen_x rescue 0
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: screen_y
|
||||
#--------------------------------------------------------------------------
|
||||
def screen_y
|
||||
return @screen_y rescue 0
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: screen_z
|
||||
#--------------------------------------------------------------------------
|
||||
def screen_z
|
||||
return 100
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: sprite
|
||||
#--------------------------------------------------------------------------
|
||||
def sprite
|
||||
index = $game_party.battle_members.index(self)
|
||||
return SceneManager.scene.spriteset.actor_sprites[index]
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: character
|
||||
#--------------------------------------------------------------------------
|
||||
def character
|
||||
return sprite.character_base
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# face_opposing_party
|
||||
#--------------------------------------------------------------------------
|
||||
def face_opposing_party
|
||||
dr = $game_system.party_direction || YEA::VISUAL_BATTLERS::PARTY_DIRECTION
|
||||
direction = Direction.opposite(dr)
|
||||
character.set_direction(Direction.correct(direction)) rescue 0
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# forward_direction
|
||||
#--------------------------------------------------------------------------
|
||||
def forward_direction
|
||||
return Direction.opposite(($game_system.party_direction ||
|
||||
YEA::VISUAL_BATTLERS::PARTY_DIRECTION))
|
||||
end
|
||||
|
||||
end # Game_Actor
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Game_Enemy
|
||||
#==============================================================================
|
||||
|
||||
class Game_Enemy < Game_Battler
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: sprite
|
||||
#--------------------------------------------------------------------------
|
||||
def sprite
|
||||
return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index]
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: character
|
||||
#--------------------------------------------------------------------------
|
||||
def character
|
||||
return sprite
|
||||
end
|
||||
|
||||
end # Game_Enemy
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Game_Troop
|
||||
#==============================================================================
|
||||
|
||||
class Game_Troop < Game_Unit
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# alias method: setup
|
||||
#--------------------------------------------------------------------------
|
||||
alias game_troop_setup_vb setup
|
||||
def setup(troop_id)
|
||||
game_troop_setup_vb(troop_id)
|
||||
set_coordinates
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: set_coordinates
|
||||
#--------------------------------------------------------------------------
|
||||
def set_coordinates
|
||||
for member in members
|
||||
member.origin_x = member.screen_x
|
||||
member.origin_y = member.screen_y
|
||||
member.create_move_to(member.screen_x, member.screen_y, 1)
|
||||
end
|
||||
end
|
||||
|
||||
end # Game_Troop
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Sprite_Battler
|
||||
#==============================================================================
|
||||
|
||||
class Sprite_Battler < Sprite_Base
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# public instance_variable
|
||||
#--------------------------------------------------------------------------
|
||||
attr_accessor :character_base
|
||||
attr_accessor :character_sprite
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# alias method: dispose
|
||||
#--------------------------------------------------------------------------
|
||||
alias sprite_battler_dispose_vb dispose
|
||||
def dispose
|
||||
dispose_character_sprite
|
||||
sprite_battler_dispose_vb
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: dispose_character_sprite
|
||||
#--------------------------------------------------------------------------
|
||||
def dispose_character_sprite
|
||||
@character_sprite.dispose unless @character_sprite.nil?
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# alias method: update
|
||||
#--------------------------------------------------------------------------
|
||||
alias sprite_battler_update_vb update
|
||||
def update
|
||||
sprite_battler_update_vb
|
||||
return if @battler.nil?
|
||||
update_move_to
|
||||
update_character_base
|
||||
update_character_sprite
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: update_character_base
|
||||
#--------------------------------------------------------------------------
|
||||
def update_character_base
|
||||
return if @character_base.nil?
|
||||
@character_base.update
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: update_character_sprite
|
||||
#--------------------------------------------------------------------------
|
||||
def update_character_sprite
|
||||
return if @character_sprite.nil?
|
||||
@character_sprite.update
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: update_move_to
|
||||
#--------------------------------------------------------------------------
|
||||
def update_move_to
|
||||
@battler.update_move_to
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: moving?
|
||||
#--------------------------------------------------------------------------
|
||||
def moving?
|
||||
return false if @battler.nil?
|
||||
return @battler.moving?
|
||||
end
|
||||
|
||||
end # Sprite_Battler
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Sprite_BattleCharacter
|
||||
#==============================================================================
|
||||
|
||||
class Sprite_BattleCharacter < Sprite_Character
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# initialize
|
||||
#--------------------------------------------------------------------------
|
||||
def initialize(viewport, character = nil)
|
||||
super(viewport, character)
|
||||
character.sprite = self
|
||||
end
|
||||
|
||||
end # Sprite_BattleCharacter
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Spriteset_Battle
|
||||
#==============================================================================
|
||||
|
||||
class Spriteset_Battle
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# public instance_variable
|
||||
#--------------------------------------------------------------------------
|
||||
attr_accessor :actor_sprites
|
||||
attr_accessor :enemy_sprites
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# overwrite method: create_actors
|
||||
#--------------------------------------------------------------------------
|
||||
def create_actors
|
||||
total = $game_party.max_battle_members
|
||||
@current_party = $game_party.battle_members.clone
|
||||
@actor_sprites = Array.new(total) { Sprite_Battler.new(@viewport1) }
|
||||
for actor in $game_party.battle_members
|
||||
@actor_sprites[actor.index].battler = actor
|
||||
create_actor_sprite(actor)
|
||||
end
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: create_actor_sprite
|
||||
#--------------------------------------------------------------------------
|
||||
def create_actor_sprite(actor)
|
||||
character = Game_BattleCharacter.new(actor)
|
||||
character_sprite = Sprite_BattleCharacter.new(@viewport1, character)
|
||||
@actor_sprites[actor.index].character_base = character
|
||||
@actor_sprites[actor.index].character_sprite = character_sprite
|
||||
actor.face_opposing_party
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# alias method: update_actors
|
||||
#--------------------------------------------------------------------------
|
||||
alias spriteset_battle_update_actors_vb update_actors
|
||||
def update_actors
|
||||
if @current_party != $game_party.battle_members
|
||||
dispose_actors
|
||||
create_actors
|
||||
end
|
||||
spriteset_battle_update_actors_vb
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: moving?
|
||||
#--------------------------------------------------------------------------
|
||||
def moving?
|
||||
return battler_sprites.any? {|sprite| sprite.moving? }
|
||||
end
|
||||
|
||||
end # Spriteset_Battle
|
||||
|
||||
#==============================================================================
|
||||
# ? <20><> Scene_Battle
|
||||
#==============================================================================
|
||||
|
||||
class Scene_Battle < Scene_Base
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# public instance variables
|
||||
#--------------------------------------------------------------------------
|
||||
attr_accessor :spriteset
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# alias method: process_action_end
|
||||
#--------------------------------------------------------------------------
|
||||
alias scene_battle_process_action_end_vb process_action_end
|
||||
def process_action_end
|
||||
start_battler_move_origin
|
||||
scene_battle_process_action_end_vb
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# alias method: execute_action
|
||||
#--------------------------------------------------------------------------
|
||||
alias scene_battle_execute_action_vb execute_action
|
||||
def execute_action
|
||||
start_battler_move_forward
|
||||
scene_battle_execute_action_vb
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: start_battler_move_forward
|
||||
#--------------------------------------------------------------------------
|
||||
def start_battler_move_forward
|
||||
return if @subject.started_turn
|
||||
@subject.started_turn = true
|
||||
@subject.move_forward
|
||||
wait_for_moving
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: start_battler_move_origin
|
||||
#--------------------------------------------------------------------------
|
||||
def start_battler_move_origin
|
||||
@subject.started_turn = nil
|
||||
move_battlers_origin
|
||||
wait_for_moving
|
||||
@subject.face_opposing_party rescue 0
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: move_battlers_origin
|
||||
#--------------------------------------------------------------------------
|
||||
def move_battlers_origin
|
||||
for member in all_battle_members
|
||||
next if member.dead?
|
||||
next unless member.exist?
|
||||
member.move_origin
|
||||
end
|
||||
end
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# new method: wait_for_moving
|
||||
#--------------------------------------------------------------------------
|
||||
def wait_for_moving
|
||||
update_for_wait
|
||||
update_for_wait while @spriteset.moving?
|
||||
end
|
||||
|
||||
end # Scene_Battle
|
||||
|
||||
#==============================================================================
|
||||
#
|
||||
# <20><> End of File
|
||||
#
|
||||
#==============================================================================
|
||||
@@ -1 +0,0 @@
|
||||
DROP ALL TABLES
|
||||
@@ -1 +0,0 @@
|
||||
{"foo": "bar"}
|
||||
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
0
samples/Text/md → test/fixtures/Data/md
vendored
0
samples/Text/md → test/fixtures/Data/md
vendored
@@ -18,56 +18,65 @@ class TestBlob < Test::Unit::TestCase
|
||||
File.expand_path("../../samples", __FILE__)
|
||||
end
|
||||
|
||||
def blob(name)
|
||||
def fixtures_path
|
||||
File.expand_path("../fixtures", __FILE__)
|
||||
end
|
||||
|
||||
def sample_blob(name)
|
||||
name = File.join(samples_path, name) unless name =~ /^\//
|
||||
FileBlob.new(name, samples_path)
|
||||
end
|
||||
|
||||
def fixture_blob(name)
|
||||
name = File.join(fixtures_path, name) unless name =~ /^\//
|
||||
FileBlob.new(name, fixtures_path)
|
||||
end
|
||||
|
||||
def script_blob(name)
|
||||
blob = blob(name)
|
||||
blob = sample_blob(name)
|
||||
blob.instance_variable_set(:@name, 'script')
|
||||
blob
|
||||
end
|
||||
|
||||
def test_name
|
||||
assert_equal "foo.rb", blob("foo.rb").name
|
||||
assert_equal "foo.rb", sample_blob("foo.rb").name
|
||||
end
|
||||
|
||||
def test_mime_type
|
||||
assert_equal "application/postscript", blob("Binary/octocat.ai").mime_type
|
||||
assert_equal "application/x-ruby", blob("Ruby/grit.rb").mime_type
|
||||
assert_equal "application/x-sh", blob("Shell/script.sh").mime_type
|
||||
assert_equal "application/xml", blob("XML/bar.xml").mime_type
|
||||
assert_equal "audio/ogg", blob("Binary/foo.ogg").mime_type
|
||||
assert_equal "text/plain", blob("Text/README").mime_type
|
||||
assert_equal "application/postscript", fixture_blob("Binary/octocat.ai").mime_type
|
||||
assert_equal "application/x-ruby", sample_blob("Ruby/grit.rb").mime_type
|
||||
assert_equal "application/x-sh", sample_blob("Shell/script.sh").mime_type
|
||||
assert_equal "application/xml", sample_blob("XML/bar.xml").mime_type
|
||||
assert_equal "audio/ogg", fixture_blob("Binary/foo.ogg").mime_type
|
||||
assert_equal "text/plain", fixture_blob("Data/README").mime_type
|
||||
end
|
||||
|
||||
def test_content_type
|
||||
assert_equal "application/pdf", blob("Binary/foo.pdf").content_type
|
||||
assert_equal "audio/ogg", blob("Binary/foo.ogg").content_type
|
||||
assert_equal "image/png", blob("Binary/foo.png").content_type
|
||||
assert_equal "text/plain; charset=iso-8859-2", blob("Text/README").content_type
|
||||
assert_equal "application/pdf", fixture_blob("Binary/foo.pdf").content_type
|
||||
assert_equal "audio/ogg", fixture_blob("Binary/foo.ogg").content_type
|
||||
assert_equal "image/png", fixture_blob("Binary/foo.png").content_type
|
||||
assert_equal "text/plain; charset=iso-8859-2", fixture_blob("Data/README").content_type
|
||||
end
|
||||
|
||||
def test_disposition
|
||||
assert_equal "attachment; filename=foo+bar.jar", blob("Binary/foo bar.jar").disposition
|
||||
assert_equal "attachment; filename=foo.bin", blob("Binary/foo.bin").disposition
|
||||
assert_equal "attachment; filename=linguist.gem", blob("Binary/linguist.gem").disposition
|
||||
assert_equal "attachment; filename=octocat.ai", blob("Binary/octocat.ai").disposition
|
||||
assert_equal "inline", blob("Text/README").disposition
|
||||
assert_equal "inline", blob("Text/foo.txt").disposition
|
||||
assert_equal "inline", blob("Ruby/grit.rb").disposition
|
||||
assert_equal "inline", blob("Binary/octocat.png").disposition
|
||||
assert_equal "attachment; filename=foo+bar.jar", fixture_blob("Binary/foo bar.jar").disposition
|
||||
assert_equal "attachment; filename=foo.bin", fixture_blob("Binary/foo.bin").disposition
|
||||
assert_equal "attachment; filename=linguist.gem", fixture_blob("Binary/linguist.gem").disposition
|
||||
assert_equal "attachment; filename=octocat.ai", fixture_blob("Binary/octocat.ai").disposition
|
||||
assert_equal "inline", fixture_blob("Data/README").disposition
|
||||
assert_equal "inline", fixture_blob("Data/foo.txt").disposition
|
||||
assert_equal "inline", sample_blob("Ruby/grit.rb").disposition
|
||||
assert_equal "inline", fixture_blob("Binary/octocat.png").disposition
|
||||
end
|
||||
|
||||
def test_data
|
||||
assert_equal "module Foo\nend\n", blob("Ruby/foo.rb").data
|
||||
assert_equal "module Foo\nend\n", sample_blob("Ruby/foo.rb").data
|
||||
end
|
||||
|
||||
def test_lines
|
||||
assert_equal ["module Foo", "end", ""], blob("Ruby/foo.rb").lines
|
||||
assert_equal ["line 1", "line 2", ""], blob("Text/mac.txt").lines
|
||||
assert_equal 475, blob("Emacs Lisp/ess-julia.el").lines.length
|
||||
assert_equal ["module Foo", "end", ""], sample_blob("Ruby/foo.rb").lines
|
||||
assert_equal ["line 1", "line 2", ""], fixture_blob("Data/mac.txt").lines
|
||||
assert_equal 475, sample_blob("Emacs Lisp/ess-julia.el").lines.length
|
||||
end
|
||||
|
||||
def test_lines_maintains_original_encoding
|
||||
@@ -75,135 +84,128 @@ class TestBlob < Test::Unit::TestCase
|
||||
# earlier versions of the gem made implicit guarantees that the encoding of
|
||||
# each `line` is in the same encoding as the file was originally read (in
|
||||
# practice, UTF-8 or ASCII-8BIT)
|
||||
assert_equal Encoding.default_external, blob("Text/utf16le.txt").lines.first.encoding
|
||||
assert_equal Encoding.default_external, fixture_blob("Data/utf16le.txt").lines.first.encoding
|
||||
end
|
||||
|
||||
def test_size
|
||||
assert_equal 15, blob("Ruby/foo.rb").size
|
||||
assert_equal 15, sample_blob("Ruby/foo.rb").size
|
||||
end
|
||||
|
||||
def test_loc
|
||||
assert_equal 3, blob("Ruby/foo.rb").loc
|
||||
assert_equal 3, sample_blob("Ruby/foo.rb").loc
|
||||
end
|
||||
|
||||
def test_sloc
|
||||
assert_equal 2, blob("Ruby/foo.rb").sloc
|
||||
assert_equal 3, blob("Text/utf16le-windows.txt").sloc
|
||||
assert_equal 1, blob("Text/iso8859-8-i.txt").sloc
|
||||
assert_equal 2, sample_blob("Ruby/foo.rb").sloc
|
||||
assert_equal 3, fixture_blob("Data/utf16le-windows.txt").sloc
|
||||
assert_equal 1, fixture_blob("Data/iso8859-8-i.txt").sloc
|
||||
end
|
||||
|
||||
def test_encoding
|
||||
assert_equal "ISO-8859-2", blob("Text/README").encoding
|
||||
assert_equal "ISO-8859-2", blob("Text/README").ruby_encoding
|
||||
assert_equal "ISO-8859-1", blob("Text/dump.sql").encoding
|
||||
assert_equal "ISO-8859-1", blob("Text/dump.sql").ruby_encoding
|
||||
assert_equal "UTF-8", blob("Text/foo.txt").encoding
|
||||
assert_equal "UTF-8", blob("Text/foo.txt").ruby_encoding
|
||||
assert_equal "UTF-16LE", blob("Text/utf16le.txt").encoding
|
||||
assert_equal "UTF-16LE", blob("Text/utf16le.txt").ruby_encoding
|
||||
assert_equal "UTF-16LE", blob("Text/utf16le-windows.txt").encoding
|
||||
assert_equal "UTF-16LE", blob("Text/utf16le-windows.txt").ruby_encoding
|
||||
assert_equal "ISO-2022-KR", blob("Text/ISO-2022-KR.txt").encoding
|
||||
assert_equal "binary", blob("Text/ISO-2022-KR.txt").ruby_encoding
|
||||
assert_nil blob("Binary/dog.o").encoding
|
||||
|
||||
assert_equal "windows-1252", blob("Text/Visual_Battlers.rb").encoding
|
||||
assert_equal "Windows-1252", blob("Text/Visual_Battlers.rb").ruby_encoding
|
||||
assert_equal "ISO-8859-2", fixture_blob("Data/README").encoding
|
||||
assert_equal "ISO-8859-2", fixture_blob("Data/README").ruby_encoding
|
||||
assert_equal "UTF-8", fixture_blob("Data/foo.txt").encoding
|
||||
assert_equal "UTF-8", fixture_blob("Data/foo.txt").ruby_encoding
|
||||
assert_equal "UTF-16LE", fixture_blob("Data/utf16le.txt").encoding
|
||||
assert_equal "UTF-16LE", fixture_blob("Data/utf16le.txt").ruby_encoding
|
||||
assert_equal "UTF-16LE", fixture_blob("Data/utf16le-windows.txt").encoding
|
||||
assert_equal "UTF-16LE", fixture_blob("Data/utf16le-windows.txt").ruby_encoding
|
||||
assert_equal "ISO-2022-KR", fixture_blob("Data/ISO-2022-KR.txt").encoding
|
||||
assert_equal "binary", fixture_blob("Data/ISO-2022-KR.txt").ruby_encoding
|
||||
assert_nil fixture_blob("Binary/dog.o").encoding
|
||||
end
|
||||
|
||||
def test_binary
|
||||
# Large blobs aren't loaded
|
||||
large_blob = blob("git.exe")
|
||||
large_blob = sample_blob("git.exe")
|
||||
large_blob.instance_eval do
|
||||
def data; end
|
||||
end
|
||||
assert large_blob.binary?
|
||||
|
||||
assert blob("Binary/git.deb").binary?
|
||||
assert blob("Binary/git.exe").binary?
|
||||
assert blob("Binary/hello.pbc").binary?
|
||||
assert blob("Binary/linguist.gem").binary?
|
||||
assert blob("Binary/octocat.ai").binary?
|
||||
assert blob("Binary/octocat.png").binary?
|
||||
assert blob("Binary/zip").binary?
|
||||
assert !blob("Text/README").binary?
|
||||
assert !blob("Text/file.txt").binary?
|
||||
assert !blob("Ruby/foo.rb").binary?
|
||||
assert !blob("Perl/script.pl").binary?
|
||||
assert fixture_blob("Binary/git.deb").binary?
|
||||
assert fixture_blob("Binary/git.exe").binary?
|
||||
assert fixture_blob("Binary/hello.pbc").binary?
|
||||
assert fixture_blob("Binary/linguist.gem").binary?
|
||||
assert fixture_blob("Binary/octocat.ai").binary?
|
||||
assert fixture_blob("Binary/octocat.png").binary?
|
||||
assert fixture_blob("Binary/zip").binary?
|
||||
assert !fixture_blob("Data/README").binary?
|
||||
assert !fixture_blob("Data/file.txt").binary?
|
||||
assert !sample_blob("Ruby/foo.rb").binary?
|
||||
assert !sample_blob("Perl/script.pl").binary?
|
||||
end
|
||||
|
||||
def test_all_binary
|
||||
Samples.each do |sample|
|
||||
blob = blob(sample[:path])
|
||||
blob = sample_blob(sample[:path])
|
||||
assert ! (blob.likely_binary? || blob.binary?), "#{sample[:path]} is a binary file"
|
||||
end
|
||||
end
|
||||
|
||||
def test_text
|
||||
assert blob("Text/README").text?
|
||||
assert blob("Text/dump.sql").text?
|
||||
assert blob("Text/file.json").text?
|
||||
assert blob("Text/file.txt").text?
|
||||
assert blob("Text/md").text?
|
||||
assert blob("Shell/script.sh").text?
|
||||
assert blob("Text/txt").text?
|
||||
assert fixture_blob("Data/README").text?
|
||||
assert fixture_blob("Data/file.txt").text?
|
||||
assert fixture_blob("Data/md").text?
|
||||
assert sample_blob("Shell/script.sh").text?
|
||||
assert fixture_blob("Data/txt").text?
|
||||
end
|
||||
|
||||
def test_image
|
||||
assert blob("Binary/octocat.gif").image?
|
||||
assert blob("Binary/octocat.jpeg").image?
|
||||
assert blob("Binary/octocat.jpg").image?
|
||||
assert blob("Binary/octocat.png").image?
|
||||
assert !blob("Binary/octocat.ai").image?
|
||||
assert !blob("Binary/octocat.psd").image?
|
||||
assert fixture_blob("Binary/octocat.gif").image?
|
||||
assert fixture_blob("Binary/octocat.jpeg").image?
|
||||
assert fixture_blob("Binary/octocat.jpg").image?
|
||||
assert fixture_blob("Binary/octocat.png").image?
|
||||
assert !fixture_blob("Binary/octocat.ai").image?
|
||||
assert !fixture_blob("Binary/octocat.psd").image?
|
||||
end
|
||||
|
||||
def test_solid
|
||||
assert blob("Binary/cube.stl").solid?
|
||||
assert blob("Text/cube.stl").solid?
|
||||
assert fixture_blob("Binary/cube.stl").solid?
|
||||
assert fixture_blob("Data/cube.stl").solid?
|
||||
end
|
||||
|
||||
def test_csv
|
||||
assert blob("Text/cars.csv").csv?
|
||||
assert fixture_blob("Data/cars.csv").csv?
|
||||
end
|
||||
|
||||
def test_pdf
|
||||
assert blob("Binary/foo.pdf").pdf?
|
||||
assert fixture_blob("Binary/foo.pdf").pdf?
|
||||
end
|
||||
|
||||
def test_viewable
|
||||
assert blob("Text/README").viewable?
|
||||
assert blob("Ruby/foo.rb").viewable?
|
||||
assert blob("Perl/script.pl").viewable?
|
||||
assert !blob("Binary/linguist.gem").viewable?
|
||||
assert !blob("Binary/octocat.ai").viewable?
|
||||
assert !blob("Binary/octocat.png").viewable?
|
||||
assert fixture_blob("Data/README").viewable?
|
||||
assert sample_blob("Ruby/foo.rb").viewable?
|
||||
assert sample_blob("Perl/script.pl").viewable?
|
||||
assert !fixture_blob("Binary/linguist.gem").viewable?
|
||||
assert !fixture_blob("Binary/octocat.ai").viewable?
|
||||
assert !fixture_blob("Binary/octocat.png").viewable?
|
||||
end
|
||||
|
||||
def test_generated
|
||||
assert !blob("Text/README").generated?
|
||||
assert !fixture_blob("Data/README").generated?
|
||||
|
||||
# Xcode project files
|
||||
assert !blob("XML/MainMenu.xib").generated?
|
||||
assert blob("Binary/MainMenu.nib").generated?
|
||||
assert !blob("XML/project.pbxproj").generated?
|
||||
assert !sample_blob("XML/MainMenu.xib").generated?
|
||||
assert fixture_blob("Binary/MainMenu.nib").generated?
|
||||
assert !sample_blob("XML/project.pbxproj").generated?
|
||||
|
||||
# Gemfile.lock is NOT generated
|
||||
assert !blob("Gemfile.lock").generated?
|
||||
assert !sample_blob("Gemfile.lock").generated?
|
||||
|
||||
# Generated .NET Docfiles
|
||||
assert blob("XML/net_docfile.xml").generated?
|
||||
assert sample_blob("XML/net_docfile.xml").generated?
|
||||
|
||||
# Long line
|
||||
assert !blob("JavaScript/uglify.js").generated?
|
||||
assert !sample_blob("JavaScript/uglify.js").generated?
|
||||
|
||||
# Inlined JS, but mostly code
|
||||
assert !blob("JavaScript/json2_backbone.js").generated?
|
||||
assert !sample_blob("JavaScript/json2_backbone.js").generated?
|
||||
|
||||
# Minified JS
|
||||
assert !blob("JavaScript/jquery-1.6.1.js").generated?
|
||||
assert blob("JavaScript/jquery-1.6.1.min.js").generated?
|
||||
assert blob("JavaScript/jquery-1.4.2.min.js").generated?
|
||||
assert !sample_blob("JavaScript/jquery-1.6.1.js").generated?
|
||||
assert sample_blob("JavaScript/jquery-1.6.1.min.js").generated?
|
||||
assert sample_blob("JavaScript/jquery-1.4.2.min.js").generated?
|
||||
|
||||
# CoffeeScript-generated JS
|
||||
# TODO
|
||||
@@ -212,256 +214,256 @@ class TestBlob < Test::Unit::TestCase
|
||||
# TODO
|
||||
|
||||
# Composer generated composer.lock file
|
||||
assert blob("JSON/composer.lock").generated?
|
||||
assert sample_blob("JSON/composer.lock").generated?
|
||||
|
||||
# PEG.js-generated parsers
|
||||
assert blob("JavaScript/parser.js").generated?
|
||||
assert sample_blob("JavaScript/parser.js").generated?
|
||||
|
||||
# Generated PostScript
|
||||
assert !blob("PostScript/sierpinski.ps").generated?
|
||||
assert !sample_blob("PostScript/sierpinski.ps").generated?
|
||||
|
||||
# These examples are too basic to tell
|
||||
assert !blob("JavaScript/hello.js").generated?
|
||||
assert !sample_blob("JavaScript/hello.js").generated?
|
||||
|
||||
assert blob("JavaScript/intro-old.js").generated?
|
||||
assert blob("JavaScript/classes-old.js").generated?
|
||||
assert sample_blob("JavaScript/intro-old.js").generated?
|
||||
assert sample_blob("JavaScript/classes-old.js").generated?
|
||||
|
||||
assert blob("JavaScript/intro.js").generated?
|
||||
assert blob("JavaScript/classes.js").generated?
|
||||
assert sample_blob("JavaScript/intro.js").generated?
|
||||
assert sample_blob("JavaScript/classes.js").generated?
|
||||
|
||||
# Protocol Buffer generated code
|
||||
assert blob("C++/protocol-buffer.pb.h").generated?
|
||||
assert blob("C++/protocol-buffer.pb.cc").generated?
|
||||
assert blob("Java/ProtocolBuffer.java").generated?
|
||||
assert blob("Python/protocol_buffer_pb2.py").generated?
|
||||
assert sample_blob("C++/protocol-buffer.pb.h").generated?
|
||||
assert sample_blob("C++/protocol-buffer.pb.cc").generated?
|
||||
assert sample_blob("Java/ProtocolBuffer.java").generated?
|
||||
assert sample_blob("Python/protocol_buffer_pb2.py").generated?
|
||||
|
||||
# Generated JNI
|
||||
assert blob("C/jni_layer.h").generated?
|
||||
assert sample_blob("C/jni_layer.h").generated?
|
||||
|
||||
# Minified CSS
|
||||
assert !blob("CSS/bootstrap.css").generated?
|
||||
assert blob("CSS/bootstrap.min.css").generated?
|
||||
assert !sample_blob("CSS/bootstrap.css").generated?
|
||||
assert sample_blob("CSS/bootstrap.min.css").generated?
|
||||
|
||||
# Generated VCR
|
||||
assert blob("YAML/vcr_cassette.yml").generated?
|
||||
assert sample_blob("YAML/vcr_cassette.yml").generated?
|
||||
|
||||
# Generated by Zephir
|
||||
assert blob("Zephir/filenames/exception.zep.c").generated?
|
||||
assert blob("Zephir/filenames/exception.zep.h").generated?
|
||||
assert blob("Zephir/filenames/exception.zep.php").generated?
|
||||
assert !blob("Zephir/Router.zep").generated?
|
||||
assert sample_blob("Zephir/filenames/exception.zep.c").generated?
|
||||
assert sample_blob("Zephir/filenames/exception.zep.h").generated?
|
||||
assert sample_blob("Zephir/filenames/exception.zep.php").generated?
|
||||
assert !sample_blob("Zephir/Router.zep").generated?
|
||||
|
||||
|
||||
assert Linguist::Generated.generated?("node_modules/grunt/lib/grunt.js", nil)
|
||||
|
||||
# Godep saved dependencies
|
||||
assert blob("Godeps/Godeps.json").generated?
|
||||
assert blob("Godeps/_workspace/src/github.com/kr/s3/sign.go").generated?
|
||||
assert sample_blob("Godeps/Godeps.json").generated?
|
||||
assert sample_blob("Godeps/_workspace/src/github.com/kr/s3/sign.go").generated?
|
||||
end
|
||||
|
||||
def test_vendored
|
||||
assert !blob("Text/README").vendored?
|
||||
assert !blob("ext/extconf.rb").vendored?
|
||||
assert !fixture_blob("Data/README").vendored?
|
||||
assert !sample_blob("ext/extconf.rb").vendored?
|
||||
|
||||
# Dependencies
|
||||
assert blob("dependencies/windows/headers/GL/glext.h").vendored?
|
||||
assert sample_blob("dependencies/windows/headers/GL/glext.h").vendored?
|
||||
|
||||
# Node dependencies
|
||||
assert blob("node_modules/coffee-script/lib/coffee-script.js").vendored?
|
||||
assert sample_blob("node_modules/coffee-script/lib/coffee-script.js").vendored?
|
||||
|
||||
# Bower Components
|
||||
assert blob("bower_components/custom/custom.js").vendored?
|
||||
assert blob("app/bower_components/custom/custom.js").vendored?
|
||||
assert blob("vendor/assets/bower_components/custom/custom.js").vendored?
|
||||
assert sample_blob("bower_components/custom/custom.js").vendored?
|
||||
assert sample_blob("app/bower_components/custom/custom.js").vendored?
|
||||
assert sample_blob("vendor/assets/bower_components/custom/custom.js").vendored?
|
||||
|
||||
# Go dependencies
|
||||
assert !blob("Godeps/Godeps.json").vendored?
|
||||
assert blob("Godeps/_workspace/src/github.com/kr/s3/sign.go").vendored?
|
||||
assert !sample_blob("Godeps/Godeps.json").vendored?
|
||||
assert sample_blob("Godeps/_workspace/src/github.com/kr/s3/sign.go").vendored?
|
||||
|
||||
# Rails vendor/
|
||||
assert blob("vendor/plugins/will_paginate/lib/will_paginate.rb").vendored?
|
||||
assert sample_blob("vendor/plugins/will_paginate/lib/will_paginate.rb").vendored?
|
||||
|
||||
# 'thirdparty' directory
|
||||
assert blob("thirdparty/lib/main.c").vendored?
|
||||
assert sample_blob("thirdparty/lib/main.c").vendored?
|
||||
|
||||
# 'extern(al)' directory
|
||||
assert blob("extern/util/__init__.py").vendored?
|
||||
assert blob("external/jquery.min.js").vendored?
|
||||
assert sample_blob("extern/util/__init__.py").vendored?
|
||||
assert sample_blob("external/jquery.min.js").vendored?
|
||||
|
||||
# C deps
|
||||
assert blob("deps/http_parser/http_parser.c").vendored?
|
||||
assert blob("deps/v8/src/v8.h").vendored?
|
||||
assert sample_blob("deps/http_parser/http_parser.c").vendored?
|
||||
assert sample_blob("deps/v8/src/v8.h").vendored?
|
||||
|
||||
# Chart.js
|
||||
assert blob("some/vendored/path/Chart.js").vendored?
|
||||
assert !blob("some/vendored/path/chart.js").vendored?
|
||||
assert sample_blob("some/vendored/path/Chart.js").vendored?
|
||||
assert !sample_blob("some/vendored/path/chart.js").vendored?
|
||||
|
||||
# Codemirror deps
|
||||
assert blob("codemirror/mode/blah.js").vendored?
|
||||
assert sample_blob("codemirror/mode/blah.js").vendored?
|
||||
|
||||
# Debian packaging
|
||||
assert blob("debian/cron.d").vendored?
|
||||
assert sample_blob("debian/cron.d").vendored?
|
||||
|
||||
# Minified JavaScript and CSS
|
||||
assert blob("foo.min.js").vendored?
|
||||
assert blob("foo.min.css").vendored?
|
||||
assert blob("foo-min.js").vendored?
|
||||
assert blob("foo-min.css").vendored?
|
||||
assert !blob("foomin.css").vendored?
|
||||
assert !blob("foo.min.txt").vendored?
|
||||
assert sample_blob("foo.min.js").vendored?
|
||||
assert sample_blob("foo.min.css").vendored?
|
||||
assert sample_blob("foo-min.js").vendored?
|
||||
assert sample_blob("foo-min.css").vendored?
|
||||
assert !sample_blob("foomin.css").vendored?
|
||||
assert !sample_blob("foo.min.txt").vendored?
|
||||
|
||||
# Prototype
|
||||
assert !blob("public/javascripts/application.js").vendored?
|
||||
assert blob("public/javascripts/prototype.js").vendored?
|
||||
assert blob("public/javascripts/effects.js").vendored?
|
||||
assert blob("public/javascripts/controls.js").vendored?
|
||||
assert blob("public/javascripts/dragdrop.js").vendored?
|
||||
assert !sample_blob("public/javascripts/application.js").vendored?
|
||||
assert sample_blob("public/javascripts/prototype.js").vendored?
|
||||
assert sample_blob("public/javascripts/effects.js").vendored?
|
||||
assert sample_blob("public/javascripts/controls.js").vendored?
|
||||
assert sample_blob("public/javascripts/dragdrop.js").vendored?
|
||||
|
||||
# jQuery
|
||||
assert blob("jquery.js").vendored?
|
||||
assert blob("public/javascripts/jquery.js").vendored?
|
||||
assert blob("public/javascripts/jquery.min.js").vendored?
|
||||
assert blob("public/javascripts/jquery-1.7.js").vendored?
|
||||
assert blob("public/javascripts/jquery-1.7.min.js").vendored?
|
||||
assert blob("public/javascripts/jquery-1.5.2.js").vendored?
|
||||
assert blob("public/javascripts/jquery-1.6.1.js").vendored?
|
||||
assert blob("public/javascripts/jquery-1.6.1.min.js").vendored?
|
||||
assert blob("public/javascripts/jquery-1.10.1.js").vendored?
|
||||
assert blob("public/javascripts/jquery-1.10.1.min.js").vendored?
|
||||
assert !blob("public/javascripts/jquery.github.menu.js").vendored?
|
||||
assert sample_blob("jquery.js").vendored?
|
||||
assert sample_blob("public/javascripts/jquery.js").vendored?
|
||||
assert sample_blob("public/javascripts/jquery.min.js").vendored?
|
||||
assert sample_blob("public/javascripts/jquery-1.7.js").vendored?
|
||||
assert sample_blob("public/javascripts/jquery-1.7.min.js").vendored?
|
||||
assert sample_blob("public/javascripts/jquery-1.5.2.js").vendored?
|
||||
assert sample_blob("public/javascripts/jquery-1.6.1.js").vendored?
|
||||
assert sample_blob("public/javascripts/jquery-1.6.1.min.js").vendored?
|
||||
assert sample_blob("public/javascripts/jquery-1.10.1.js").vendored?
|
||||
assert sample_blob("public/javascripts/jquery-1.10.1.min.js").vendored?
|
||||
assert !sample_blob("public/javascripts/jquery.github.menu.js").vendored?
|
||||
|
||||
# jQuery UI
|
||||
assert blob("themes/ui-lightness/jquery-ui.css").vendored?
|
||||
assert blob("themes/ui-lightness/jquery-ui-1.8.22.custom.css").vendored?
|
||||
assert blob("themes/ui-lightness/jquery.ui.accordion.css").vendored?
|
||||
assert blob("ui/i18n/jquery.ui.datepicker-ar.js").vendored?
|
||||
assert blob("ui/i18n/jquery-ui-i18n.js").vendored?
|
||||
assert blob("ui/jquery.effects.blind.js").vendored?
|
||||
assert blob("ui/jquery-ui-1.8.22.custom.js").vendored?
|
||||
assert blob("ui/jquery-ui-1.8.22.custom.min.js").vendored?
|
||||
assert blob("ui/jquery-ui-1.8.22.js").vendored?
|
||||
assert blob("ui/jquery-ui-1.8.js").vendored?
|
||||
assert blob("ui/jquery-ui.min.js").vendored?
|
||||
assert blob("ui/jquery.ui.accordion.js").vendored?
|
||||
assert blob("ui/minified/jquery.effects.blind.min.js").vendored?
|
||||
assert blob("ui/minified/jquery.ui.accordion.min.js").vendored?
|
||||
assert sample_blob("themes/ui-lightness/jquery-ui.css").vendored?
|
||||
assert sample_blob("themes/ui-lightness/jquery-ui-1.8.22.custom.css").vendored?
|
||||
assert sample_blob("themes/ui-lightness/jquery.ui.accordion.css").vendored?
|
||||
assert sample_blob("ui/i18n/jquery.ui.datepicker-ar.js").vendored?
|
||||
assert sample_blob("ui/i18n/jquery-ui-i18n.js").vendored?
|
||||
assert sample_blob("ui/jquery.effects.blind.js").vendored?
|
||||
assert sample_blob("ui/jquery-ui-1.8.22.custom.js").vendored?
|
||||
assert sample_blob("ui/jquery-ui-1.8.22.custom.min.js").vendored?
|
||||
assert sample_blob("ui/jquery-ui-1.8.22.js").vendored?
|
||||
assert sample_blob("ui/jquery-ui-1.8.js").vendored?
|
||||
assert sample_blob("ui/jquery-ui.min.js").vendored?
|
||||
assert sample_blob("ui/jquery.ui.accordion.js").vendored?
|
||||
assert sample_blob("ui/minified/jquery.effects.blind.min.js").vendored?
|
||||
assert sample_blob("ui/minified/jquery.ui.accordion.min.js").vendored?
|
||||
|
||||
# MooTools
|
||||
assert blob("public/javascripts/mootools-core-1.3.2-full-compat.js").vendored?
|
||||
assert blob("public/javascripts/mootools-core-1.3.2-full-compat-yc.js").vendored?
|
||||
assert sample_blob("public/javascripts/mootools-core-1.3.2-full-compat.js").vendored?
|
||||
assert sample_blob("public/javascripts/mootools-core-1.3.2-full-compat-yc.js").vendored?
|
||||
|
||||
# Dojo
|
||||
assert blob("public/javascripts/dojo.js").vendored?
|
||||
assert sample_blob("public/javascripts/dojo.js").vendored?
|
||||
|
||||
# MochiKit
|
||||
assert blob("public/javascripts/MochiKit.js").vendored?
|
||||
assert sample_blob("public/javascripts/MochiKit.js").vendored?
|
||||
|
||||
# YUI
|
||||
assert blob("public/javascripts/yahoo-dom-event.js").vendored?
|
||||
assert blob("public/javascripts/yahoo-min.js").vendored?
|
||||
assert blob("public/javascripts/yuiloader-dom-event.js").vendored?
|
||||
assert sample_blob("public/javascripts/yahoo-dom-event.js").vendored?
|
||||
assert sample_blob("public/javascripts/yahoo-min.js").vendored?
|
||||
assert sample_blob("public/javascripts/yuiloader-dom-event.js").vendored?
|
||||
|
||||
# WYS editors
|
||||
assert blob("public/javascripts/ckeditor.js").vendored?
|
||||
assert blob("public/javascripts/tiny_mce.js").vendored?
|
||||
assert blob("public/javascripts/tiny_mce_popup.js").vendored?
|
||||
assert blob("public/javascripts/tiny_mce_src.js").vendored?
|
||||
assert sample_blob("public/javascripts/ckeditor.js").vendored?
|
||||
assert sample_blob("public/javascripts/tiny_mce.js").vendored?
|
||||
assert sample_blob("public/javascripts/tiny_mce_popup.js").vendored?
|
||||
assert sample_blob("public/javascripts/tiny_mce_src.js").vendored?
|
||||
|
||||
# AngularJS
|
||||
assert blob("public/javascripts/angular.js").vendored?
|
||||
assert blob("public/javascripts/angular.min.js").vendored?
|
||||
assert sample_blob("public/javascripts/angular.js").vendored?
|
||||
assert sample_blob("public/javascripts/angular.min.js").vendored?
|
||||
|
||||
# D3.js
|
||||
assert blob("public/javascripts/d3.v3.js").vendored?
|
||||
assert blob("public/javascripts/d3.v3.min.js").vendored?
|
||||
assert sample_blob("public/javascripts/d3.v3.js").vendored?
|
||||
assert sample_blob("public/javascripts/d3.v3.min.js").vendored?
|
||||
|
||||
# Modernizr
|
||||
assert blob("public/javascripts/modernizr-2.7.1.js").vendored?
|
||||
assert blob("public/javascripts/modernizr.custom.01009.js").vendored?
|
||||
assert sample_blob("public/javascripts/modernizr-2.7.1.js").vendored?
|
||||
assert sample_blob("public/javascripts/modernizr.custom.01009.js").vendored?
|
||||
|
||||
# Fabric
|
||||
assert blob("fabfile.py").vendored?
|
||||
assert sample_blob("fabfile.py").vendored?
|
||||
|
||||
# WAF
|
||||
assert blob("waf").vendored?
|
||||
assert sample_blob("waf").vendored?
|
||||
|
||||
# Visual Studio IntelliSense
|
||||
assert blob("Scripts/jquery-1.7-vsdoc.js").vendored?
|
||||
assert sample_blob("Scripts/jquery-1.7-vsdoc.js").vendored?
|
||||
|
||||
# Microsoft Ajax
|
||||
assert blob("Scripts/MicrosoftAjax.debug.js").vendored?
|
||||
assert blob("Scripts/MicrosoftAjax.js").vendored?
|
||||
assert blob("Scripts/MicrosoftMvcAjax.debug.js").vendored?
|
||||
assert blob("Scripts/MicrosoftMvcAjax.js").vendored?
|
||||
assert blob("Scripts/MicrosoftMvcValidation.debug.js").vendored?
|
||||
assert blob("Scripts/MicrosoftMvcValidation.js").vendored?
|
||||
assert sample_blob("Scripts/MicrosoftAjax.debug.js").vendored?
|
||||
assert sample_blob("Scripts/MicrosoftAjax.js").vendored?
|
||||
assert sample_blob("Scripts/MicrosoftMvcAjax.debug.js").vendored?
|
||||
assert sample_blob("Scripts/MicrosoftMvcAjax.js").vendored?
|
||||
assert sample_blob("Scripts/MicrosoftMvcValidation.debug.js").vendored?
|
||||
assert sample_blob("Scripts/MicrosoftMvcValidation.js").vendored?
|
||||
|
||||
# jQuery validation plugin (MS bundles this with asp.net mvc)
|
||||
assert blob("Scripts/jquery.validate.js").vendored?
|
||||
assert blob("Scripts/jquery.validate.min.js").vendored?
|
||||
assert blob("Scripts/jquery.validate.unobtrusive.js").vendored?
|
||||
assert blob("Scripts/jquery.validate.unobtrusive.min.js").vendored?
|
||||
assert blob("Scripts/jquery.unobtrusive-ajax.js").vendored?
|
||||
assert blob("Scripts/jquery.unobtrusive-ajax.min.js").vendored?
|
||||
assert sample_blob("Scripts/jquery.validate.js").vendored?
|
||||
assert sample_blob("Scripts/jquery.validate.min.js").vendored?
|
||||
assert sample_blob("Scripts/jquery.validate.unobtrusive.js").vendored?
|
||||
assert sample_blob("Scripts/jquery.validate.unobtrusive.min.js").vendored?
|
||||
assert sample_blob("Scripts/jquery.unobtrusive-ajax.js").vendored?
|
||||
assert sample_blob("Scripts/jquery.unobtrusive-ajax.min.js").vendored?
|
||||
|
||||
# NuGet Packages
|
||||
assert blob("packages/Modernizr.2.0.6/Content/Scripts/modernizr-2.0.6-development-only.js").vendored?
|
||||
assert sample_blob("packages/Modernizr.2.0.6/Content/Scripts/modernizr-2.0.6-development-only.js").vendored?
|
||||
|
||||
# Font Awesome
|
||||
assert blob("some/asset/path/font-awesome.min.css").vendored?
|
||||
assert blob("some/asset/path/font-awesome.css").vendored?
|
||||
assert sample_blob("some/asset/path/font-awesome.min.css").vendored?
|
||||
assert sample_blob("some/asset/path/font-awesome.css").vendored?
|
||||
|
||||
# Normalize
|
||||
assert blob("some/asset/path/normalize.css").vendored?
|
||||
assert sample_blob("some/asset/path/normalize.css").vendored?
|
||||
|
||||
# Cocoapods
|
||||
assert blob('Pods/blah').vendored?
|
||||
assert sample_blob('Pods/blah').vendored?
|
||||
|
||||
# Html5shiv
|
||||
assert blob("Scripts/html5shiv.js").vendored?
|
||||
assert blob("Scripts/html5shiv.min.js").vendored?
|
||||
assert sample_blob("Scripts/html5shiv.js").vendored?
|
||||
assert sample_blob("Scripts/html5shiv.min.js").vendored?
|
||||
|
||||
# Test fixtures
|
||||
assert blob("test/fixtures/random.rkt").vendored?
|
||||
assert blob("Test/fixtures/random.rkt").vendored?
|
||||
assert sample_blob("test/fixtures/random.rkt").vendored?
|
||||
assert sample_blob("Test/fixtures/random.rkt").vendored?
|
||||
|
||||
# Cordova/PhoneGap
|
||||
assert blob("cordova.js").vendored?
|
||||
assert blob("cordova.min.js").vendored?
|
||||
assert blob("cordova-2.1.0.js").vendored?
|
||||
assert blob("cordova-2.1.0.min.js").vendored?
|
||||
assert sample_blob("cordova.js").vendored?
|
||||
assert sample_blob("cordova.min.js").vendored?
|
||||
assert sample_blob("cordova-2.1.0.js").vendored?
|
||||
assert sample_blob("cordova-2.1.0.min.js").vendored?
|
||||
|
||||
# Foundation js
|
||||
assert blob("foundation.js").vendored?
|
||||
assert blob("foundation.min.js").vendored?
|
||||
assert blob("foundation.abide.js").vendored?
|
||||
assert sample_blob("foundation.js").vendored?
|
||||
assert sample_blob("foundation.min.js").vendored?
|
||||
assert sample_blob("foundation.abide.js").vendored?
|
||||
|
||||
# Vagrant
|
||||
assert blob("Vagrantfile").vendored?
|
||||
assert sample_blob("Vagrantfile").vendored?
|
||||
|
||||
# Gradle
|
||||
assert blob("gradlew").vendored?
|
||||
assert blob("gradlew.bat").vendored?
|
||||
assert blob("gradle/wrapper/gradle-wrapper.properties").vendored?
|
||||
assert blob("subproject/gradlew").vendored?
|
||||
assert blob("subproject/gradlew.bat").vendored?
|
||||
assert blob("subproject/gradle/wrapper/gradle-wrapper.properties").vendored?
|
||||
assert sample_blob("gradlew").vendored?
|
||||
assert sample_blob("gradlew.bat").vendored?
|
||||
assert sample_blob("gradle/wrapper/gradle-wrapper.properties").vendored?
|
||||
assert sample_blob("subproject/gradlew").vendored?
|
||||
assert sample_blob("subproject/gradlew.bat").vendored?
|
||||
assert sample_blob("subproject/gradle/wrapper/gradle-wrapper.properties").vendored?
|
||||
|
||||
# Octicons
|
||||
assert blob("octicons.css").vendored?
|
||||
assert blob("public/octicons.min.css").vendored?
|
||||
assert blob("public/octicons/sprockets-octicons.scss").vendored?
|
||||
assert sample_blob("octicons.css").vendored?
|
||||
assert sample_blob("public/octicons.min.css").vendored?
|
||||
assert sample_blob("public/octicons/sprockets-octicons.scss").vendored?
|
||||
|
||||
# Typesafe Activator
|
||||
assert blob("activator").vendored?
|
||||
assert blob("activator.bat").vendored?
|
||||
assert blob("subproject/activator").vendored?
|
||||
assert blob("subproject/activator.bat").vendored?
|
||||
assert sample_blob("activator").vendored?
|
||||
assert sample_blob("activator.bat").vendored?
|
||||
assert sample_blob("subproject/activator").vendored?
|
||||
assert sample_blob("subproject/activator.bat").vendored?
|
||||
end
|
||||
|
||||
def test_language
|
||||
Samples.each do |sample|
|
||||
blob = blob(sample[:path])
|
||||
blob = sample_blob(sample[:path])
|
||||
assert blob.language, "No language for #{sample[:path]}"
|
||||
assert_equal sample[:language], blob.language.name, blob.name
|
||||
end
|
||||
@@ -469,7 +471,8 @@ class TestBlob < Test::Unit::TestCase
|
||||
# Test language detection for files which shouldn't be used as samples
|
||||
root = File.expand_path('../fixtures', __FILE__)
|
||||
Dir.entries(root).each do |language|
|
||||
next if language == '.' || language == '..' || File.basename(language) == 'ace_modes.json'
|
||||
next if language == '.' || language == '..' || language == 'Binary' ||
|
||||
File.basename(language) == 'ace_modes.json'
|
||||
|
||||
# Each directory contains test files of a language
|
||||
dirname = File.join(root, language)
|
||||
@@ -479,7 +482,7 @@ class TestBlob < Test::Unit::TestCase
|
||||
filepath = File.join(dirname, filename)
|
||||
next unless File.file?(filepath)
|
||||
|
||||
blob = blob(filepath)
|
||||
blob = fixture_blob(filepath)
|
||||
if language == 'Data'
|
||||
assert blob.language.nil?, "A language was found for #{filepath}"
|
||||
else
|
||||
@@ -491,7 +494,7 @@ class TestBlob < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def test_minified_files_not_safe_to_highlight
|
||||
assert !blob("JavaScript/jquery-1.6.1.min.js").safe_to_colorize?
|
||||
assert !sample_blob("JavaScript/jquery-1.6.1.min.js").safe_to_colorize?
|
||||
end
|
||||
|
||||
def test_empty
|
||||
|
||||
Reference in New Issue
Block a user