phew 0.0.2 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 77b4ad7bcdd167fc10b7ba80145217cc833f2fc1
4
- data.tar.gz: 24d2b4f26a4cc6c74c2b0e979006069b467bae87
2
+ SHA256:
3
+ metadata.gz: 5eb7e4c39012f4c7c899d8bd44f5556b01b635145c347029643293b447908aa6
4
+ data.tar.gz: f2041da52a3da3557cfbb9c14141d3a321c346341c6710f34161a233b16cf477
5
5
  SHA512:
6
- metadata.gz: 1d6819401d22edf6df33042eb9632c5bcd4f558540acf6c3245eeda5c4d988c24a7cb9fca9b58ad84c54f97fb2bcf822a3d2dee8b762eafb0d5b35e917bf9fd5
7
- data.tar.gz: 050afc7ffa55d0c1f89845a5fa89b6396b5e914f56ded42623bc313af77561d51cf159c239f0a4b1e92551d13bd1172ef03acf8957aa32294b84f8bc719d34ed
6
+ metadata.gz: 0c0c685cb173aceb658e0f275ba64d3e3fccf41ebacafff19e65d3619c270b67f3ff835dfcc6595bca9400e224c2adffb38d79c2a9def42fafa138e661163719
7
+ data.tar.gz: 5a968a69a7d6c30a9c798c59a75c81b7091a48992fbac49937ccbaa6de064ab64f7433706e8e65da0fd765604ad93f6423c93bb6338a51311fc083efea2145ed
data/bin/phew CHANGED
@@ -1,138 +1,29 @@
1
1
  #!/usr/bin/env ruby
2
- require 'phew'
2
+ # frozen_string_literal: true
3
3
 
4
- Gtk.init
4
+ require "phew"
5
5
 
6
- module Phew
7
- # Drop-down list of available scripts.
8
- class ScriptList < Gtk::ComboBoxText
9
- # FIXME: Should be able to fill inside #initialize
10
- def fill
11
- Pango::Script::Enum.symbols.
12
- map(&:to_s).
13
- each { |str| append str, str }
14
- end
15
- end
6
+ myapp = Gtk::Application.new("net.matijs.phew", { none: true })
16
7
 
17
- # Main Phew window
18
- class Window < Gtk::Window
19
- # Set up generic signal handlers for the window:
20
- # - Closing the window ends the application
21
- # - Pressing Ctrl-Q closes the window.
22
- def connect_signals
23
- signal_connect('destroy') { on_destroy_event }
24
- signal_connect('key-press-event') { |_, evt, _| on_key_press_event evt }
25
- end
8
+ myapp.signal_connect "startup" do |app|
9
+ action = Gio::SimpleAction.new("quit", nil)
10
+ action.signal_connect("activate") { app.quit }
11
+ myapp.add_action action
26
12
 
27
- def on_destroy_event
28
- Gtk.main_quit
29
- false
30
- end
13
+ myapp.set_accels_for_action "app.quit", ["<Ctrl>Q"]
31
14
 
32
- def on_key_press_event evt
33
- destroy if evt.state == :control_mask && evt.keyval == 'q'.ord
34
- false
35
- end
36
- end
15
+ # Add menu so Atspi has a way to access the actions
16
+ menu = Gio::Menu.new
17
+ file_menu = Gio::Menu.new
18
+ file_menu.append "Quit", "app.quit"
19
+ menu.append_submenu "File", file_menu
37
20
 
