Hello community, here is the log from the commit of package yast2 for openSUSE:Factory checked in at 2017-07-02 13:32:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2 (Old) and /work/SRC/openSUSE:Factory/.yast2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2" Sun Jul 2 13:32:34 2017 rev:405 rq:506966 version:3.2.40 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2/yast2.changes 2017-06-24 08:33:25.133173431 +0200 +++ /work/SRC/openSUSE:Factory/.yast2.new/yast2.changes 2017-07-02 13:32:35.318353535 +0200 @@ -1,0 +2,10 @@ +Fri Jun 23 07:26:03 UTC 2017 - [email protected] + +- Support for the new Expert Partitioner (boo#1039901): +- Added UI::Sequence, UI::Greasemonkey +- Added CWM::Dialog +- RSpec.shared_examples for CWM: Page, PushButton, RadioButtons, + RichText. +- 3.2.40 + +------------------------------------------------------------------- Old: ---- yast2-3.2.39.tar.bz2 New: ---- yast2-3.2.40.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2.spec ++++++ --- /var/tmp/diff_new_pack.o8XTyK/_old 2017-07-02 13:32:35.970261611 +0200 +++ /var/tmp/diff_new_pack.o8XTyK/_new 2017-07-02 13:32:35.970261611 +0200 @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.2.39 +Version: 3.2.40 Release: 0 Summary: YaST2 - Main Package License: GPL-2.0 ++++++ yast2-3.2.39.tar.bz2 -> yast2-3.2.40.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/library/cwm/src/Makefile.am new/yast2-3.2.40/library/cwm/src/Makefile.am --- old/yast2-3.2.39/library/cwm/src/Makefile.am 2017-06-22 16:34:32.438119103 +0200 +++ new/yast2-3.2.40/library/cwm/src/Makefile.am 2017-06-29 10:29:38.850757928 +0200 @@ -15,6 +15,7 @@ lib/cwm/abstract_widget.rb \ lib/cwm/common_widgets.rb \ lib/cwm/custom_widget.rb \ + lib/cwm/dialog.rb \ lib/cwm/page.rb \ lib/cwm/pager.rb \ lib/cwm/replace_point.rb \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/library/cwm/src/lib/cwm/dialog.rb new/yast2-3.2.40/library/cwm/src/lib/cwm/dialog.rb --- old/yast2-3.2.39/library/cwm/src/lib/cwm/dialog.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.2.40/library/cwm/src/lib/cwm/dialog.rb 2017-06-29 10:29:38.862757928 +0200 @@ -0,0 +1,104 @@ +require "yast" + +Yast.import "CWM" + +module CWM + # An OOP API and the pieces missing from {Yast::CWMClass#show Yast::CWM.show}: + # - creating and closing a wizard dialog + # - Back/Abort/Next buttons + # + # @see UI::Dialog + # @see CWM::AbstractWidget + class Dialog + include Yast::Logger + include Yast::I18n + include Yast::UIShortcuts + + # @return [String,nil] The dialog title. `nil`: keep the existing title. + def title + nil + end + + # @return [CWM::WidgetTerm] + abstract_method :contents + + # A shortcut for `.new(*args).run` + def self.run(*args) + new(*args).run + end + + # The entry point. + # Will open (and close) a wizard dialog unless one already exists. + # @return [Symbol] + def run + if should_open_dialog? + wizard_create_dialog { cwm_show } + else + cwm_show + end + end + + def should_open_dialog? + !Yast::Wizard.IsWizardDialog + end + + # The :back button + # @return [String,true,nil] button label, + # `true` to use the default label, or `nil` to omit the button + def back_button + true + end + + # The :abort button + # @return [String,true,nil] button label, + # `true` to use the default label, or `nil` to omit the button + def abort_button + true + end + + # The :next button + # @return [String,true,nil] button label, + # `true` to use the default label, or `nil` to omit the button + def next_button + true + end + + # @return [Array<Symbol>] + # Events for which `store` won't be called, see {Yast::CWMClass#show} + def skip_store_for + [] + end + + private + + # Create a wizard dialog, run the *block*, ensure the dialog is closed. + # @param block + def wizard_create_dialog(&block) + Yast::Wizard.CreateDialog + block.call + ensure + Yast::Wizard.CloseDialog + end + + # Call {Yast::CWMClass#show} with appropriate arguments + # @return [Symbol] wizard sequencer symbol + def cwm_show + Yast::CWM.show( + contents, + caption: title, + back_button: replace_true(back_button, Yast::Label.BackButton), + abort_button: replace_true(abort_button, Yast::Label.AbortButton), + next_button: replace_true(next_button, Yast::Label.NextButton), + skip_store_for: skip_store_for + ) + end + + def replace_true(value, replacement) + if value == true + replacement + else + value + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/library/cwm/src/lib/cwm/rspec.rb new/yast2-3.2.40/library/cwm/src/lib/cwm/rspec.rb --- old/yast2-3.2.39/library/cwm/src/lib/cwm/rspec.rb 2017-06-22 16:34:32.442119103 +0200 +++ new/yast2-3.2.40/library/cwm/src/lib/cwm/rspec.rb 2017-06-29 10:29:38.866757928 +0200 @@ -58,10 +58,15 @@ include_examples "CWM::CustomWidget" end -RSpec.shared_examples "CWM::Tab" do +RSpec.shared_examples "CWM::Page" do include_examples "CWM::CustomWidget" end +# Tab is an alias for Page +RSpec.shared_examples "CWM::Tab" do + include_examples "CWM::Page" +end + RSpec.shared_examples "CWM::ItemsSelection" do describe "#items" do it "produces an array of pairs of strings" do @@ -79,6 +84,23 @@ include_examples "CWM::ItemsSelection" end +RSpec.shared_examples "CWM::PushButton" do + include_examples "CWM::AbstractWidget" +end + +RSpec.shared_examples "CWM::RadioButtons" do + include_examples "CWM::AbstractWidget" + include_examples "CWM::ItemsSelection" +end + +RSpec.shared_examples "CWM::ValueBasedWidget" do +end + +RSpec.shared_examples "CWM::RichText" do + include_examples "CWM::AbstractWidget" + include_examples "CWM::ValueBasedWidget" +end + RSpec.shared_examples "CWM::Table" do include_examples "CWM::AbstractWidget" @@ -100,3 +122,41 @@ end end end + +RSpec.shared_examples "CWM::Dialog" do + describe "#contents" do + it "produces a Term" do + expect(subject.contents).to be_a Yast::Term + end + end + + describe "#title" do + it "produces a String or nil" do + expect(subject.title).to be_a(String).or be_nil + end + end + + describe "#back_button" do + it "produces a String or true or nil" do + expect(subject.back_button).to be_a(String).or be(true).or be_nil + end + end + + describe "#abort_button" do + it "produces a String or true or nil" do + expect(subject.abort_button).to be_a(String).or be(true).or be_nil + end + end + + describe "#next_button" do + it "produces a String or true or nil" do + expect(subject.next_button).to be_a(String).or be(true).or be_nil + end + end + + describe "#skip_store_for" do + it "produces an Array" do + expect(subject.skip_store_for).to be_an Array + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/library/cwm/src/lib/cwm/tree.rb new/yast2-3.2.40/library/cwm/src/lib/cwm/tree.rb --- old/yast2-3.2.39/library/cwm/src/lib/cwm/tree.rb 2017-06-22 16:34:32.446119103 +0200 +++ new/yast2-3.2.40/library/cwm/src/lib/cwm/tree.rb 2017-06-29 10:29:38.866757928 +0200 @@ -50,7 +50,7 @@ Yast::UI.ChangeWidget(Id(widget_id), :CurrentItem, val) end - # An alias for {TreeItem.new} + # An alias for {TreeItem#initialize TreeItem.new} def new_item(*args, **kwargs) TreeItem.new(*args, **kwargs) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/library/cwm/test/Makefile.am new/yast2-3.2.40/library/cwm/test/Makefile.am --- old/yast2-3.2.39/library/cwm/test/Makefile.am 2017-06-22 16:34:32.454119103 +0200 +++ new/yast2-3.2.40/library/cwm/test/Makefile.am 2017-06-29 10:29:38.910757928 +0200 @@ -2,6 +2,7 @@ abstract_widget_test.rb \ common_widgets_test.rb \ custom_widget_test.rb \ + dialog_test.rb \ pager_test.rb \ replace_point_test.rb \ table_test.rb \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/library/cwm/test/dialog_test.rb new/yast2-3.2.40/library/cwm/test/dialog_test.rb --- old/yast2-3.2.39/library/cwm/test/dialog_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.2.40/library/cwm/test/dialog_test.rb 2017-06-29 10:29:38.910757928 +0200 @@ -0,0 +1,48 @@ +#! /usr/bin/env rspec +require_relative "test_helper" + +require "cwm/dialog" +require "cwm/rspec" + +describe "CWM::Dialog" do + class TestCWMDialog < CWM::Dialog + def contents + VBox() + end + end + subject { TestCWMDialog.new } + + include_examples "CWM::Dialog" + + describe ".run" do + it "opens a dialog when needed, and calls CWM#show" do + expect(Yast::Wizard).to receive(:IsWizardDialog).and_return(false) + expect(Yast::Wizard).to receive(:CreateDialog) + expect(Yast::Wizard).to receive(:CloseDialog) + expect(Yast::CWM).to receive(:show).and_return(:launch) + + expect(subject.class.run).to eq(:launch) + end + + it "does not open a dialog when not needed, and calls CWM#show" do + expect(Yast::Wizard).to receive(:IsWizardDialog).and_return(true) + expect(Yast::Wizard).to_not receive(:CreateDialog) + expect(Yast::Wizard).to_not receive(:CloseDialog) + expect(Yast::CWM).to receive(:show).and_return(:launch) + + expect(subject.class.run).to eq(:launch) + end + end + + describe "#replace_true" do + it "replaces true" do + expect(subject.send(:replace_true, true, :new)).to eq :new + end + + it "does not replace others" do + expect(subject.send(:replace_true, nil, :new)).to eq nil + expect(subject.send(:replace_true, false, :new)).to eq false + expect(subject.send(:replace_true, :old, :new)).to eq :old + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/library/general/src/Makefile.am new/yast2-3.2.40/library/general/src/Makefile.am --- old/yast2-3.2.39/library/general/src/Makefile.am 2017-06-22 16:34:32.490119103 +0200 +++ new/yast2-3.2.40/library/general/src/Makefile.am 2017-06-29 10:29:38.954757928 +0200 @@ -91,6 +91,7 @@ lib/ui/dialog.rb \ lib/ui/installation_dialog.rb \ lib/ui/event_dispatcher.rb \ + lib/ui/greasemonkey.rb \ lib/ui/service_status.rb \ lib/ui/widgets.rb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/library/general/src/lib/ui/greasemonkey.rb new/yast2-3.2.40/library/general/src/lib/ui/greasemonkey.rb --- old/yast2-3.2.39/library/general/src/lib/ui/greasemonkey.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.2.40/library/general/src/lib/ui/greasemonkey.rb 2017-06-29 10:29:38.954757928 +0200 @@ -0,0 +1,264 @@ +# encoding: utf-8 + +# Copyright (c) 2012 Novell, Inc. +# +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of version 2 of the GNU General Public License as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, contact Novell, Inc. +# +# To contact Novell about this file by physical or electronic mail, you may +# find current contact information at www.novell.com. + +require "yast" + +module UI + # UI layout helpers. + # + # These started out in the Expert Partitioner in yast2-storage. + # The use case is reusing pieces of this legacy code in the new + # yast2-partitioner. + # That is why the API and the implementation look old. + module Greasemonkey + include Yast::UIShortcuts + extend Yast::UIShortcuts + + Builtins = Yast::Builtins + Convert = Yast::Convert + Ops = Yast::Ops + + Yast.import "Directory" + + @handlers = [ + :VStackFrames, + :FrameWithMarginBox, + :ComboBoxSelected, + :LeftRadioButton, + :LeftRadioButtonWithAttachment, + :LeftCheckBox, + :LeftCheckBoxWithAttachment, + :IconAndHeading + ] + + # The compatibility API needs CamelCase method names + # rubocop:disable MethodName + + # Wrap terms in a VBox with small vertical spacings in between. + # @param old [Yast::Term] + # @return [Yast::Term] + # @example + # term( + # :VStackFrames, + # Frame("f1"), + # Frame("f2"), + # Frame("f3") + # ) + # -> + # VBox( + # Frame("f1"), + # VSpacing(0.45), + # Frame("f2"), + # VSpacing(0.45), + # Frame("f3") + # ) + def VStackFrames(old) + frames = Convert.convert( + Builtins.argsof(old), + from: "list", + to: "list <term>" + ) + + new = VBox() + Builtins.foreach(frames) do |frame| + new = Builtins.add(new, VSpacing(0.45)) if Builtins.size(new) != 0 + new = Builtins.add(new, frame) + end + new + end + module_function :VStackFrames + + # @param old [Yast::Term] + # @return [Yast::Term] + # @example + # term(:FrameWithMarginBox, "Title", "arg1", "arg2") + # -> + # Frame("Title", MarginBox(1.45, 0.45, "arg1", "arg2")) + def FrameWithMarginBox(old) + title = Ops.get_string(old, 0, "error") + args = Builtins.sublist(Builtins.argsof(old), 1) + Frame( + title, + Builtins.toterm(:MarginBox, Builtins.union([1.45, 0.45], args)) + ) + end + module_function :FrameWithMarginBox + + # @param old [Yast::Term] + # @return [Yast::Term] + # @example + # term( + # :ComboBoxSelected, + # Id(:wish), Opt(:notify), "Wish", + # [ + # Item(Id(:time), "Time"), + # Item(Id(:love), "Love"), + # Item(Id(:money), "Money") + # ], + # Id(:love) + # ) + # -> + # ComboBox( + # Id(:wish), Opt(:notify), "Wish", + # [ + # Item(Id(:time), "Time", false), + # Item(Id(:love), "Love", true), + # Item(Id(:money), "Money", false) + # ] + # ) + def ComboBoxSelected(old) + args = Builtins.argsof(old) + + tmp = Builtins.sublist(args, 0, Ops.subtract(Builtins.size(args), 2)) + items = Ops.get_list(args, Ops.subtract(Builtins.size(args), 2), []) + id = Ops.get_term(args, Ops.subtract(Builtins.size(args), 1), Id()) + + items = Builtins.maplist(items) do |item| + Item(Ops.get(item, 0), Ops.get(item, 1), Ops.get(item, 0) == id) + end + + Builtins.toterm(:ComboBox, Builtins.add(tmp, items)) + end + module_function :ComboBoxSelected + + # @param old [Yast::Term] + # @return [Yast::Term] + # @example + # term(:LeftRadioButton, Id(...), "args") + # -> + # Left(RadioButton(Id(...), "args")) + def LeftRadioButton(old) + Left(Builtins.toterm(:RadioButton, Builtins.argsof(old))) + end + module_function :LeftRadioButton + + # NOTE that it does not expand the nested + # Greasemonkey term LeftRadioButton! {#transform} does that. + # @param old [Yast::Term] + # @return [Yast::Term] + # @example + # term(:LeftRadioButtonWithAttachment, "foo", "bar", "contents") + # -> + # VBox( + # term(:LeftRadioButton, "foo", "bar"), + # HBox(HSpacing(4), "contents") + # ) + def LeftRadioButtonWithAttachment(old) + args = Builtins.argsof(old) + + tmp1 = Builtins.sublist(args, 0, Ops.subtract(Builtins.size(args), 1)) + tmp2 = Ops.get(args, Ops.subtract(Builtins.size(args), 1)) + + if tmp2 == Empty() # rubocop:disable Style/GuardClause + return VBox(Builtins.toterm(:LeftRadioButton, tmp1)) + else + return VBox( + Builtins.toterm(:LeftRadioButton, tmp1), + HBox(HSpacing(4), tmp2) + ) + end + end + module_function :LeftRadioButtonWithAttachment + + # @param old [Yast::Term] + # @return [Yast::Term] + # @example + # term(:LeftCheckBox, Id(...), "args") + # -> + # Left(CheckBox(Id(...), "args")) + def LeftCheckBox(old) + Left(Builtins.toterm(:CheckBox, Builtins.argsof(old))) + end + module_function :LeftCheckBox + + # NOTE that it does not expand the nested + # Greasemonkey term LeftCheckBox! {#transform} does that. + # @param old [Yast::Term] + # @return [Yast::Term] + # @example + # term(:LeftCheckBoxWithAttachment, "foo", "bar", "contents") + # -> + # VBox( + # term(:LeftCheckBox, "foo", "bar"), + # HBox(HSpacing(4), "contents") + # ) + def LeftCheckBoxWithAttachment(old) + args = Builtins.argsof(old) + + tmp1 = Builtins.sublist(args, 0, Ops.subtract(Builtins.size(args), 1)) + tmp2 = Ops.get(args, Ops.subtract(Builtins.size(args), 1)) + + if tmp2 == Empty() # rubocop:disable Style/GuardClause + return VBox(Builtins.toterm(:LeftCheckBox, tmp1)) + else + return VBox( + Builtins.toterm(:LeftCheckBox, tmp1), + HBox(HSpacing(4), tmp2) + ) + end + end + module_function :LeftCheckBoxWithAttachment + + # @param old [Yast::Term] + # @return [Yast::Term] + # @example + # term(:IconAndHeading, "title", "icon") + # -> + # Left( + # HBox( + # Image("/usr/share/YaST2/theme/current/icons/22x22/apps/icon", ""), + # Heading("title") + # ) + # ) + def IconAndHeading(old) + args = Builtins.argsof(old) + + title = Ops.get_string(args, 0, "") + icon = Ops.add( + Ops.add(Yast::Directory.icondir, "22x22/apps/"), + Ops.get_string(args, 1, "") + ) + + Left(HBox(Image(icon, ""), Heading(title))) + end + module_function :IconAndHeading + + # Recursively apply all Greasemonkey methods on *old* + # @param old [Yast::Term] + # @return [Yast::Term] + def Transform(old) + s = Builtins.symbolof(old) + + handler = Greasemonkey.method(s) if @handlers.include?(s) + return Transform(handler.call(old)) if !handler.nil? + + new = Builtins::List.reduce(Builtins.toterm(s), Builtins.argsof(old)) do |tmp, arg| + arg = Transform(Convert.to_term(arg)) if Ops.is_term?(arg) + Builtins.add(tmp, arg) + end + new + end + module_function :Transform + + alias_method :transform, :Transform + module_function :transform + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/library/general/test/Makefile.am new/yast2-3.2.40/library/general/test/Makefile.am --- old/yast2-3.2.39/library/general/test/Makefile.am 2017-06-22 16:34:32.506119103 +0200 +++ new/yast2-3.2.40/library/general/test/Makefile.am 2017-06-29 10:29:38.966757928 +0200 @@ -5,6 +5,7 @@ directory_test.rb \ event_dispatcher_test.rb \ finish_client_test.rb \ + greasemonkey_test.rb \ hooks_test.rb \ linuxrc_test.rb \ os_release_test.rb \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/library/general/test/greasemonkey_test.rb new/yast2-3.2.40/library/general/test/greasemonkey_test.rb --- old/yast2-3.2.39/library/general/test/greasemonkey_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.2.40/library/general/test/greasemonkey_test.rb 2017-06-29 10:29:38.966757928 +0200 @@ -0,0 +1,151 @@ +#! /usr/bin/env rspec +require_relative "test_helper" +require "ui/greasemonkey" + +describe "UI::Greasemonkey" do + RSpec.shared_examples "a Greasemonkey method" do |mname| + it "transforms its argument properly" do + expect(UI::Greasemonkey.public_send(mname, old)).to eq new + end + end + + describe ".VStackFrames" do + let(:old) do + term( + :VStackFrames, + Frame("f1"), + Frame("f2"), + Frame("f3") + ) + end + let(:new) do + VBox( + Frame("f1"), + VSpacing(0.45), + Frame("f2"), + VSpacing(0.45), + Frame("f3") + ) + end + it_behaves_like "a Greasemonkey method", :VStackFrames + end + + describe ".FrameWithMarginBox" do + let(:old) { term(:FrameWithMarginBox, "Title", "arg1", "arg2") } + let(:new) { Frame("Title", MarginBox(1.45, 0.45, "arg1", "arg2")) } + it_behaves_like "a Greasemonkey method", :FrameWithMarginBox + end + + describe ".ComboBoxSelected" do + let(:old) do + term( + :ComboBoxSelected, + Id(:wish), Opt(:notify), "Wish", + [ + Item(Id(:time), "Time"), + Item(Id(:love), "Love"), + Item(Id(:money), "Money") + ], + Id(:love) + ) + end + let(:new) do + ComboBox( + Id(:wish), Opt(:notify), "Wish", + [ + Item(Id(:time), "Time", false), + Item(Id(:love), "Love", true), + Item(Id(:money), "Money", false) + ] + ) + end + it_behaves_like "a Greasemonkey method", :ComboBoxSelected + end + + describe ".LeftRadioButton" do + let(:old) { term(:LeftRadioButton, "some", "args") } + let(:new) { Left(RadioButton("some", "args")) } + it_behaves_like "a Greasemonkey method", :LeftRadioButton + end + + describe ".LeftRadioButtonWithAttachment" do + let(:old) { term(:LeftRadioButtonWithAttachment, "foo", "bar", "contents") } + let(:new) do + VBox( + # NOTE that it does not expand this Greasemonkey term! + term(:LeftRadioButton, "foo", "bar"), + HBox(HSpacing(4), "contents") + ) + end + it_behaves_like "a Greasemonkey method", :LeftRadioButtonWithAttachment + + it "discards the attachment when it is Empty()" do + old = term(:LeftRadioButtonWithAttachment, "foo", "bar", Empty()) + new = VBox(term(:LeftRadioButton, "foo", "bar")) + expect(UI::Greasemonkey.LeftRadioButtonWithAttachment(old)).to eq new + end + end + + describe ".LeftCheckBox" do + let(:old) { term(:LeftCheckBox, "some", "args") } + let(:new) { Left(CheckBox("some", "args")) } + it_behaves_like "a Greasemonkey method", :LeftCheckBox + end + + describe ".LeftCheckBoxWithAttachment" do + let(:old) { term(:LeftCheckBoxWithAttachment, "foo", "bar", "contents") } + let(:new) do + VBox( + # NOTE that it does not expand this Greasemonkey term! + term(:LeftCheckBox, "foo", "bar"), + HBox(HSpacing(4), "contents") + ) + end + it_behaves_like "a Greasemonkey method", :LeftCheckBoxWithAttachment + + it "discards the attachment when it is Empty()" do + old = term(:LeftCheckBoxWithAttachment, "foo", "bar", Empty()) + new = VBox(term(:LeftCheckBox, "foo", "bar")) + expect(UI::Greasemonkey.LeftCheckBoxWithAttachment(old)).to eq new + end + end + + describe ".IconAndHeading" do + let(:old) { term(:IconAndHeading, "title", "icon") } + let(:new) do + Left( + HBox( + Image("/usr/share/YaST2/theme/current/icons/22x22/apps/icon", ""), + Heading("title") + ) + ) + end + it_behaves_like "a Greasemonkey method", :IconAndHeading + end + + describe ".transform" do + it "transforms the term recursively" do + old = term( + :FrameWithMarginBox, + "Title", + VBox( + term(:LeftRadioButton, "arg1"), + VSpacing(3), + term(:LeftRadioButton, "arg2") + ) + ) + new = Frame( + "Title", + MarginBox( + 1.45, 0.45, + VBox( + Left(RadioButton("arg1")), + VSpacing(3), + Left(RadioButton("arg2")) + ) + ) + ) + expect(UI::Greasemonkey.transform(old)).to eq new + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/library/runlevel/test/services_proposal_test.rb new/yast2-3.2.40/library/runlevel/test/services_proposal_test.rb --- old/yast2-3.2.39/library/runlevel/test/services_proposal_test.rb 2017-06-22 16:34:32.550119103 +0200 +++ new/yast2-3.2.40/library/runlevel/test/services_proposal_test.rb 2017-06-29 10:29:39.458757928 +0200 @@ -1,9 +1,5 @@ #!/usr/bin/env rspec - -top_srcdir = File.expand_path("../../../..", __FILE__) -inc_dirs = Dir.glob("#{top_srcdir}/library/*/src") -ENV["Y2DIR"] = inc_dirs.join(":") - +require_relative "test_helper" require "yast" module Yast diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/library/sequencer/Makefile.am new/yast2-3.2.40/library/sequencer/Makefile.am --- old/yast2-3.2.39/library/sequencer/Makefile.am 2017-06-22 16:34:32.550119103 +0200 +++ new/yast2-3.2.40/library/sequencer/Makefile.am 2017-06-29 10:29:39.458757928 +0200 @@ -1,3 +1,3 @@ # Makefile.am for yast2/library/sequencer -SUBDIRS = src testsuite +SUBDIRS = src test testsuite diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/library/sequencer/src/Makefile.am new/yast2-3.2.40/library/sequencer/src/Makefile.am --- old/yast2-3.2.39/library/sequencer/src/Makefile.am 2017-06-22 16:34:32.550119103 +0200 +++ new/yast2-3.2.40/library/sequencer/src/Makefile.am 2017-06-29 10:29:39.462757928 +0200 @@ -7,6 +7,10 @@ ynclude_DATA = \ include/wizard/sequencer.rb -EXTRA_DIST = $(module_DATA) $(ynclude_DATA) +ylibdir = @ylibdir@/ui +ylib_DATA = \ + lib/ui/sequence.rb -include $(top_srcdir)/Makefile.am.common \ No newline at end of file +EXTRA_DIST = $(module_DATA) $(ynclude_DATA) $(ylib_DATA) + +include $(top_srcdir)/Makefile.am.common diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/library/sequencer/src/lib/ui/sequence.rb new/yast2-3.2.40/library/sequencer/src/lib/ui/sequence.rb --- old/yast2-3.2.39/library/sequencer/src/lib/ui/sequence.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.2.40/library/sequencer/src/lib/ui/sequence.rb 2017-06-29 10:29:39.462757928 +0200 @@ -0,0 +1,77 @@ +require "yast" +Yast.import "Sequencer" + +module UI + # A {UI::Sequence} is an object-oriented interface for the good old + # {Yast::SequencerClass Yast::Sequencer}. + # In the simple case it runs a sequence of dialogs + # connected by Back and Next buttons. + class Sequence + include Yast::I18n + + # A reserved name in the sequence hash to mark the graph entry point. + START = "ws_start".freeze + + # A drop-in replacement for + # {Yast::SequencerClass#Run Yast::Sequencer.Run} + def self.run(aliases, sequence) + Yast::Sequencer.Run(aliases, sequence) + end + + # A replacement for + # {Yast::SequencerClass#Run Yast::Sequencer.Run} + # but smarter: + # - auto :abort (see {#abortable}) + # - *aliases* are assumed to be method names if unspecified + # (see {#from_methods}) + def run(aliases: nil, sequence:) + aliases ||= from_methods(sequence) + self.class.run(aliases, abortable(sequence)) + end + + # Add !{abort: :abort} transitions if missing + # (an :abort from a dialog should :abort the whole sequence) + def abortable(sequence_hash) + sequence_hash.map do |name, destination| + if name == START + [name, destination] + else + [name, { abort: :abort }.merge(destination)] + end + end.to_h + end + + # Make `aliases` from `sequence_hash` assuming there is a method + # for each alias. + # @return [Hash{String => Proc}] aliases + def from_methods(sequence_hash) + sequence_hash.keys.map do |name| + next nil if name == START + if self.class.skip_stack?(name) + [name, [method(name), true]] + else + [name, method(name)] + end + end.compact.to_h + end + + class << self + # Declare that a method is skipped when going :back, + # useful for noninteractive steps. + # (also see Yast::SequencerClass#WS_special) + # @param name [Symbol,String] method name + def skip_stack(name) + @skip_stack ||= {} + @skip_stack[name.to_sym] = true + end + + # @param name [Symbol,String] method name + # @return [Boolean] + # @api private + def skip_stack?(name) + @skip_stack ||= {} + @skip_stack[name.to_sym] + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/library/sequencer/test/Makefile.am new/yast2-3.2.40/library/sequencer/test/Makefile.am --- old/yast2-3.2.39/library/sequencer/test/Makefile.am 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.2.40/library/sequencer/test/Makefile.am 2017-06-29 10:29:39.462757928 +0200 @@ -0,0 +1,7 @@ +TESTS = \ + sequence_test.rb + +TEST_EXTENSIONS = .rb +RB_LOG_COMPILER = rspec +VERBOSE = 1 +EXTRA_DIST = $(TESTS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/library/sequencer/test/sequence_test.rb new/yast2-3.2.40/library/sequencer/test/sequence_test.rb --- old/yast2-3.2.39/library/sequencer/test/sequence_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.2.40/library/sequencer/test/sequence_test.rb 2017-06-29 10:29:39.462757928 +0200 @@ -0,0 +1,99 @@ +require_relative "test_helper" +require "ui/sequence" + +describe UI::Sequence do + describe "#abortable" do + it "adds aborting edges where missing" do + old = { + "ws_start" => "read", + "read" => { next: "process" }, + "process" => { next: "write" }, + "write" => { next: :next } + } + new = { + "ws_start" => "read", + "read" => { abort: :abort, next: "process" }, + "process" => { abort: :abort, next: "write" }, + "write" => { abort: :abort, next: :next } + } + + expect(subject.abortable(old)).to eq(new) + end + + it "keeps existing aborting edges" do + old = { + "ws_start" => "read", + "process" => { abort: :back, next: "write" }, + "write" => { next: :next } + } + new = { + "ws_start" => "read", + "process" => { abort: :back, next: "write" }, + "write" => { abort: :abort, next: :next } + } + + expect(subject.abortable(old)).to eq(new) + end + end + + describe "#from_methods" do + class TestSequence < UI::Sequence + def skipped + end + skip_stack :skipped + + def first + end + + def second + end + end + subject { TestSequence.new } + + it "defines the aliases from instance methods" do + seq = { + "ws_start" => "skipped", + "skipped" => { next: "first" }, + "first" => { next: "second" }, + "second" => { next: :next } + } + wanted = { + "skipped" => [subject.method(:skipped), true], + "first" => subject.method(:first), + "second" => subject.method(:second) + } + + expect(subject.from_methods(seq)).to eq(wanted) + end + + it "does not confuse skip_stack across classes" do + class TestSequenceA < UI::Sequence + def doit + end + skip_stack :doit + end + + class TestSequenceB < UI::Sequence + def doit + end + end + + seq = { + "ws_start" => "doit", + "doit" => { next: :next } + } + + a = TestSequenceA.new + b = TestSequenceB.new + wanted_a = { + "doit" => [a.method(:doit), true] + } + wanted_b = { + "doit" => b.method(:doit) + } + + expect(a.from_methods(seq)).to eq(wanted_a) + expect(b.from_methods(seq)).to eq(wanted_b) + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/library/sequencer/test/test_helper.rb new/yast2-3.2.40/library/sequencer/test/test_helper.rb --- old/yast2-3.2.39/library/sequencer/test/test_helper.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.2.40/library/sequencer/test/test_helper.rb 2017-06-29 10:29:39.462757928 +0200 @@ -0,0 +1 @@ +require_relative "../../../test/test_helper.rb" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/package/yast2.changes new/yast2-3.2.40/package/yast2.changes --- old/yast2-3.2.39/package/yast2.changes 2017-06-22 16:34:32.606119103 +0200 +++ new/yast2-3.2.40/package/yast2.changes 2017-06-29 10:29:39.958757928 +0200 @@ -1,4 +1,14 @@ ------------------------------------------------------------------- +Fri Jun 23 07:26:03 UTC 2017 - [email protected] + +- Support for the new Expert Partitioner (boo#1039901): +- Added UI::Sequence, UI::Greasemonkey +- Added CWM::Dialog +- RSpec.shared_examples for CWM: Page, PushButton, RadioButtons, + RichText. +- 3.2.40 + +------------------------------------------------------------------- Thu Jun 22 11:27:46 UTC 2017 - [email protected] - Add hint for UI about application name and its icon (bsc#1037891) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.2.39/package/yast2.spec new/yast2-3.2.40/package/yast2.spec --- old/yast2-3.2.39/package/yast2.spec 2017-06-22 16:34:32.606119103 +0200 +++ new/yast2-3.2.40/package/yast2.spec 2017-06-29 10:29:39.958757928 +0200 @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.2.39 +Version: 3.2.40 Release: 0 Summary: YaST2 - Main Package License: GPL-2.0
