alexandria-book-collection-manager 0.7.2 → 0.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +9 -0
- data/.github/workflows/ruby.yml +77 -0
- data/.gitignore +5 -1
- data/.hound.yml +2 -0
- data/.rubocop.yml +87 -37
- data/.rubocop_todo.yml +62 -191
- data/.simplecov +5 -2
- data/CHANGELOG.md +63 -0
- data/Gemfile +4 -3
- data/INSTALL.md +26 -14
- data/README.md +52 -42
- data/Rakefile +93 -109
- data/TODO.md +9 -1
- data/alexandria-book-collection-manager.gemspec +50 -43
- data/bin/alexandria +30 -53
- data/doc/FAQ +2 -6
- data/doc/dependency_decisions.yml +27 -8
- data/lib/alexandria.rb +27 -37
- data/lib/alexandria/about.rb +50 -50
- data/lib/alexandria/book_providers.rb +90 -97
- data/lib/alexandria/book_providers/adlibris.rb +41 -76
- data/lib/alexandria/book_providers/amazon_aws.rb +96 -100
- data/lib/alexandria/book_providers/amazon_ecs_util.rb +295 -322
- data/lib/alexandria/book_providers/barnes_and_noble.rb +48 -45
- data/lib/alexandria/book_providers/douban.rb +26 -42
- data/lib/alexandria/book_providers/proxis.rb +44 -55
- data/lib/alexandria/book_providers/pseudomarc.rb +77 -85
- data/lib/alexandria/book_providers/siciliano.rb +64 -65
- data/lib/alexandria/book_providers/thalia.rb +42 -41
- data/lib/alexandria/book_providers/web.rb +15 -33
- data/lib/alexandria/book_providers/worldcat.rb +70 -97
- data/lib/alexandria/book_providers/z3950.rb +160 -173
- data/lib/alexandria/config.rb +1 -1
- data/lib/alexandria/console.rb +8 -21
- data/lib/alexandria/default_preferences.rb +37 -0
- data/lib/alexandria/execution_queue.rb +15 -13
- data/lib/alexandria/export_format.rb +47 -0
- data/lib/alexandria/export_library.rb +193 -300
- data/lib/alexandria/import_library.rb +108 -141
- data/lib/alexandria/import_library_csv.rb +43 -46
- data/lib/alexandria/library_collection.rb +79 -0
- data/lib/alexandria/library_sort_order.rb +45 -0
- data/lib/alexandria/library_store.rb +233 -0
- data/lib/alexandria/logging.rb +11 -13
- data/lib/alexandria/models/book.rb +13 -20
- data/lib/alexandria/models/library.rb +81 -353
- data/lib/alexandria/net.rb +5 -6
- data/lib/alexandria/preferences.rb +73 -87
- data/lib/alexandria/scanners.rb +2 -2
- data/lib/alexandria/scanners/{cuecat.rb → cue_cat.rb} +20 -18
- data/lib/alexandria/scanners/keyboard.rb +8 -8
- data/lib/alexandria/smart_library.rb +133 -170
- data/lib/alexandria/ui.rb +15 -15
- data/lib/alexandria/ui/about_dialog.rb +49 -0
- data/lib/alexandria/ui/{dialogs/acquire_dialog.rb → acquire_dialog.rb} +119 -136
- data/lib/alexandria/ui/alert_dialog.rb +64 -0
- data/lib/alexandria/ui/bad_isbns_dialog.rb +41 -0
- data/lib/alexandria/ui/{dialogs/barcode_animation.rb → barcode_animation.rb} +16 -15
- data/lib/alexandria/ui/{dialogs/book_properties_dialog.rb → book_properties_dialog.rb} +39 -52
- data/lib/alexandria/ui/book_properties_dialog_base.rb +318 -0
- data/lib/alexandria/ui/builder_base.rb +7 -27
- data/lib/alexandria/ui/calendar_popup.rb +58 -0
- data/lib/alexandria/ui/callbacks.rb +189 -183
- data/lib/alexandria/ui/completion_models.rb +10 -23
- data/lib/alexandria/ui/confirm_erase_dialog.rb +33 -0
- data/lib/alexandria/ui/conflict_while_copying_dialog.rb +34 -0
- data/lib/alexandria/ui/dndable.rb +7 -7
- data/lib/alexandria/ui/error_dialog.rb +25 -0
- data/lib/alexandria/ui/export_dialog.rb +142 -0
- data/lib/alexandria/ui/icons.rb +47 -63
- data/lib/alexandria/ui/iconview.rb +12 -10
- data/lib/alexandria/ui/iconview_tooltips.rb +41 -54
- data/lib/alexandria/ui/import_dialog.rb +157 -0
- data/lib/alexandria/ui/init.rb +21 -33
- data/lib/alexandria/ui/keep_bad_isbn_dialog.rb +36 -0
- data/lib/alexandria/ui/libraries_combo.rb +16 -14
- data/lib/alexandria/ui/listview.rb +73 -87
- data/lib/alexandria/ui/main_app.rb +24 -26
- data/lib/alexandria/ui/misc_dialogs.rb +10 -0
- data/lib/alexandria/ui/multi_drag_treeview.rb +28 -41
- data/lib/alexandria/ui/{dialogs/new_book_dialog.rb → new_book_dialog.rb} +156 -194
- data/lib/alexandria/ui/new_book_dialog_manual.rb +139 -0
- data/lib/alexandria/ui/new_provider_dialog.rb +100 -0
- data/lib/alexandria/ui/new_smart_library_dialog.rb +74 -0
- data/lib/alexandria/ui/preferences_dialog.rb +313 -0
- data/lib/alexandria/ui/provider_preferences_base_dialog.rb +95 -0
- data/lib/alexandria/ui/provider_preferences_dialog.rb +35 -0
- data/lib/alexandria/ui/really_delete_dialog.rb +53 -0
- data/lib/alexandria/ui/{sidepane.rb → sidepane_manager.rb} +56 -68
- data/lib/alexandria/ui/skip_entry_dialog.rb +33 -0
- data/lib/alexandria/ui/smart_library_properties_dialog.rb +60 -0
- data/lib/alexandria/ui/smart_library_properties_dialog_base.rb +242 -0
- data/lib/alexandria/ui/smart_library_rule_box.rb +119 -0
- data/lib/alexandria/ui/sound.rb +11 -13
- data/lib/alexandria/ui/ui_manager.rb +236 -251
- data/lib/alexandria/undo_manager.rb +1 -0
- data/lib/alexandria/version.rb +4 -19
- data/lib/alexandria/web_themes.rb +22 -21
- data/po/Makefile +2 -2
- data/po/cs.po +993 -880
- data/po/cy.po +957 -874
- data/po/de.po +990 -869
- data/po/el.po +989 -869
- data/po/es.po +985 -865
- data/po/fr.po +986 -870
- data/po/ga.po +907 -823
- data/po/gl.po +981 -865
- data/po/it.po +986 -868
- data/po/ja.po +969 -853
- data/po/mk.po +983 -863
- data/po/nb.po +979 -863
- data/po/nl.po +983 -864
- data/po/pl.po +1017 -974
- data/po/pt.po +988 -861
- data/po/pt_BR.po +984 -868
- data/po/ru.po +992 -873
- data/po/sk.po +987 -869
- data/po/sv.po +977 -861
- data/po/uk.po +975 -865
- data/po/zh_TW.po +976 -860
- data/schemas/alexandria.schemas +25 -3
- data/share/alexandria/glade/acquire_dialog__builder.glade +15 -12
- data/share/alexandria/glade/book_properties_dialog__builder.glade +171 -299
- data/share/alexandria/glade/main_app__builder.glade +24 -33
- data/share/alexandria/glade/new_book_dialog__builder.glade +27 -59
- data/share/alexandria/glade/preferences_dialog__builder.glade +250 -290
- data/share/gnome/help/alexandria/C/introduction.xml +0 -8
- data/share/gnome/help/alexandria/C/searching.xml +1 -1
- data/share/gnome/help/alexandria/C/smart-libraries.xml +2 -2
- data/share/gnome/help/alexandria/C/working-with-libraries.xml +1 -1
- data/share/gnome/help/alexandria/fr/alexandria.xml +1 -1
- data/share/gnome/help/alexandria/ja/introduction.xml +0 -8
- data/share/gnome/help/alexandria/ja/smart-libraries.xml +1 -1
- data/spec/alexandria/book_providers/world_cat_provider_spec.rb +160 -0
- data/spec/alexandria/book_providers_spec.rb +75 -171
- data/spec/alexandria/book_spec.rb +12 -10
- data/spec/alexandria/console_spec.rb +27 -0
- data/spec/alexandria/export_library_spec.rb +130 -0
- data/spec/alexandria/library_spec.rb +128 -172
- data/spec/alexandria/library_store_spec.rb +37 -0
- data/spec/alexandria/preferences_spec.rb +44 -17
- data/spec/alexandria/scanners/cue_cat_spec.rb +52 -0
- data/spec/alexandria/smart_library_spec.rb +30 -25
- data/spec/alexandria/ui/about_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/acquire_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/alert_dialog_spec.rb +16 -0
- data/spec/alexandria/ui/bad_isbns_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/book_properties_dialog_spec.rb +17 -0
- data/spec/alexandria/ui/confirm_erase_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/conflict_while_copying_dialog_spec.rb +16 -0
- data/spec/alexandria/ui/error_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/export_dialog_spec.rb +36 -0
- data/spec/alexandria/ui/icons_spec.rb +26 -0
- data/spec/alexandria/ui/iconview_spec.rb +7 -21
- data/spec/alexandria/ui/import_dialog_spec.rb +46 -0
- data/spec/alexandria/ui/keep_bad_isbn_dialog_spec.rb +17 -0
- data/spec/alexandria/ui/main_app_spec.rb +7 -34
- data/spec/alexandria/ui/new_book_dialog_manual_spec.rb +15 -0
- data/spec/alexandria/ui/new_book_dialog_spec.rb +22 -0
- data/spec/alexandria/ui/new_provider_dialog_spec.rb +30 -0
- data/spec/alexandria/ui/new_smart_library_dialog_spec.rb +39 -0
- data/spec/alexandria/ui/preferences_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/provider_preferences_dialog_spec.rb +34 -0
- data/spec/alexandria/ui/really_delete_dialog_spec.rb +16 -0
- data/spec/alexandria/ui/sidepane_manager_spec.rb +15 -0
- data/spec/alexandria/ui/skip_entry_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/smart_library_properties_dialog_spec.rb +49 -0
- data/spec/alexandria/ui/sound_spec.rb +2 -2
- data/spec/alexandria/ui/ui_manager_spec.rb +43 -20
- data/spec/end_to_end/basic_run_spec.rb +52 -0
- data/spec/spec_helper.rb +65 -33
- data/tasks/setup.rb +2 -2
- data/tasks/spec.rake +16 -3
- data/util/rake/fileinstall.rb +39 -35
- data/util/rake/gettextgenerate.rb +7 -7
- data/util/rake/omfgenerate.rb +7 -7
- metadata +178 -45
- data/dogtail/basic_run_test.py +0 -9
- data/lib/alexandria/book_providers/deastore.rb +0 -265
- data/lib/alexandria/book_providers/mcu.rb +0 -182
- data/lib/alexandria/book_providers/renaud.rb +0 -149
- data/lib/alexandria/ui/dialogs/about_dialog.rb +0 -61
- data/lib/alexandria/ui/dialogs/alert_dialog.rb +0 -72
- data/lib/alexandria/ui/dialogs/bad_isbns_dialog.rb +0 -51
- data/lib/alexandria/ui/dialogs/book_properties_dialog_base.rb +0 -426
- data/lib/alexandria/ui/dialogs/export_dialog.rb +0 -171
- data/lib/alexandria/ui/dialogs/import_dialog.rb +0 -196
- data/lib/alexandria/ui/dialogs/misc_dialogs.rb +0 -87
- data/lib/alexandria/ui/dialogs/new_book_dialog_manual.rb +0 -154
- data/lib/alexandria/ui/dialogs/new_smart_library_dialog.rb +0 -74
- data/lib/alexandria/ui/dialogs/preferences_dialog.rb +0 -568
- data/lib/alexandria/ui/dialogs/smart_library_properties_dialog.rb +0 -59
- data/lib/alexandria/ui/dialogs/smart_library_properties_dialog_base.rb +0 -420
- data/spec/alexandria/scanners/cuecat_spec.rb +0 -67
- data/spec/alexandria/ui/dialogs_spec.rb +0 -96
- data/spec/alexandria/ui/sidepane_spec.rb +0 -29
- data/spec/alexandria/ui/ui_utilities_spec.rb +0 -62
- data/spec/alexandria/utilities_spec.rb +0 -52
- data/tasks/dogtail.rake +0 -6
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is part of Alexandria.
|
4
|
+
#
|
5
|
+
# See the file README.md for authorship and licensing information.
|
6
|
+
|
7
|
+
require "spec_helper"
|
8
|
+
|
9
|
+
RSpec.describe Alexandria::LibraryStore do
|
10
|
+
let(:loader) { described_class.new(TESTDIR) }
|
11
|
+
|
12
|
+
describe "#load_all_smart_libraries" do
|
13
|
+
context "when none exist" do
|
14
|
+
it "creates and saves some" do
|
15
|
+
smart_libs = loader.load_all_smart_libraries
|
16
|
+
aggregate_failures do
|
17
|
+
expect(smart_libs.size).to eq 5
|
18
|
+
smart_libs.each do |lib|
|
19
|
+
expect(File.exist?(lib.yaml)).to be_truthy
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "when one exists" do
|
26
|
+
it "returns the existing smart library" do
|
27
|
+
existing = Alexandria::SmartLibrary.new("Hi", [], :all, loader)
|
28
|
+
existing.save
|
29
|
+
smart_libs = loader.load_all_smart_libraries
|
30
|
+
aggregate_failures do
|
31
|
+
expect(smart_libs.size).to eq 1
|
32
|
+
expect(smart_libs.first.yaml).to eq existing.yaml
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -1,24 +1,51 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
3
|
+
# This file is part of Alexandria.
|
4
4
|
#
|
5
|
-
#
|
6
|
-
# modify it under the terms of the GNU General Public License as
|
7
|
-
# published by the Free Software Foundation; either version 2 of the
|
8
|
-
# License, or (at your option) any later version.
|
9
|
-
#
|
10
|
-
# Alexandria is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
-
# General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU General Public
|
16
|
-
# License along with Alexandria; see the file COPYING. If not,
|
17
|
-
# write to the Free Software Foundation, Inc., 51 Franklin Street,
|
18
|
-
# Fifth Floor, Boston, MA 02110-1301 USA.
|
5
|
+
# See the file README.md for authorship and licensing information.
|
19
6
|
|
20
|
-
|
7
|
+
require_relative "../spec_helper"
|
21
8
|
|
22
9
|
describe Alexandria::Preferences do
|
23
|
-
|
10
|
+
let(:instance) { described_class.instance }
|
11
|
+
|
12
|
+
describe "#get_variable" do
|
13
|
+
it "returns nil fetching unknown setting" do
|
14
|
+
expect(instance.get_variable("does_not_exist")).to eq nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it "allows fetching by string" do
|
18
|
+
instance.toolbar_visible = false
|
19
|
+
expect(instance.get_variable("toolbar_visible")).to eq false
|
20
|
+
end
|
21
|
+
|
22
|
+
it "allows fetching by symbol" do
|
23
|
+
instance.toolbar_visible = true
|
24
|
+
expect(instance.get_variable(:toolbar_visible)).to eq true
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#set_variable" do
|
29
|
+
it "allows setting by string" do
|
30
|
+
instance.toolbar_visible = false
|
31
|
+
instance.set_variable("toolbar_visible", true)
|
32
|
+
expect(instance.toolbar_visible).to eq true
|
33
|
+
end
|
34
|
+
|
35
|
+
it "allows setting by symbol" do
|
36
|
+
instance.toolbar_visible = false
|
37
|
+
instance.set_variable(:toolbar_visible, true)
|
38
|
+
expect(instance.toolbar_visible).to eq true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
it "allows setting known setting to false" do
|
43
|
+
instance.toolbar_visible = false
|
44
|
+
expect(instance.toolbar_visible).to eq false
|
45
|
+
end
|
46
|
+
|
47
|
+
it "resets known setting by setting to nil" do
|
48
|
+
instance.toolbar_visible = nil
|
49
|
+
expect(instance.toolbar_visible).to eq true
|
50
|
+
end
|
24
51
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is part of Alexandria.
|
4
|
+
#
|
5
|
+
# See the file README.md for authorship and licensing information.
|
6
|
+
|
7
|
+
require_relative "../../spec_helper"
|
8
|
+
|
9
|
+
describe Alexandria::Scanners::CueCat do
|
10
|
+
let(:cuecat) { described_class.new }
|
11
|
+
let(:partials) do
|
12
|
+
[".",
|
13
|
+
".C3nZC3nZC3n2ChnWENz7DxnY",
|
14
|
+
".C3nZC3nZC3n2ChnWENz7DxnY.",
|
15
|
+
".C3nZC3nZC3n2ChnWENz7DxnY.cGen",
|
16
|
+
".C3nZC3nZC3n2ChnWENz7DxnY.cGen.",
|
17
|
+
".C3nZC3nZC3n2ChnWENz7DxnY.cGen.ENr7C3z0CNj3Dhj1EW"]
|
18
|
+
end
|
19
|
+
let(:scans) do
|
20
|
+
{
|
21
|
+
isbn: ".C3nZC3nZC3n2ChnWENz7DxnY.cGen.ENr7C3z0CNj3Dhj1EW.",
|
22
|
+
ib5: ".C3nZC3nZC3n2ChnWENz7DxnY.cGf2.ENr7C3z0DNn0ENnWE3nZDhP6."
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
it "is called CueCat" do
|
27
|
+
expect(cuecat.name).to match(/CueCat/i)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "detects a complete scan only" do
|
31
|
+
partials.each { |scan| expect(cuecat.match?(scan)).not_to be_truthy }
|
32
|
+
expect(cuecat.match?(scans[:isbn])).to be_truthy
|
33
|
+
expect(cuecat.match?(scans[:ib5])).to be_truthy
|
34
|
+
end
|
35
|
+
|
36
|
+
it "decodes ISBN barcodes" do
|
37
|
+
expect(cuecat.decode(scans[:isbn])).to eq("9780571147168")
|
38
|
+
end
|
39
|
+
|
40
|
+
it "decodes ISBN+5 barcodes" do
|
41
|
+
expect(cuecat.decode(scans[:ib5])).to eq("9780575079038") # 00799
|
42
|
+
# TODO are we supposed to keep the +5 bit?
|
43
|
+
end
|
44
|
+
|
45
|
+
it "decodes ISSN barcodes" do
|
46
|
+
skip "Test scan ISSN"
|
47
|
+
end
|
48
|
+
|
49
|
+
it "decodes UPC barcodes" do
|
50
|
+
skip "Test scan UPC"
|
51
|
+
end
|
52
|
+
end
|
@@ -1,34 +1,39 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
3
|
+
# This file is part of Alexandria.
|
4
4
|
#
|
5
|
-
#
|
6
|
-
# modify it under the terms of the GNU General Public License as
|
7
|
-
# published by the Free Software Foundation; either version 2 of the
|
8
|
-
# License, or (at your option) any later version.
|
9
|
-
#
|
10
|
-
# Alexandria is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
-
# General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU General Public
|
16
|
-
# License along with Alexandria; see the file COPYING. If not,
|
17
|
-
# write to the Free Software Foundation, Inc., 51 Franklin Street,
|
18
|
-
# Fifth Floor, Boston, MA 02110-1301 USA.
|
5
|
+
# See the file README.md for authorship and licensing information.
|
19
6
|
|
20
|
-
require
|
7
|
+
require "spec_helper"
|
8
|
+
|
9
|
+
RSpec.describe Alexandria::SmartLibrary do
|
10
|
+
it "can be instantiated simply" do
|
11
|
+
lib = described_class.new("Hello", [], :all)
|
12
|
+
expect(lib.name).to eq "Hello"
|
13
|
+
end
|
21
14
|
|
22
|
-
describe
|
23
|
-
|
24
|
-
|
25
|
-
|
15
|
+
describe "#name" do
|
16
|
+
it "normalizes the encoding" do
|
17
|
+
bad_name = (+"Prêts").force_encoding("ascii")
|
18
|
+
lib = described_class.new(bad_name, [], :all)
|
19
|
+
expect(lib.name.encoding.name).to eq "UTF-8"
|
20
|
+
expect(bad_name.encoding.name).to eq "US-ASCII"
|
21
|
+
end
|
26
22
|
end
|
27
23
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
24
|
+
describe "#update" do
|
25
|
+
let(:lib) { described_class.new("Hello", [], :all) }
|
26
|
+
|
27
|
+
it "works when given no parameters" do
|
28
|
+
lib.update
|
29
|
+
end
|
30
|
+
|
31
|
+
it "works when given a LibraryCollection" do
|
32
|
+
lib.update Alexandria::LibraryCollection.instance
|
33
|
+
end
|
34
|
+
|
35
|
+
it "works when given a Library" do
|
36
|
+
lib.update Alexandria::Library.new("Hi")
|
37
|
+
end
|
33
38
|
end
|
34
39
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is part of Alexandria.
|
4
|
+
#
|
5
|
+
# See the file README.md for authorship and licensing information.
|
6
|
+
|
7
|
+
require_relative "../../spec_helper"
|
8
|
+
|
9
|
+
describe Alexandria::UI::AboutDialog do
|
10
|
+
it "works" do
|
11
|
+
parent = Gtk::Window.new :toplevel
|
12
|
+
described_class.new parent
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is part of Alexandria.
|
4
|
+
#
|
5
|
+
# See the file README.md for authorship and licensing information.
|
6
|
+
|
7
|
+
require_relative "../../spec_helper"
|
8
|
+
|
9
|
+
describe Alexandria::UI::AcquireDialog do
|
10
|
+
it "works" do
|
11
|
+
parent = Gtk::Window.new :toplevel
|
12
|
+
described_class.new parent
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is part of Alexandria.
|
4
|
+
#
|
5
|
+
# See the file README.md for authorship and licensing information.
|
6
|
+
|
7
|
+
require_relative "../../spec_helper"
|
8
|
+
|
9
|
+
describe Alexandria::UI::AlertDialog do
|
10
|
+
it "works" do
|
11
|
+
parent = Gtk::Window.new :toplevel
|
12
|
+
described_class.new(parent, "Hello",
|
13
|
+
Gtk::Stock::DIALOG_QUESTION,
|
14
|
+
[[Gtk::Stock::CANCEL, :cancel]], "Hi there")
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is part of Alexandria.
|
4
|
+
#
|
5
|
+
# See the file README.md for authorship and licensing information.
|
6
|
+
|
7
|
+
require_relative "../../spec_helper"
|
8
|
+
|
9
|
+
describe Alexandria::UI::BadIsbnsDialog do
|
10
|
+
it "works" do
|
11
|
+
parent = Gtk::Window.new :toplevel
|
12
|
+
described_class.new parent, "Careful", []
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is part of Alexandria.
|
4
|
+
#
|
5
|
+
# See the file README.md for authorship and licensing information.
|
6
|
+
|
7
|
+
require_relative "../../spec_helper"
|
8
|
+
|
9
|
+
describe Alexandria::UI::BookPropertiesDialog do
|
10
|
+
it "works" do
|
11
|
+
parent = Gtk::Window.new :toplevel
|
12
|
+
library = instance_double(Alexandria::Library, name: "Bar Library", cover: "")
|
13
|
+
book = Alexandria::Book.new("Foo Book", ["Jane Doe"], "98765432", "Bar Publisher",
|
14
|
+
1972, "edition")
|
15
|
+
described_class.new parent, library, book
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is part of Alexandria.
|
4
|
+
#
|
5
|
+
# See the file README.md for authorship and licensing information.
|
6
|
+
|
7
|
+
require_relative "../../spec_helper"
|
8
|
+
|
9
|
+
describe Alexandria::UI::ConfirmEraseDialog do
|
10
|
+
it "works" do
|
11
|
+
parent = Gtk::Window.new :toplevel
|
12
|
+
described_class.new parent, "foo-file"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is part of Alexandria.
|
4
|
+
#
|
5
|
+
# See the file README.md for authorship and licensing information.
|
6
|
+
|
7
|
+
require_relative "../../spec_helper"
|
8
|
+
|
9
|
+
describe Alexandria::UI::ConflictWhileCopyingDialog do
|
10
|
+
it "works" do
|
11
|
+
parent = Gtk::Window.new :toplevel
|
12
|
+
library = instance_double(Alexandria::Library, name: "Bar Library")
|
13
|
+
book = instance_double(Alexandria::Book, title: "Foo Book")
|
14
|
+
described_class.new parent, library, book
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is part of Alexandria.
|
4
|
+
#
|
5
|
+
# See the file README.md for authorship and licensing information.
|
6
|
+
|
7
|
+
require_relative "../../spec_helper"
|
8
|
+
|
9
|
+
describe Alexandria::UI::ErrorDialog do
|
10
|
+
it "works" do
|
11
|
+
parent = Gtk::Window.new :toplevel
|
12
|
+
described_class.new parent, "Boom", "It went boom"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is part of Alexandria.
|
4
|
+
#
|
5
|
+
# See the file README.md for authorship and licensing information.
|
6
|
+
|
7
|
+
require_relative "../../spec_helper"
|
8
|
+
|
9
|
+
describe Alexandria::UI::ExportDialog do
|
10
|
+
let(:parent) { Gtk::Window.new :toplevel }
|
11
|
+
let(:library) { Alexandria::Library.new "Bar Library" }
|
12
|
+
let(:sort_order) { Alexandria::LibrarySortOrder::Unsorted.new }
|
13
|
+
|
14
|
+
it "works" do
|
15
|
+
described_class.new parent, library, sort_order
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#perform" do
|
19
|
+
let(:export_dialog) { described_class.new parent, library, sort_order }
|
20
|
+
let(:chooser) { export_dialog.dialog }
|
21
|
+
|
22
|
+
it "works when response is cancel" do
|
23
|
+
allow(chooser).to receive(:run).and_return(Gtk::ResponseType::CANCEL)
|
24
|
+
export_dialog.perform
|
25
|
+
end
|
26
|
+
|
27
|
+
it "works when response is OK" do
|
28
|
+
dir = Dir.mktmpdir
|
29
|
+
allow(chooser).to receive(:run).and_return(Gtk::ResponseType::OK)
|
30
|
+
allow(chooser).to receive(:filename).and_return File.join(dir, "export")
|
31
|
+
export_dialog.perform
|
32
|
+
ensure
|
33
|
+
FileUtils.remove_entry dir
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is part of Alexandria.
|
4
|
+
#
|
5
|
+
# See the file README.md for authorship and licensing information.
|
6
|
+
|
7
|
+
require "spec_helper"
|
8
|
+
|
9
|
+
RSpec.describe Alexandria::UI::Icons do
|
10
|
+
describe ".tag_icon" do
|
11
|
+
let(:loader) { Alexandria::LibraryStore.new(TESTDIR) }
|
12
|
+
let(:lib_version) { File.join(LIBDIR, "0.6.2") }
|
13
|
+
|
14
|
+
before do
|
15
|
+
FileUtils.cp_r(lib_version, TESTDIR)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns a pixbuf" do
|
19
|
+
library = loader.load_all_libraries.first
|
20
|
+
icon = described_class.cover(library, library.first)
|
21
|
+
|
22
|
+
tagged_icon = described_class.tag_icon(icon, described_class::FAVORITE_TAG)
|
23
|
+
expect(tagged_icon).to be_a GdkPixbuf::Pixbuf
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -1,29 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
4
|
-
# Copyright (C) 2014 Matijs van Zuijlen
|
3
|
+
# This file is part of Alexandria.
|
5
4
|
#
|
6
|
-
#
|
7
|
-
# modify it under the terms of the GNU General Public License as
|
8
|
-
# published by the Free Software Foundation; either version 2 of the
|
9
|
-
# License, or (at your option) any later version.
|
10
|
-
#
|
11
|
-
# Alexandria is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
# General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU General Public
|
17
|
-
# License along with Alexandria; see the file COPYING. If not,
|
18
|
-
# write to the Free Software Foundation, Inc., 51 Franklin Street,
|
19
|
-
# Fifth Floor, Boston, MA 02110-1301 USA.
|
5
|
+
# See the file README.md for authorship and licensing information.
|
20
6
|
|
21
|
-
|
7
|
+
require_relative "../../spec_helper"
|
22
8
|
|
23
9
|
describe Alexandria::UI::IconViewManager do
|
24
|
-
it
|
25
|
-
iconview =
|
26
|
-
parent =
|
27
|
-
|
10
|
+
it "works" do
|
11
|
+
iconview = instance_double(Gtk::IconView).as_null_object
|
12
|
+
parent = instance_double(Alexandria::UI::UIManager, iconview: iconview).as_null_object
|
13
|
+
described_class.new iconview, parent
|
28
14
|
end
|
29
15
|
end
|