38
- # Main Phew application.
39
- class Application
40
- def combo
41
- @combo ||= ScriptList.new.tap(&:fill)
42
- end
43
-
44
- def textview
45
- @textview ||= Gtk::TextView.new
46
- end
47
-
48
- def build_vbox
49
- vbox = Gtk::VBox.new false, 0
50
-
51
- vbox.pack_start combo, false, false, 0
52
- vbox.pack_start textview, false, false, 0
53
- vbox.pack_start script_list_scroller, true, true, 0
54
- vbox
55
- end
56
-
57
- def vbox
58
- @vbox ||= build_vbox
59
- end
60
-
61
- def script_list_scroller
62
- @script_list_scroller ||= Gtk::ScrolledWindow.new(nil, nil).tap do |scr|
63
- lst = script_list
64
- scr.add lst
65
- lst.hadjustment = scr.hadjustment
66
- lst.vadjustment = scr.vadjustment
67
- end
68
- end
69
-
70
- def script_list
71
- @script_list ||= Gtk::TreeView.new_with_model(scriptmodel).tap do |view|
72
- renderer = Gtk::CellRendererText.new
73
- col = Gtk::TreeViewColumn.new
74
- col.set_title 'Font Name'
75
- col.pack_start renderer, true
76
- col.add_attribute renderer, 'text', 0
77
- view.append_column col
78
- end
79
- end
80
-
81
- def scriptmodel
82
- @scriptmodel ||= Gtk::ListStore.new [GObject::TYPE_STRING]
83
- end
84
-
85
- def build_win
86
- win = Window.new :toplevel
87
- win.add vbox
88
- win
89
- end
90
-
91
- def win
92
- @win ||= build_win
93
- end
94
-
95
- # Set up all signal handlers
96
- def connect_signals
97
- win.connect_signals
98
- combo.signal_connect('changed') { on_combo_changed_signal }
99
- end
100
-
101
- def on_combo_changed_signal
102
- script = Script.new combo.active_text.to_sym
103
- textview.buffer.text = script.sample_string
104
- fill_font_list script
105
- end
106
-
107
- def initialize
108
- @context = Gdk.pango_context_get
109
- @font_repository = FontRepository.new @context
110
- connect_signals
111
- win.show_all
112
- end
113
-
114
- def fill_font_list script
115
- scriptmodel.clear
116
-
117
- fontmap = @context.get_font_map
118
-
119
- fontmap.list_families.each do |fam|
120
- font = @font_repository.get_font fam.name
121
-
122
- sample_cov = font.coverage_summary script.sample_string
123
- mostly = [:none, :fallback, :approximate, :exact].max_by { |i| sample_cov[i] }
124
-
125
- if mostly == :exact
126
- row = scriptmodel.append
127
- scriptmodel.set_value row, 0, fam.name
128
- end
129
- end
130
- end
21
+ myapp.menubar = menu
22
+ end
131
23
 
132
- def run
133
- Gtk.main
134
- end
135
- end
24
+ myapp.signal_connect "activate" do |app, _user_data|
25
+ @app ||= Phew::Application.new(app)
26
+ @app.present
136
27
  end
137
28
 
