alexandria-book-collection-manager 0.7.3 → 0.7.8
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 +4 -1
- data/.rubocop.yml +86 -36
- data/.rubocop_todo.yml +58 -161
- data/.simplecov +5 -2
- data/CHANGELOG.md +56 -2
- data/Gemfile +4 -3
- data/INSTALL.md +23 -11
- data/README.md +52 -41
- data/Rakefile +78 -75
- data/alexandria-book-collection-manager.gemspec +50 -44
- data/bin/alexandria +12 -22
- data/doc/FAQ +1 -2
- data/doc/dependency_decisions.yml +27 -8
- data/lib/alexandria.rb +25 -23
- data/lib/alexandria/about.rb +50 -50
- data/lib/alexandria/book_providers.rb +86 -91
- data/lib/alexandria/book_providers/adlibris.rb +37 -74
- data/lib/alexandria/book_providers/amazon_aws.rb +94 -100
- data/lib/alexandria/book_providers/amazon_ecs_util.rb +289 -324
- data/lib/alexandria/book_providers/barnes_and_noble.rb +42 -42
- data/lib/alexandria/book_providers/douban.rb +25 -41
- data/lib/alexandria/book_providers/proxis.rb +34 -29
- data/lib/alexandria/book_providers/pseudomarc.rb +77 -85
- data/lib/alexandria/book_providers/siciliano.rb +60 -64
- data/lib/alexandria/book_providers/thalia_provider.rb +161 -0
- data/lib/alexandria/book_providers/web.rb +5 -5
- data/lib/alexandria/book_providers/worldcat.rb +66 -95
- data/lib/alexandria/book_providers/z3950.rb +153 -169
- data/lib/alexandria/config.rb +1 -1
- data/lib/alexandria/console.rb +3 -3
- data/lib/alexandria/default_preferences.rb +37 -0
- data/lib/alexandria/execution_queue.rb +13 -12
- data/lib/alexandria/export_format.rb +8 -8
- data/lib/alexandria/export_library.rb +128 -127
- data/lib/alexandria/import_library.rb +102 -126
- data/lib/alexandria/import_library_csv.rb +41 -41
- data/lib/alexandria/library_collection.rb +6 -5
- data/lib/alexandria/library_sort_order.rb +4 -2
- data/lib/alexandria/library_store.rb +39 -28
- data/lib/alexandria/logging.rb +10 -14
- data/lib/alexandria/models/book.rb +5 -4
- data/lib/alexandria/models/library.rb +63 -53
- data/lib/alexandria/net.rb +5 -6
- data/lib/alexandria/preferences.rb +66 -63
- data/lib/alexandria/scanners.rb +2 -2
- data/lib/alexandria/scanners/{cuecat.rb → cue_cat.rb} +17 -17
- data/lib/alexandria/scanners/keyboard.rb +8 -8
- data/lib/alexandria/smart_library.rb +110 -112
- data/lib/alexandria/ui.rb +15 -15
- data/lib/alexandria/ui/{dialogs/about_dialog.rb → about_dialog.rb} +2 -2
- data/lib/alexandria/ui/{dialogs/acquire_dialog.rb → acquire_dialog.rb} +108 -109
- data/lib/alexandria/ui/alert_dialog.rb +66 -0
- data/lib/alexandria/ui/{dialogs/bad_isbns_dialog.rb → bad_isbns_dialog.rb} +13 -9
- 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} +25 -38
- data/lib/alexandria/ui/{dialogs/book_properties_dialog_base.rb → book_properties_dialog_base.rb} +64 -157
- data/lib/alexandria/ui/builder_base.rb +1 -1
- data/lib/alexandria/ui/calendar_popup.rb +58 -0
- data/lib/alexandria/ui/callbacks.rb +187 -155
- data/lib/alexandria/ui/completion_models.rb +8 -22
- 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/{dialogs/export_dialog.rb → export_dialog.rb} +37 -58
- data/lib/alexandria/ui/icons.rb +38 -43
- 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 +30 -41
- data/lib/alexandria/ui/{dialogs/keep_bad_isbn_dialog.rb → keep_bad_isbn_dialog.rb} +9 -6
- data/lib/alexandria/ui/libraries_combo.rb +15 -14
- data/lib/alexandria/ui/listview.rb +69 -67
- 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 +8 -9
- data/lib/alexandria/ui/{dialogs/new_book_dialog.rb → new_book_dialog.rb} +113 -114
- data/lib/alexandria/ui/{dialogs/new_book_dialog_manual.rb → new_book_dialog_manual.rb} +22 -19
- 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/{dialogs/misc_dialogs.rb → really_delete_dialog.rb} +7 -28
- data/lib/alexandria/ui/{sidepane.rb → sidepane_manager.rb} +53 -48
- 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 +216 -200
- data/lib/alexandria/version.rb +4 -19
- data/lib/alexandria/web_themes.rb +21 -21
- data/po/Makefile +2 -2
- data/po/cs.po +992 -875
- data/po/cy.po +961 -874
- data/po/de.po +990 -865
- data/po/el.po +989 -865
- data/po/es.po +985 -861
- data/po/fr.po +987 -867
- data/po/ga.po +908 -820
- data/po/gl.po +980 -860
- data/po/it.po +986 -864
- data/po/ja.po +969 -849
- data/po/mk.po +984 -860
- data/po/nb.po +979 -859
- data/po/nl.po +983 -860
- data/po/pl.po +1018 -971
- data/po/pt.po +988 -857
- data/po/pt_BR.po +983 -863
- data/po/ru.po +994 -871
- data/po/sk.po +989 -867
- data/po/sv.po +976 -856
- data/po/uk.po +972 -858
- data/po/zh_TW.po +974 -854
- data/schemas/alexandria.schemas +24 -2
- data/share/alexandria/glade/acquire_dialog__builder.glade +1 -1
- data/share/alexandria/glade/book_properties_dialog__builder.glade +1 -1
- data/share/alexandria/glade/main_app__builder.glade +6 -21
- data/share/alexandria/glade/new_book_dialog__builder.glade +1 -1
- data/share/alexandria/glade/preferences_dialog__builder.glade +1 -1
- data/share/gnome/help/alexandria/C/introduction.xml +0 -4
- 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 -4
- data/share/gnome/help/alexandria/ja/smart-libraries.xml +1 -1
- data/spec/alexandria/book_providers/thalia_provider_spec.rb +119 -0
- data/spec/alexandria/book_providers/world_cat_provider_spec.rb +160 -0
- data/spec/alexandria/book_providers_spec.rb +62 -156
- data/spec/alexandria/book_spec.rb +12 -10
- data/spec/alexandria/console_spec.rb +6 -11
- data/spec/alexandria/export_library_spec.rb +47 -58
- data/spec/alexandria/library_spec.rb +121 -109
- data/spec/alexandria/library_store_spec.rb +8 -8
- 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 +15 -15
- 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 +59 -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 +51 -0
- data/spec/alexandria/ui/{dialogs/new_book_dialog_spec.rb → new_book_dialog_spec.rb} +4 -4
- 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 +44 -20
- data/spec/end_to_end/basic_run_spec.rb +21 -38
- data/spec/fixtures/cover.jpg +0 -0
- data/spec/spec_helper.rb +54 -10
- data/tasks/setup.rb +2 -2
- data/tasks/spec.rake +11 -11
- data/util/rake/fileinstall.rb +38 -35
- data/util/rake/gettextgenerate.rb +7 -7
- data/util/rake/omfgenerate.rb +7 -7
- metadata +158 -45
- data/dogtail/basic_run_test.py +0 -9
- data/lib/alexandria/book_providers/renaud.rb +0 -155
- data/lib/alexandria/book_providers/thalia.rb +0 -198
- data/lib/alexandria/ui/dialogs/alert_dialog.rb +0 -63
- data/lib/alexandria/ui/dialogs/import_dialog.rb +0 -176
- data/lib/alexandria/ui/dialogs/new_smart_library_dialog.rb +0 -62
- data/lib/alexandria/ui/dialogs/preferences_dialog.rb +0 -563
- data/lib/alexandria/ui/dialogs/smart_library_properties_dialog.rb +0 -61
- data/lib/alexandria/ui/dialogs/smart_library_properties_dialog_base.rb +0 -423
- data/spec/alexandria/scanners/cuecat_spec.rb +0 -67
- data/spec/alexandria/ui/dialogs_spec.rb +0 -162
- 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,51 @@
|
|
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::NewBookDialogManual do
|
10
|
+
let(:parent) { Gtk::Window.new :toplevel }
|
11
|
+
let(:library) do
|
12
|
+
store = Alexandria::LibraryCollection.instance.library_store
|
13
|
+
store.load_library("Bar Library")
|
14
|
+
end
|
15
|
+
|
16
|
+
it "works" do
|
17
|
+
described_class.new parent, library
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "#on_change_cover" do
|
21
|
+
let(:dialog) { described_class.new parent, library }
|
22
|
+
let(:filechooser) { instance_double(Gtk::FileChooserDialog).as_null_object }
|
23
|
+
|
24
|
+
before do
|
25
|
+
allow(Gtk::FileChooserDialog).to receive(:new).and_return(filechooser)
|
26
|
+
allow(filechooser).to receive(:filename)
|
27
|
+
.and_return File.join(__dir__, "../../fixtures/cover.jpg")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "works when response is accept" do
|
31
|
+
allow(filechooser)
|
32
|
+
.to receive(:run).and_return(Gtk::ResponseType::ACCEPT)
|
33
|
+
|
34
|
+
dialog.on_change_cover
|
35
|
+
end
|
36
|
+
|
37
|
+
it "works when response is reject" do
|
38
|
+
allow(filechooser)
|
39
|
+
.to receive(:run).and_return(Gtk::ResponseType::REJECT)
|
40
|
+
|
41
|
+
dialog.on_change_cover
|
42
|
+
end
|
43
|
+
|
44
|
+
it "works when response is cancel" do
|
45
|
+
allow(filechooser)
|
46
|
+
.to receive(:run).and_return(Gtk::ResponseType::CANCEL)
|
47
|
+
|
48
|
+
dialog.on_change_cover
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -4,18 +4,18 @@
|
|
4
4
|
#
|
5
5
|
# See the file README.md for authorship and licensing information.
|
6
6
|
|
7
|
-
require
|
7
|
+
require "spec_helper"
|
8
8
|
|
9
9
|
describe Alexandria::UI::NewBookDialog do
|
10
10
|
let(:parent) { Gtk::Window.new :toplevel }
|
11
11
|
let(:model) { Gtk::ListStore.new(String, String, GdkPixbuf::Pixbuf) }
|
12
12
|
|
13
|
-
it
|
13
|
+
it "works" do
|
14
14
|
described_class.new parent
|
15
15
|
end
|
16
16
|
|
17
|
-
it
|
18
|
-
results = [[an_artist_of_the_floating_world,
|
17
|
+
it "can copy search results into result treeview" do
|
18
|
+
results = [[an_artist_of_the_floating_world, "cover-url"]]
|
19
19
|
dialog = described_class.new parent
|
20
20
|
dialog.copy_results_to_treeview_model results, model
|
21
21
|
end
|
@@ -0,0 +1,30 @@
|
|
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::NewProviderDialog do
|
10
|
+
let(:parent) { Gtk::Window.new :toplevel }
|
11
|
+
|
12
|
+
it "can be instantiated" do
|
13
|
+
described_class.new parent
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#acquire" do
|
17
|
+
let(:provider_dialog) { described_class.new parent }
|
18
|
+
let(:gtk_dialog) { provider_dialog.dialog }
|
19
|
+
|
20
|
+
it "works when response is cancel" do
|
21
|
+
allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::CANCEL)
|
22
|
+
provider_dialog.acquire
|
23
|
+
end
|
24
|
+
|
25
|
+
it "works when response is accept" do
|
26
|
+
allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::ACCEPT)
|
27
|
+
provider_dialog.acquire
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,39 @@
|
|
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::NewSmartLibraryDialog do
|
10
|
+
let(:parent) { Gtk::Window.new :toplevel }
|
11
|
+
|
12
|
+
it "can be instantiated" do
|
13
|
+
described_class.new parent
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#acquire" do
|
17
|
+
let(:properties_dialog) { described_class.new parent }
|
18
|
+
let(:gtk_dialog) { properties_dialog.dialog }
|
19
|
+
|
20
|
+
it "works when response is cancel" do
|
21
|
+
allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::CANCEL)
|
22
|
+
properties_dialog.acquire
|
23
|
+
end
|
24
|
+
|
25
|
+
it "returns a smart library that can be saved when response is ok" do
|
26
|
+
allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::OK)
|
27
|
+
|
28
|
+
# Make sure entered rule is valid
|
29
|
+
rules_box = properties_dialog.instance_variable_get("@rules_box")
|
30
|
+
entry = rules_box.children.first.children[2]
|
31
|
+
entry.text = "foo"
|
32
|
+
|
33
|
+
result = properties_dialog.acquire
|
34
|
+
|
35
|
+
expect(result).to be_a Alexandria::SmartLibrary
|
36
|
+
expect { result.save }.not_to raise_error
|
37
|
+
end
|
38
|
+
end
|
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::PreferencesDialog do
|
10
|
+
it "works" do
|
11
|
+
parent = Gtk::Window.new :toplevel
|
12
|
+
described_class.new(parent) {}
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,34 @@
|
|
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::ProviderPreferencesDialog do
|
10
|
+
let(:parent) { Gtk::Window.new :toplevel }
|
11
|
+
let(:preferences) do
|
12
|
+
instance_double(Alexandria::BookProviders::Preferences,
|
13
|
+
length: 0, read: [])
|
14
|
+
end
|
15
|
+
let(:provider) do
|
16
|
+
instance_double(Alexandria::BookProviders::GenericProvider,
|
17
|
+
fullname: "FooProvider",
|
18
|
+
prefs: preferences)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "can be instantiated" do
|
22
|
+
described_class.new parent, provider
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#acquire" do
|
26
|
+
it "works" do
|
27
|
+
preferences_dialog = described_class.new parent, provider
|
28
|
+
gtk_dialog = preferences_dialog.dialog
|
29
|
+
allow(gtk_dialog).to receive(:run)
|
30
|
+
|
31
|
+
preferences_dialog.acquire
|
32
|
+
end
|
33
|
+
end
|
34
|
+
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::ReallyDeleteDialog do
|
10
|
+
it "works" do
|
11
|
+
library = instance_double(Alexandria::Library,
|
12
|
+
name: "Bar Library", empty?: false, size: 12)
|
13
|
+
parent = Gtk::Window.new :toplevel
|
14
|
+
described_class.new parent, library
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
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::SidepaneManager do
|
10
|
+
it "works" do
|
11
|
+
library_listview = instance_double(Gtk::TreeView).as_null_object
|
12
|
+
parent = instance_double(Alexandria::UI::UIManager, main_app: nil, append_library: nil)
|
13
|
+
described_class.new library_listview, parent
|
14
|
+
end
|
15
|
+
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::SkipEntryDialog do
|
10
|
+
it "works" do
|
11
|
+
parent = Gtk::Window.new :toplevel
|
12
|
+
described_class.new parent, "Foo"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,49 @@
|
|
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::SmartLibraryPropertiesDialog do
|
10
|
+
let(:properties_dialog) do
|
11
|
+
parent = Gtk::Window.new :toplevel
|
12
|
+
loader = Alexandria::LibraryStore.new(TESTDIR)
|
13
|
+
smart_library = Alexandria::SmartLibrary.new("Foo", [], :all, loader)
|
14
|
+
described_class.new parent, smart_library
|
15
|
+
end
|
16
|
+
let(:gtk_dialog) { properties_dialog.dialog }
|
17
|
+
|
18
|
+
describe "#acquire" do
|
19
|
+
it "works when response is cancel" do
|
20
|
+
allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::CANCEL)
|
21
|
+
properties_dialog.acquire
|
22
|
+
end
|
23
|
+
|
24
|
+
it "works when response is ok" do
|
25
|
+
allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::OK)
|
26
|
+
properties_dialog.acquire
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#handle_date_icon_press" do
|
31
|
+
let(:date_entry) do
|
32
|
+
rule_boxes = properties_dialog.handle_add_rule_clicked
|
33
|
+
rule_box = rule_boxes.first
|
34
|
+
rule_box.children[3]
|
35
|
+
end
|
36
|
+
|
37
|
+
before do
|
38
|
+
gtk_dialog.show_all
|
39
|
+
end
|
40
|
+
|
41
|
+
it "pops up the calendar widget" do
|
42
|
+
properties_dialog.handle_date_icon_press(date_entry,
|
43
|
+
Gtk::EntryIconPosition::PRIMARY,
|
44
|
+
nil)
|
45
|
+
popup = properties_dialog.instance_variable_get(:@calendar_popup)
|
46
|
+
expect(popup).to be_visible
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -17,10 +17,10 @@
|
|
17
17
|
# write to the Free Software Foundation, Inc., 51 Franklin Street,
|
18
18
|
# Fifth Floor, Boston, MA 02110-1301 USA.
|
19
19
|
|
20
|
-
require
|
20
|
+
require "spec_helper"
|
21
21
|
|
22
22
|
describe Alexandria::UI::SoundEffectsPlayer do
|
23
|
-
it
|
23
|
+
it "can be instantiated" do
|
24
24
|
player = described_class.new
|
25
25
|
expect(player).to be_instance_of described_class
|
26
26
|
end
|
@@ -1,28 +1,52 @@
|
|
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::UIManager do
|
24
|
-
|
25
|
-
|
26
|
-
|
10
|
+
let(:main_app) { instance_double(Alexandria::UI::MainApp) }
|
11
|
+
|
12
|
+
it "works" do
|
13
|
+
described_class.new main_app
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#on_new" do
|
17
|
+
it "works" do
|
18
|
+
ui = described_class.new main_app
|
19
|
+
libraries = ui.instance_variable_get("@libraries")
|
20
|
+
libraries_count = libraries.all_libraries.count
|
21
|
+
ui.on_new
|
22
|
+
expect(libraries.all_libraries.count).to eq libraries_count + 1
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#on_books_selection_changed" do
|
27
|
+
let(:lib_version) { File.join(LIBDIR, "0.6.2") }
|
28
|
+
let(:ui) { described_class.new main_app }
|
29
|
+
let(:libraries) { ui.instance_variable_get("@libraries") }
|
30
|
+
let(:regular_library) { libraries.all_regular_libraries.last }
|
31
|
+
|
32
|
+
before do
|
33
|
+
FileUtils.cp_r(lib_version, TESTDIR)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "works when single book is selected" do
|
37
|
+
ui.select_a_library regular_library
|
38
|
+
|
39
|
+
# FIXME: This is needed because right now UIManager#refresh_books doesn't
|
40
|
+
# work without Gtk loop.
|
41
|
+
regular_library.each { |book| ui.append_book book }
|
42
|
+
# This makes the iconview model re-appear
|
43
|
+
ui.iconview.unfreeze
|
44
|
+
expect(ui.model.iter_n_children).to eq regular_library.count
|
45
|
+
|
46
|
+
# This triggers the #on_books_selection_changed callback
|
47
|
+
ui.select_a_book regular_library.first
|
48
|
+
|
49
|
+
expect(ui.iconview.selected_items).not_to be_empty
|
50
|
+
end
|
27
51
|
end
|
28
52
|
end
|
@@ -1,50 +1,35 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
3
|
+
# This file is part of Alexandria.
|
4
4
|
#
|
5
|
-
#
|
6
|
-
|
7
|
-
|
8
|
-
|
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.
|
6
|
+
|
7
|
+
require "gnome_app_driver"
|
8
|
+
require "tmpdir"
|
19
9
|
|
20
|
-
|
21
|
-
|
10
|
+
describe "The Alexandria application" do
|
11
|
+
let(:driver) { GnomeAppDriver.new "alexandria" }
|
22
12
|
|
23
|
-
describe 'The Alexandria application' do
|
24
13
|
before do
|
25
|
-
ENV[
|
26
|
-
|
27
|
-
@driver.boot
|
14
|
+
ENV["HOME"] = Dir.mktmpdir
|
15
|
+
driver.boot
|
28
16
|
end
|
29
17
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
status = @driver.cleanup
|
34
|
-
expect(status.exitstatus).to eq 0
|
18
|
+
after do
|
19
|
+
driver.cleanup
|
35
20
|
end
|
36
21
|
|
37
|
-
it
|
38
|
-
frame =
|
22
|
+
it "starts and can be quit with the menu" do
|
23
|
+
frame = driver.frame
|
39
24
|
menu = frame.find_role :menu_item, /Quit/
|
40
25
|
menu.do_action 0
|
41
26
|
|
42
|
-
status =
|
27
|
+
status = driver.cleanup
|
43
28
|
expect(status.exitstatus).to eq 0
|
44
29
|
end
|
45
30
|
|
46
|
-
it
|
47
|
-
frame =
|
31
|
+
it "can be interacted with" do
|
32
|
+
frame = driver.frame
|
48
33
|
frame.find_role(:menu_item, /Title contains/).do_action 0
|
49
34
|
frame.find_role(:menu_item, /View as Icons/).do_action 0
|
50
35
|
frame.find_role(:menu_item, /View as List/).do_action 0
|
@@ -54,16 +39,14 @@ describe 'The Alexandria application' do
|
|
54
39
|
|
55
40
|
table_cell.n_actions.times do |idx|
|
56
41
|
name = table_cell.get_action_name idx
|
57
|
-
table_cell.do_action idx if name ==
|
42
|
+
table_cell.do_action idx if name == "activate"
|
58
43
|
end
|
59
44
|
|
60
|
-
|
45
|
+
frame = driver.frame
|
46
|
+
menu = frame.find_role :menu_item, /Quit/
|
47
|
+
menu.do_action 0
|
61
48
|
|
62
|
-
status =
|
49
|
+
status = driver.cleanup
|
63
50
|
expect(status.exitstatus).to eq 0
|
64
51
|
end
|
65
|
-
|
66
|
-
after do
|
67
|
-
@driver.cleanup
|
68
|
-
end
|
69
52
|
end
|