gir_ffi-pango 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +5 -3
- data/lib/gir_ffi-pango.rb +2 -0
- data/lib/gir_ffi-pango/font.rb +3 -1
- data/lib/gir_ffi-pango/language.rb +6 -4
- data/test/end_to_end/context_test.rb +4 -2
- data/test/end_to_end/font_test.rb +4 -3
- data/test/test_helper.rb +2 -0
- data/test/unit/font_test.rb +6 -4
- data/test/unit/language_test.rb +6 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b6da05be9fc728d8657aaa69a34477df3464478d2edb60068ef5ec6864ac3af
|
4
|
+
data.tar.gz: b7aadbf4380b6027406c0fb760725bcc3c9ba99c72b5a0bda075f5d504d261e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 708cb6026a04690d9fda8c40e9a6e6460d12f2236096685945006d17744f267cdc99208214355ed7994f811f8a2713283241c47038e7818d1a72e20834414f11
|
7
|
+
data.tar.gz: 2720d2cf56dd733a02c1982151c4fc33a9c6c5829ddb5f1ad128fe9af8fcc6099e9b5b15144ac23e0424abbb3ce3ef6be073c68b70c24843b39b3b11ba929d28
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rake/testtask'
|
2
4
|
require 'bundler/gem_helper'
|
3
5
|
|
@@ -16,9 +18,9 @@ namespace :test do
|
|
16
18
|
t.warning = true
|
17
19
|
end
|
18
20
|
|
19
|
-
task :
|
21
|
+
task all: [:unit, :end_to_end]
|
20
22
|
end
|
21
23
|
|
22
|
-
task :
|
24
|
+
task test: 'test:all'
|
23
25
|
|
24
|
-
task :
|
26
|
+
task default: 'test'
|
data/lib/gir_ffi-pango.rb
CHANGED
data/lib/gir_ffi-pango/font.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Pango
|
2
4
|
load_class :Language
|
3
5
|
|
4
6
|
class Language
|
5
|
-
setup_instance_method
|
7
|
+
setup_instance_method 'get_scripts'
|
6
8
|
|
7
9
|
def get_scripts_with_override
|
8
|
-
result =
|
9
|
-
|
10
|
+
result = get_scripts_without_override
|
11
|
+
case result
|
12
|
+
when GirFFI::SizedArray
|
10
13
|
result
|
11
14
|
else
|
12
15
|
ptr, size = *result
|
@@ -18,4 +21,3 @@ module Pango
|
|
18
21
|
alias get_scripts get_scripts_with_override
|
19
22
|
end
|
20
23
|
end
|
21
|
-
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
|
2
4
|
|
3
5
|
describe Pango::Context do
|
4
|
-
describe
|
5
|
-
it
|
6
|
+
describe '#get_font_map' do
|
7
|
+
it 'returns a descendant from Pango::FontMap' do
|
6
8
|
ctx = Gdk.pango_context_get
|
7
9
|
result = ctx.get_font_map
|
8
10
|
result.class.ancestors.must_include Pango::FontMap
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
|
2
4
|
|
3
5
|
describe Pango::Font do
|
4
|
-
it
|
6
|
+
it 'allows retrieval of coverage information' do
|
5
7
|
ctx = Gdk.pango_context_get
|
6
8
|
|
7
9
|
fontmap = ctx.get_font_map
|
@@ -11,11 +13,10 @@ describe Pango::Font do
|
|
11
13
|
lang = Pango::Language.from_string 'en'
|
12
14
|
cov = fnt.get_coverage lang
|
13
15
|
|
14
|
-
clist =
|
16
|
+
clist = 'Hello Pango!'.each_char.map { |ch| cov.get ch[0].ord }
|
15
17
|
|
16
18
|
clist.uniq.each do |cval|
|
17
19
|
[:none, :fallback, :approximate, :exact].must_include cval
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
21
|
-
|
data/test/test_helper.rb
CHANGED
data/test/unit/font_test.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
|
2
4
|
|
3
5
|
describe Pango::Font do
|
@@ -8,18 +10,18 @@ describe Pango::Font do
|
|
8
10
|
@fnt = fontmap.load_font ctx, fd
|
9
11
|
end
|
10
12
|
|
11
|
-
describe
|
13
|
+
describe '#get_coverage' do
|
12
14
|
before do
|
13
15
|
lang = Pango::Language.from_string 'en'
|
14
16
|
@cov = @fnt.get_coverage lang
|
15
17
|
end
|
16
18
|
|
17
|
-
it
|
19
|
+
it 'returns an instance of Pango::Coverage' do
|
18
20
|
@cov.must_be_instance_of Pango::Coverage
|
19
21
|
end
|
20
22
|
|
21
|
-
it
|
22
|
-
@cov.get(
|
23
|
+
it 'returns valid coverage info' do
|
24
|
+
@cov.get(' '[0].ord).must_equal :exact
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
data/test/unit/language_test.rb
CHANGED
@@ -1,20 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
|
2
4
|
|
3
5
|
describe Pango::Language do
|
4
|
-
it
|
6
|
+
it 'creates an instance with .from_string' do
|
5
7
|
lang = Pango::Language.from_string 'en'
|
6
8
|
lang.wont_be_nil
|
7
9
|
lang.must_be_instance_of Pango::Language
|
8
10
|
end
|
9
11
|
|
10
|
-
describe
|
11
|
-
it
|
12
|
+
describe '#get_scripts' do
|
13
|
+
it 'returns an enumerable of symbols representing scripts' do
|
12
14
|
lang = Pango::Language.from_string 'ja'
|
13
15
|
scripts = lang.get_scripts
|
14
16
|
scripts.to_a.must_equal [:han, :katakana, :hiragana]
|
15
17
|
end
|
16
18
|
|
17
|
-
it
|
19
|
+
it 'can safely be run twice' do
|
18
20
|
lang = Pango::Language.from_string 'en'
|
19
21
|
|
20
22
|
result = lang.get_scripts
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gir_ffi-pango
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matijs van Zuijlen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gir_ffi
|