138
- Phew::Application.new.run
29
+ exit(myapp.run([$PROGRAM_NAME] + ARGV))
@@ -0,0 +1,118 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "gir_ffi-gtk3"
4
+
5
+ require "phew/font_repository"
6
+ require "phew/script"
7
+ require "phew/script_list"
8
+
9
+ module Phew
10
+ # Main Phew application.
11
+ class Application
12
+ def initialize(gtk_application)
13
+ @gtk_application = gtk_application
14
+ @context = Gdk.pango_context_get
15
+ @font_repository = FontRepository.new @context
16
+ connect_signals
17
+ end
18
+
19
+ def present
20
+ win.show_all
21
+ win.children.first.visible = false if win.show_menubar
22
+ win.present
23
+ end
24
+
25
+ private
26
+
27
+ def combo
28
+ @combo ||= ScriptList.new.tap(&:fill)
29
+ end
30
+
31
+ def textview
32
+ @textview ||= Gtk::TextView.new
33
+ end
34
+
35
+ def build_vbox
36
+ vbox = Gtk::VBox.new false, 0
37
+
38
+ vbox.pack_start combo, false, false, 0
39
+ vbox.pack_start textview, false, false, 0
40
+ vbox.pack_start script_list_scroller, true, true, 0
41
+ vbox
42
+ end
43
+
44
+ def vbox
45
+ @vbox ||= build_vbox
46
+ end
47
+
48
+ def script_list_scroller
49
+ @script_list_scroller ||= Gtk::ScrolledWindow.new(nil, nil).tap do |scr|
50
+ lst = script_list
51
+ scr.add lst
52
+ lst.hadjustment = scr.hadjustment
53
+ lst.vadjustment = scr.vadjustment
54
+ end
55
+ end
56
+
57
+ def script_list
58
+ @script_list ||= Gtk::TreeView.new_with_model(scriptmodel).tap do |view|
59
+ renderer = Gtk::CellRendererText.new
60
+ col = Gtk::TreeViewColumn.new
61
+ col.set_title "Font Name"
62
+ col.pack_start renderer, true
63
+ col.add_attribute renderer, "text", 0
64
+ view.append_column col
65
+ end
66
+ end
67
+
68
+ def scriptmodel
69
+ @scriptmodel ||= Gtk::ListStore.new [GObject::TYPE_STRING]
70
+ end
71
+
72
+ def build_win
73
+ win = Gtk::ApplicationWindow.new @gtk_application
74
+ win.add vbox
75
+ win
76
+ end
77
+
78
+ def win
79
+ @win ||= build_win
80
+ end
81
+
82
+ # Set up all signal handlers
83
+ def connect_signals
84
+ combo.signal_connect("changed") { on_combo_changed_signal }
85
+ end
86
+
87
+ def on_combo_changed_signal
88
+ script = Script.new combo.active_text.to_sym
89
+ # FIXME: Add override for Gtk::TextBuffer.set_text so #text= works properly
90
+ textview.buffer.set_text script.sample_string, -1
91
+ fill_font_list script
92
+ end
93
+
94
+ def fill_font_list(script)
95
+ scriptmodel.clear
96
+
97
+ font_families.each do |fam|
98
+ font = @font_repository.get_font fam.name
99
+
100
+ if sample_coverage(font, script) == :exact
101
+ row = scriptmodel.append
102
+ scriptmodel.set_value row, 0, fam.name
103
+ end
104
+ end
105
+ end
106
+
107
+ def sample_coverage(font, script)
108
+ sample_cov = font.coverage_summary script.sample_string
109
+ [:none, :fallback, :approximate, :exact].max_by { |i| sample_cov[i] }
110
+ end
111
+
112
+ def font_families
113
+ fontmap = @context.get_font_map
114
+
115
+ fontmap.list_families
116
+ end
117
+ end
118
+ end
data/lib/phew/font.rb CHANGED
@@ -1,3 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "gir_ffi-pango"
4
+
1
5
  module Phew
2
6
  # Font family. Handles coverage, among other things.
3
7
  class Font
@@ -6,8 +10,9 @@ module Phew
6
10
  #
7
11
  # @param [Pango::Context] context Pango context to retrieve font from.
8
12
  # @param [String] text_description Description of the font to create.
9
- def initialize context, text_description
13
+ def initialize(context, text_description)
10
14
  fd = Pango::FontDescription.from_string text_description
15
+ fd.size = 10
11
16
  fontmap = context.get_font_map
12
17
  @font = fontmap.load_font context, fd
13
18
  end
@@ -16,12 +21,11 @@ module Phew
16
21
  #
17
22
  # @return A hash with keys :none, :fallback, :approximate, :exact, and values
18
23
  # indicating the number of characters in the text that have that coverage.
19
- def coverage_summary text
24
+ def coverage_summary(text)
20
25
  lang = Pango::Language.new
21
26
  cov = @font.get_coverage lang
22
27
  text_cov = text.each_codepoint.map { |cp| cov.get cp }
