alexandria-book-collection-manager 0.7.1 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/dependabot.yml +9 -0
- data/.gitignore +5 -2
- data/.hound.yml +2 -0
- data/.rubocop.yml +113 -45
- data/.rubocop_todo.yml +82 -170
- data/.simplecov +5 -1
- data/.travis.yml +45 -0
- data/.yardopts +1 -1
- data/CHANGELOG.md +60 -0
- data/ChangeLog.0 +33 -35
- data/Gemfile +6 -5
- data/INSTALL.md +164 -0
- data/README.md +52 -42
- data/Rakefile +95 -109
- data/TODO.md +9 -1
- data/alexandria-book-collection-manager.gemspec +52 -45
- data/bin/alexandria +31 -53
- data/doc/AUTHORS +61 -0
- data/doc/BUGS +31 -0
- data/doc/FAQ +365 -0
- data/doc/HACKING +19 -0
- data/doc/NEWS +341 -0
- data/doc/alexandria.1 +120 -0
- data/doc/cuecat_support.rdoc +67 -0
- data/doc/dependency_decisions.yml +80 -0
- data/lib/alexandria.rb +29 -37
- data/lib/alexandria/about.rb +52 -51
- data/lib/alexandria/book_providers.rb +94 -101
- data/lib/alexandria/book_providers/adlibris.rb +45 -85
- data/lib/alexandria/book_providers/amazon_aws.rb +105 -113
- data/lib/alexandria/book_providers/amazon_ecs_util.rb +293 -324
- data/lib/alexandria/book_providers/barnes_and_noble.rb +54 -53
- data/lib/alexandria/book_providers/douban.rb +29 -51
- data/lib/alexandria/book_providers/proxis.rb +42 -59
- data/lib/alexandria/book_providers/pseudomarc.rb +79 -99
- data/lib/alexandria/book_providers/siciliano.rb +68 -70
- data/lib/alexandria/book_providers/thalia.rb +46 -45
- data/lib/alexandria/book_providers/web.rb +17 -33
- data/lib/alexandria/book_providers/worldcat.rb +74 -102
- data/lib/alexandria/book_providers/z3950.rb +170 -174
- data/lib/alexandria/config.rb +5 -3
- data/lib/alexandria/console.rb +10 -21
- data/lib/alexandria/default_preferences.rb +37 -0
- data/lib/alexandria/execution_queue.rb +17 -15
- data/lib/alexandria/export_format.rb +47 -0
- data/lib/alexandria/export_library.rb +188 -302
- data/lib/alexandria/import_library.rb +114 -155
- data/lib/alexandria/import_library_csv.rb +46 -96
- 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 +15 -19
- data/lib/alexandria/models/book.rb +15 -20
- data/lib/alexandria/models/library.rb +81 -363
- data/lib/alexandria/net.rb +7 -6
- data/lib/alexandria/preferences.rb +73 -91
- data/lib/alexandria/scanners.rb +4 -2
- data/lib/alexandria/scanners/{cuecat.rb → cue_cat.rb} +24 -20
- data/lib/alexandria/scanners/keyboard.rb +10 -8
- data/lib/alexandria/smart_library.rb +135 -171
- data/lib/alexandria/ui.rb +17 -15
- data/lib/alexandria/ui/about_dialog.rb +49 -0
- data/lib/alexandria/ui/{dialogs/acquire_dialog.rb → acquire_dialog.rb} +129 -152
- 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} +18 -15
- data/lib/alexandria/ui/{dialogs/book_properties_dialog.rb → book_properties_dialog.rb} +44 -61
- data/lib/alexandria/ui/{dialogs/book_properties_dialog_base.rb → book_properties_dialog_base.rb} +84 -89
- data/lib/alexandria/ui/builder_base.rb +9 -27
- data/lib/alexandria/ui/callbacks.rb +188 -186
- data/lib/alexandria/ui/columns.rb +2 -0
- data/lib/alexandria/ui/completion_models.rb +12 -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 +10 -8
- data/lib/alexandria/ui/error_dialog.rb +25 -0
- data/lib/alexandria/ui/export_dialog.rb +139 -0
- data/lib/alexandria/ui/icons.rb +49 -65
- data/lib/alexandria/ui/iconview.rb +15 -13
- data/lib/alexandria/ui/iconview_tooltips.rb +43 -58
- data/lib/alexandria/ui/import_dialog.rb +157 -0
- data/lib/alexandria/ui/init.rb +23 -33
- data/lib/alexandria/ui/keep_bad_isbn_dialog.rb +36 -0
- data/lib/alexandria/ui/libraries_combo.rb +18 -14
- data/lib/alexandria/ui/listview.rb +77 -88
- data/lib/alexandria/ui/main_app.rb +26 -26
- data/lib/alexandria/ui/misc_dialogs.rb +10 -0
- data/lib/alexandria/ui/multi_drag_treeview.rb +30 -41
- data/lib/alexandria/ui/{dialogs/new_book_dialog.rb → new_book_dialog.rb} +168 -215
- 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} +62 -72
- 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/{dialogs/smart_library_properties_dialog_base.rb → smart_library_properties_dialog_base.rb} +96 -172
- data/lib/alexandria/ui/smart_library_rule_box.rb +119 -0
- data/lib/alexandria/ui/sound.rb +13 -13
- data/lib/alexandria/ui/ui_manager.rb +262 -283
- data/lib/alexandria/undo_manager.rb +3 -0
- data/lib/alexandria/version.rb +6 -19
- data/lib/alexandria/web_themes.rb +24 -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 +1020 -969
- 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 +77 -210
- data/spec/alexandria/book_spec.rb +16 -12
- data/spec/alexandria/console_spec.rb +27 -0
- data/spec/alexandria/export_library_spec.rb +130 -0
- data/spec/alexandria/library_spec.rb +130 -172
- data/spec/alexandria/library_store_spec.rb +37 -0
- data/spec/alexandria/preferences_spec.rb +46 -17
- data/spec/alexandria/scanners/cue_cat_spec.rb +52 -0
- data/spec/alexandria/smart_library_spec.rb +32 -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 +15 -0
- data/spec/alexandria/ui/icons_spec.rb +26 -0
- data/spec/alexandria/ui/iconview_spec.rb +9 -21
- data/spec/alexandria/ui/import_dialog_spec.rb +41 -0
- data/spec/alexandria/ui/keep_bad_isbn_dialog_spec.rb +17 -0
- data/spec/alexandria/ui/main_app_spec.rb +8 -33
- 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 +32 -0
- data/spec/alexandria/ui/sound_spec.rb +4 -2
- data/spec/alexandria/ui/ui_manager_spec.rb +45 -20
- data/spec/end_to_end/basic_run_spec.rb +57 -0
- data/spec/spec_helper.rb +66 -33
- data/tasks/setup.rb +5 -3
- data/tasks/spec.rake +18 -3
- data/util/rake/fileinstall.rb +38 -40
- data/util/rake/gettextgenerate.rb +15 -70
- data/util/rake/omfgenerate.rb +10 -10
- metadata +176 -60
- data/INSTALL.rdoc +0 -148
- data/dogtail/basic_run_test.py +0 -9
- data/lib/alexandria/book_providers/bol_it.rb +0 -160
- data/lib/alexandria/book_providers/deastore.rb +0 -273
- data/lib/alexandria/book_providers/ibs_it.rb +0 -147
- data/lib/alexandria/book_providers/mcu.rb +0 -169
- data/lib/alexandria/book_providers/renaud.rb +0 -140
- data/lib/alexandria/book_providers/webster_it.rb +0 -167
- data/lib/alexandria/ui/dialogs/about_dialog.rb +0 -59
- data/lib/alexandria/ui/dialogs/alert_dialog.rb +0 -70
- data/lib/alexandria/ui/dialogs/bad_isbns_dialog.rb +0 -43
- 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 -85
- 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 -578
- data/lib/alexandria/ui/dialogs/smart_library_properties_dialog.rb +0 -57
- data/spec/alexandria/scanners/cuecat_spec.rb +0 -65
- data/spec/alexandria/ui/dialogs_spec.rb +0 -94
- data/spec/alexandria/ui/sidepane_spec.rb +0 -27
- data/spec/alexandria/ui/ui_utilities_spec.rb +0 -60
- data/spec/alexandria/utilities_spec.rb +0 -50
- data/tasks/dogtail.rake +0 -4
@@ -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::KeepBadISBNDialog do
|
10
|
+
it "works" do
|
11
|
+
parent = Gtk::Window.new :toplevel
|
12
|
+
book = instance_double(Alexandria::Book,
|
13
|
+
title: "Foo Book",
|
14
|
+
isbn: "98765432")
|
15
|
+
described_class.new parent, book
|
16
|
+
end
|
17
|
+
end
|
@@ -1,42 +1,17 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (C) 2007 Cathal Mc Ginley
|
3
|
-
# Copyright (C) 2011, 2014-2016 Matijs van Zuijlen
|
4
|
-
#
|
5
|
-
# Alexandria is free software; you can redistribute it and/or
|
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.
|
1
|
+
# frozen_string_literal: true
|
19
2
|
|
20
|
-
|
3
|
+
# frozen_string_literal: true
|
21
4
|
|
22
|
-
#
|
23
|
-
|
24
|
-
|
25
|
-
it 'should work'
|
26
|
-
end
|
27
|
-
|
28
|
-
describe Gtk::ActionGroup do
|
29
|
-
it 'should work'
|
30
|
-
end
|
5
|
+
# This file is part of Alexandria.
|
6
|
+
#
|
7
|
+
# See the file README.md for authorship and licensing information.
|
31
8
|
|
32
|
-
|
33
|
-
it 'should work'
|
34
|
-
end
|
9
|
+
require_relative "../../spec_helper"
|
35
10
|
|
36
11
|
describe Alexandria::UI::MainApp do
|
37
|
-
it
|
12
|
+
it "is a singleton" do
|
38
13
|
expect do
|
39
|
-
|
14
|
+
described_class.new
|
40
15
|
end.to raise_error NoMethodError
|
41
16
|
end
|
42
17
|
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::NewBookDialogManual do
|
10
|
+
it "works" do
|
11
|
+
parent = Gtk::Window.new :toplevel
|
12
|
+
library = instance_double(Alexandria::Library)
|
13
|
+
described_class.new parent, library
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,22 @@
|
|
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
|
+
describe Alexandria::UI::NewBookDialog do
|
10
|
+
let(:parent) { Gtk::Window.new :toplevel }
|
11
|
+
let(:model) { Gtk::ListStore.new(String, String, GdkPixbuf::Pixbuf) }
|
12
|
+
|
13
|
+
it "works" do
|
14
|
+
described_class.new parent
|
15
|
+
end
|
16
|
+
|
17
|
+
it "can copy search results into result treeview" do
|
18
|
+
results = [[an_artist_of_the_floating_world, "cover-url"]]
|
19
|
+
dialog = described_class.new parent
|
20
|
+
dialog.copy_results_to_treeview_model results, model
|
21
|
+
end
|
22
|
+
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,32 @@
|
|
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(:parent) { Gtk::Window.new :toplevel }
|
11
|
+
let(:loader) { Alexandria::LibraryStore.new(TESTDIR) }
|
12
|
+
let(:smart_library) { Alexandria::SmartLibrary.new("Foo", [], :all, loader) }
|
13
|
+
|
14
|
+
it "can be instantiated" do
|
15
|
+
described_class.new parent, smart_library
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#acquire" do
|
19
|
+
let(:properties_dialog) { described_class.new parent, smart_library }
|
20
|
+
let(:gtk_dialog) { properties_dialog.dialog }
|
21
|
+
|
22
|
+
it "works when response is cancel" do
|
23
|
+
allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::CANCEL)
|
24
|
+
properties_dialog.acquire
|
25
|
+
end
|
26
|
+
|
27
|
+
it "works when response is ok" do
|
28
|
+
allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::OK)
|
29
|
+
properties_dialog.acquire
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (C) 2016 Matijs van Zuijlen
|
2
4
|
#
|
3
5
|
# Alexandria is free software; you can redistribute it and/or
|
@@ -15,10 +17,10 @@
|
|
15
17
|
# write to the Free Software Foundation, Inc., 51 Franklin Street,
|
16
18
|
# Fifth Floor, Boston, MA 02110-1301 USA.
|
17
19
|
|
18
|
-
require
|
20
|
+
require "spec_helper"
|
19
21
|
|
20
22
|
describe Alexandria::UI::SoundEffectsPlayer do
|
21
|
-
it
|
23
|
+
it "can be instantiated" do
|
22
24
|
player = described_class.new
|
23
25
|
expect(player).to be_instance_of described_class
|
24
26
|
end
|
@@ -1,26 +1,51 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
# Alexandria is free software; you can redistribute it and/or
|
5
|
-
# modify it under the terms of the GNU General Public License as
|
6
|
-
# published by the Free Software Foundation; either version 2 of the
|
7
|
-
# License, or (at your option) any later version.
|
8
|
-
#
|
9
|
-
# Alexandria is distributed in the hope that it will be useful,
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
-
# General Public License for more details.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is part of Alexandria.
|
13
4
|
#
|
14
|
-
#
|
15
|
-
# License along with Alexandria; see the file COPYING. If not,
|
16
|
-
# write to the Free Software Foundation, Inc., 51 Franklin Street,
|
17
|
-
# Fifth Floor, Boston, MA 02110-1301 USA.
|
5
|
+
# See the file README.md for authorship and licensing information.
|
18
6
|
|
19
|
-
|
7
|
+
require_relative "../../spec_helper"
|
20
8
|
|
21
9
|
describe Alexandria::UI::UIManager do
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
+
ui.iconview.unfreeze
|
43
|
+
expect(ui.model.iter_n_children).to eq regular_library.count
|
44
|
+
|
45
|
+
# This triggers the #on_books_selection_changed callback
|
46
|
+
ui.select_a_book regular_library.first
|
47
|
+
|
48
|
+
expect(ui.iconview.selected_items).not_to be_empty
|
49
|
+
end
|
25
50
|
end
|
26
51
|
end
|
@@ -0,0 +1,57 @@
|
|
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 "gnome_app_driver"
|
8
|
+
require "tmpdir"
|
9
|
+
|
10
|
+
describe "The Alexandria application" do
|
11
|
+
let(:driver) { GnomeAppDriver.new "alexandria" }
|
12
|
+
|
13
|
+
before do
|
14
|
+
ENV["HOME"] = Dir.mktmpdir
|
15
|
+
driver.boot
|
16
|
+
end
|
17
|
+
|
18
|
+
after do
|
19
|
+
driver.cleanup
|
20
|
+
end
|
21
|
+
|
22
|
+
it "starts and can be quit with Ctrl-q" do
|
23
|
+
driver.press_ctrl_q
|
24
|
+
|
25
|
+
status = driver.cleanup
|
26
|
+
expect(status.exitstatus).to eq 0
|
27
|
+
end
|
28
|
+
|
29
|
+
it "starts and can be quit with the menu" do
|
30
|
+
frame = driver.frame
|
31
|
+
menu = frame.find_role :menu_item, /Quit/
|
32
|
+
menu.do_action 0
|
33
|
+
|
34
|
+
status = driver.cleanup
|
35
|
+
expect(status.exitstatus).to eq 0
|
36
|
+
end
|
37
|
+
|
38
|
+
it "can be interacted with" do
|
39
|
+
frame = driver.frame
|
40
|
+
frame.find_role(:menu_item, /Title contains/).do_action 0
|
41
|
+
frame.find_role(:menu_item, /View as Icons/).do_action 0
|
42
|
+
frame.find_role(:menu_item, /View as List/).do_action 0
|
43
|
+
frame.find_role(:table_column_header, /Title/).do_action 0
|
44
|
+
|
45
|
+
table_cell = frame.find_role(:table_cell)
|
46
|
+
|
47
|
+
table_cell.n_actions.times do |idx|
|
48
|
+
name = table_cell.get_action_name idx
|
49
|
+
table_cell.do_action idx if name == "activate"
|
50
|
+
end
|
51
|
+
|
52
|
+
driver.press_ctrl_q
|
53
|
+
|
54
|
+
status = driver.cleanup
|
55
|
+
expect(status.exitstatus).to eq 0
|
56
|
+
end
|
57
|
+
end
|