<commit_before>require "swt_shoes/spec_helper"

describe Shoes::Swt::App do
  let(:opts) { {:background => Shoes::COLORS[:salmon], :resizable => false} }
  let(:app) { double('app', :opts => opts, :width => 0, :height => 0, :app_title => 'mock') }

  let(:opts_resizable) { {:background => Shoes::COLORS[:salmon], :resizable => true} }
  let(:app_resizable) { double('app', :opts => opts_resizable, :width => 0, :height => 0, :app_title => 'mock') }

  subject { Shoes::Swt::App.new(app) }

  before :each do
    Shoes::Swt.unregister_all
  end

  context "when registering" do
    it "registers" do
      old_apps_length = Shoes::Swt.apps.length
      subject
      Shoes::Swt.apps.length.should eq(old_apps_length + 1)
      Shoes::Swt.apps.include?(subject).should be_true
    end
  end

  context "when running on a mac" do
    let(:the_display) { ::Swt::Widgets::Display }

    it "should set the menubar title" do
      the_display.should_receive(:app_name=).with('mock')
      subject
    end
  end

  context "main window style" do
    base_bitmask =
        Shoes::Swt::App::Swt::SWT::CLOSE |
        Shoes::Swt::App::Swt::SWT::MIN |
        Shoes::Swt::App::Swt::SWT::MAX |
        Shoes::Swt::App::Swt::SWT::V_SCROLL

    it "should return a bitmask that represents not being resizable" do
      subject.send(:main_window_style).should eq(base_bitmask)
    end

    it "should return a bitmask that represents being resizable" do
      resizable = Shoes::Swt::App.new app_resizable
      resizable.send(:main_window_style).should eq(base_bitmask | Shoes::Swt::App::Swt::SWT::RESIZE )
    end
  end

end
<commit_msg>A bit of rework on swt/app_spec from a PR<commit_after>require "swt_shoes/spec_helper"

describe Shoes::Swt::App do
  let(:opts) { {:background => Shoes::COLORS[:salmon], :resizable => true} }
  let(:app) { double('app', :opts => opts,
                            :width => 0,
                            :height => 0,
                            :app_title => 'mock') }

  let(:opts_unresizable) { {:background => Shoes::COLORS[:salmon],
                            :resizable => false} }
  let(:app_unresizable) { double('app', :opts => opts_unresizable,
                                        :width => 0,
                                        :height => 0,
                                        :app_title => 'mock') }

  subject { Shoes::Swt::App.new(app) }

  before :each do
    Shoes::Swt.unregister_all
  end

  context "when registering" do
    it "registers" do
      old_apps_length = Shoes::Swt.apps.length
      subject
      Shoes::Swt.apps.length.should eq(old_apps_length + 1)
      Shoes::Swt.apps.include?(subject).should be_true
    end
  end

  context "when running on a mac" do
    let(:the_display) { ::Swt::Widgets::Display }

    it "should set the menubar title" do
      the_display.should_receive(:app_name=).with('mock')
      subject
    end
  end

  context "main window style" do
    BASE_BITMASK =  Swt::SWT::CLOSE   |
                    Swt::SWT::MIN     |
                    Swt::SWT::MAX     |
                    Swt::SWT::RESIZE  |
                    Swt::SWT::V_SCROLL

    it "should return a bitmask that represents not being resizable" do
      subject.send(:main_window_style).should eq(BASE_BITMASK)
    end

    it "should return a bitmask that represents being resizable" do
      resizable = Shoes::Swt::App.new app_unresizable
      resizable.send(:main_window_style).should eq(BASE_BITMASK & ~Swt::SWT::RESIZE )
    end
  end

end

{'fraction_non_alphanumeric': 0.13342816500711238, 'fraction_numerical': 0.002844950213371266, 'mean_word_length': 2.573170731707317, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2730501', 'n_tokens_mistral': 1184, 'n_tokens_neox': 1144, 'n_words': 253}