23
- Hash[
24
- Pango::CoverageLevel::Enum.symbols.map { |lvl| [lvl, text_cov.count(lvl)] }]
28
+ Pango::CoverageLevel::Enum.symbols.to_h { |lvl| [lvl, text_cov.count(lvl)] }
25
29
  end
26
30
  end
27
31
  end
@@ -1,16 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "phew/font"
4
+
1
5
  module Phew
2
6
  # Cache for font information retrieved from a Pango context
3
7
  class FontRepository
4
8
  # @param [Pango::Context] context Pango context to retrieve fonts from.
5
- def initialize context
9
+ def initialize(context)
6
10
  @store = {}
7
11
  @context = context
8
12
  end
13
+
9
14
  # Retrieve a font based on the given text description. The text description
10
15
  # should be in the format accepted by Font#new.
11
16
  #
12
17
  # @param [String] text_description Description of the font to retrieve.
13
- def get_font text_description
18
+ def get_font(text_description)
14
19
  @store[text_description] ||= Font.new @context, text_description
15
20
  end
16
21
  end
data/lib/phew/script.rb CHANGED
@@ -1,7 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "gir_ffi-pango"
4
+
1
5
  module Phew
2
6
  # A script.
3
7
  class Script
4
- def initialize name
8
+ def initialize(name)
5
9
  symbol = name.to_sym
6
10
  @symbol = symbol
7
11
  @lang = Pango.script_get_sample_language symbol
@@ -9,7 +13,7 @@ module Phew
9
13
 
10
14
  def sample_string
11
15
  if @lang.nil?
12
- 'No sample available'
16
+ "No sample available"
13
17
  else
14
18
  @lang.get_sample_string
15
19
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "gir_ffi-gtk3"
4
+ require "gir_ffi-pango"
5
+
6
+ module Phew
7
+ # Drop-down list of available scripts.
8
+ class ScriptList < Gtk::ComboBoxText
9
+ # FIXME: Should be able to fill inside #initialize
10
+ def fill
11
+ Pango::Script::Enum.symbols
12
+ .map(&:to_s)
13
+ .each { |str| append str, str }
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Phew
4
+ VERSION = "0.0.6"
5
+ end
data/lib/phew.rb CHANGED
@@ -1,6 +1,4 @@
1
- require 'gir_ffi-gtk3'
2
- require 'gir_ffi-pango'
1
+ # frozen_string_literal: true
3
2
 
4
- require 'phew/script'
5
- require 'phew/font'
6
- require 'phew/font_repository'
3
+ require "phew/application"
4
+ require "phew/version"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phew
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matijs van Zuijlen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-20 00:00:00.000000000 Z
11
+ date: 2022-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gir_ffi-gtk
@@ -16,120 +16,183 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.8.0
19
+ version: 0.15.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.8.0
26
+ version: 0.15.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: gir_ffi-pango
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.6
33
+ version: 0.0.15
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.0.6
40
+ version: 0.0.15
41
41
  - !ruby/object:Gem::Dependency
42
- name: rake
42
+ name: atspi_app_driver
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.1'
47
+ version: 0.7.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.1'
54
+ version: 0.7.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '5.5'
61
+ version: '5.12'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '5.5'
68
+ version: '5.12'
69
69
  - !ruby/object:Gem::Dependency
70
- name: atspi_app_driver
70
+ name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '='
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.0.2
75
+ version: 0.14.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '='
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.14.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '13.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '13.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake-manifest
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.2.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.2.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.25.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.25.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-minitest
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.17.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 0.17.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop-performance
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 1.13.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
81
151
  - !ruby/object:Gem::Version
82
- version: 0.0.2
152
+ version: 1.13.0
83
153
  description: List and compare installed fonts on GNOME
84
154
  email:
85
155
  - matijs@matijs.net
86
- executables: []
156
+ executables:
157
+ - phew
87
158
  extensions: []
88
159
  extra_rdoc_files: []
89
160
  files:
90
161
  - COPYING
91
- - Gemfile
92
162
  - README.md
93
- - Rakefile
94
163
  - bin/phew
95
- - doc/character_map.png
96
- - doc/fontviewer.gif
97
- - doc/gfontview.png
98
- - doc/gnome_specimen.png
99
- - doc/prior-art.md
100
- - doc/waterfall.png
101
164
  - lib/phew.rb
165
+ - lib/phew/application.rb
102
166
  - lib/phew/font.rb
103
167
  - lib/phew/font_repository.rb
104
168
  - lib/phew/script.rb
105
- - test/end_to_end/basic_run_test.rb
106
- - test/test_helper.rb
107
- - test/unit/font_repository_test.rb
108
- - test/unit/font_test.rb
169
+ - lib/phew/script_list.rb
170
+ - lib/phew/version.rb
109
171
  homepage: http://www.github.com/mvz/phew-font-viewer
110
172
  licenses:
111
173
  - GPL-3
112
- metadata: {}
113
- post_install_message:
174
+ metadata:
175
+ rubygems_mfa_required: 'true'
176
+ post_install_message:
114
177
  rdoc_options:
115
178
  - "--main"
116
179
  - README.md
117
180
  require_paths:
118
181
  - lib
182
+ - lib
119
183
  required_ruby_version: !ruby/object:Gem::Requirement
120
184
  requirements:
121
185
  - - ">="
122
186
  - !ruby/object:Gem::Version
123
- version: 1.9.3
187
+ version: 2.6.0
124
188
  required_rubygems_version: !ruby/object:Gem::Requirement
125
189
  requirements:
126
190
  - - ">="
127
191
  - !ruby/object:Gem::Version
128
192
  version: '0'
129
193
  requirements: []
130
- rubyforge_project:
131
- rubygems_version: 2.4.5.1
132
- signing_key:
194
+ rubygems_version: 3.3.3
195
+ signing_key:
133
196
  specification_version: 4
134
197
  summary: A GNOME Font Viewer
135
198
  test_files: []
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # The gem's dependencies are specified in the gemspec
4
- gemspec
5
-
6
- gem 'pry', '~> 0.10.0', type: :development
data/Rakefile DELETED
@@ -1,25 +0,0 @@
1
- require 'rake/clean'
2
- require 'bundler/gem_helper'
3
- require 'rake/testtask'
4
-
5
- Bundler::GemHelper.install_tasks
6
-
7
- namespace :test do
8
- Rake::TestTask.new(:unit) do |t|
9
- t.libs = ['lib']
10
- t.test_files = FileList['test/unit/*_test.rb']
11
- t.warning = true
12
- end
13
-
14
- Rake::TestTask.new(:end_to_end) do |t|
15
- t.libs = ['lib']
16
- t.test_files = FileList['test/end_to_end/*_test.rb']
17
- t.warning = true
18
- end
19
-
20
- task all: [:unit, :end_to_end]
21
- end
22
-
23
- task test: 'test:all'
24
-
25
- task default: 'test'
Binary file
data/doc/fontviewer.gif DELETED
Binary file
data/doc/gfontview.png DELETED
Binary file
Binary file
data/doc/prior-art.md DELETED
@@ -1,40 +0,0 @@
1
- # Prior Art
2
-
3
- ## Font Viewer
4
-
5
- [Website](http://fontviewer.net/)
6
-
7
- ![FontViewer screen shot](fontviewer.gif)
8
-
9
- Pleasantly sparse interface with obnoxious branding.
10
-
11
- The grid display of different font weights is a nice touch.
12
-
13
- ## GFontView
14
-
15
- [Website](http://gfontview.sourceforge.net/)
16
-
17
- ![GFontView screen shot](gfontview.png)
18
-
19
- Based on files rather than installed fonts.
20
-
21
- Only shows one font at a time.
22
-
23
- ## Gnome Specimen
24
-
25
- ![Specimen screen shot](gnome_specimen.png)
26
-
27
- Clean interface. Does not allow filtering by desired script or text.
28
-
29
-
30
- ## Waterfall
31
-
32
- ![Waterfall screen shot](waterfall.png)
33
-
34
- Allows easy switching between different parts of the character set.
35
-
36
- ## Character Map
37
-
38
- ![Character map screen shot](character_map.png)
39
-
40
- A different way of selecting scripts. Nice balanced UI.
data/doc/waterfall.png DELETED
Binary file
@@ -1,53 +0,0 @@
1
- require_relative '../test_helper'
2
- require 'atspi_app_driver'
3
-
4
- # Test driver for the Phew application.
5
- class PhewDriver < AtspiAppDriver
6
- def initialize
7
- verbose = ENV['VERBOSE'] == 'true'
8
- super 'phew', verbose: verbose
9
- end
10
- end
11
-
12
- describe 'The Phew application' do
13
- before do
14
- @driver = PhewDriver.new
15
- @driver.boot
16
- end
17
-
18
- it 'starts and can be quit with Ctrl-q' do
19
- sleep 0.05
20
- @driver.press_ctrl_q
21
-
22
- status = @driver.cleanup
23
- status.exitstatus.must_equal 0
24
- end
25
-
26
- it 'shows a dropdown list of scripts' do
27
- frame = @driver.frame
28
-
29
- box = frame.find_role :combo_box
30
-
31
- latin = box.find_role :menu_item, /latin/
32
- latin.wont_be_nil
33
-
34
- textbox = frame.find_role :text
35
- textbox.wont_be_nil
36
- textbox.get_text(0, 100).must_equal ''
37
-
38
- box.get_action_name(0).must_equal 'press'
39
- box.do_action 0
40
- latin.get_action_name(0).must_equal 'click'
41
- latin.do_action 0
42
-
43
- textbox.get_text(0, 100).must_equal 'The quick brown fox jumps over the lazy dog.'
44
-
45
- @driver.press_ctrl_q
46
- status = @driver.cleanup
47
- status.exitstatus.must_equal 0
48
- end
49
-
50
- after do
51
- @driver.cleanup
52
- end
53
- end
data/test/test_helper.rb DELETED
@@ -1,6 +0,0 @@
1
- require 'minitest/autorun'
2
-
3
- require 'phew'
4
-
5
- # Gtk must be initialized for all the font retrieval methods to work.
6
- Gtk.init
@@ -1,20 +0,0 @@
1
- require_relative '../test_helper'
2
-
3
- describe Phew::FontRepository do
4
- describe '#get_font' do
5
- it 'returns an instance of Phew::Font' do
6
- ctx = Gdk.pango_context_get
7
- repo = Phew::FontRepository.new ctx
8
- font = repo.get_font 'Sans'
9
- font.must_be_instance_of Phew::Font
10
- end
11
-
12
- it 'returns the same object if called again with the same description' do
13
- ctx = Gdk.pango_context_get
14
- repo = Phew::FontRepository.new ctx
15
- font = repo.get_font 'Sans'
16
- font_again = repo.get_font 'Sans'
17
- font_again.must_be_same_as font
18
- end
19
- end
20
- end
@@ -1,17 +0,0 @@
1
- require_relative '../test_helper'
2
-
3
- describe Phew::Font do
4
- describe '#coverage_summary' do
5
- it 'returns summarized coverage information for the given string' do
6
- ctx = Gdk.pango_context_get
7
-
8
- pfont = Phew::Font.new ctx, 'Sans'
9
-
10
- test_string = 'This is a test'
11
- sum = pfont.coverage_summary test_string
12
-
13
- sum.keys.sort.must_equal [:none, :fallback, :approximate, :exact].sort
14
- sum.values.inject(:+).must_equal test_string.size
15
- end
16
- end
17
- end