require 'spec_helper' require 'json' # Unit tests for AsposeCellsCloud::CellsRangesApi # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) # Please update as you see appropriate describe 'CellsRangesApi' do before do @instance = AsposeCellsCloud::CellsApi.new($client_id,$client_secret,$api_version,$baseurl) $VERBOSE = nil end after do # run after each test end # unit tests for cells_ranges_get_worksheet_cells_range_value # Get cells list in a range by range name or row column indexes # # @param name workbook name # @param sheet_name worksheet name # @param [Hash] opts the optional parameters # @option opts [String] :namerange range name, for example: 'A1:B2' or 'range_name1' # @option opts [Integer] :first_row the first row of the range # @option opts [Integer] :first_column the first column of the range # @option opts [Integer] :row_count the count of rows in the range # @option opts [Integer] :column_count the count of columns in the range # @option opts [String] :folder Workbook folder. # @option opts [String] :storage storage name. # @return [RangeValueResponse] describe 'cells_ranges_get_worksheet_cells_range_value test' do it "should work" do name = $BOOK1 sheet_name = $SHEET1 namerange = 'A1:B3' first_row = 1 first_column = 1 row_count = 3 column_count = 2 folder = $TEMPFOLDER result = @instance.upload_file( folder+"/"+name, ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) }) expect(result.uploaded.size).to be > 0 result = @instance.cells_ranges_get_worksheet_cells_range_value(name, sheet_name, { :namerange=>namerange, :first_row=>first_row, :first_column=>first_column, :row_count=>row_count, :column_count=>column_count,:folder=>folder}) expect(result.code).to eql(200) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_ranges_post_worksheet_cells_range_column_width # Set column width of range # # @param name # @param sheet_name # @param value # @param [Hash] opts the optional parameters # @option opts [Range] :range # @option opts [String] :folder # @option opts [String] :storage storage name. # @return [CellsCloudResponse] describe 'cells_ranges_post_worksheet_cells_range_column_width test' do it "should work" do name = $BOOK1 sheet_name = $SHEET1 value = 10.01 range = AsposeCellsCloud::Range.new({:ColumnCount=>1,:ColumnWidth=>10.01,:FirstColumn=>1,:FirstRow=>1,:RowCount=>10}) folder = $TEMPFOLDER result = @instance.upload_file( folder+"/"+name, ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) }) expect(result.uploaded.size).to be > 0 result = @instance.cells_ranges_post_worksheet_cells_range_column_width(name, sheet_name, value, {:range=>range,:folder=>folder}) expect(result.code).to eql(200) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_ranges_post_worksheet_cells_range_merge # Combines a range of cells into a single cell. # # @param name workbook name # @param sheet_name worksheet name # @param [Hash] opts the optional parameters # @option opts [Range] :range range in worksheet # @option opts [String] :folder Workbook folder. # @option opts [String] :storage storage name. # @return [CellsCloudResponse] describe 'cells_ranges_post_worksheet_cells_range_merge test' do it "should work" do name = $BOOK1 sheet_name = $SHEET1 range = AsposeCellsCloud::Range.new({:ColumnCount=>1,:ColumnWidth=>10.01,:FirstColumn=>1,:FirstRow=>1,:RowCount=>10}) folder = $TEMPFOLDER result = @instance.upload_file( folder+"/"+name, ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) }) expect(result.uploaded.size).to be > 0 result = @instance.cells_ranges_post_worksheet_cells_range_merge(name, sheet_name, { :range=>range, :folder=>folder}) expect(result.code).to eql(200) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_ranges_post_worksheet_cells_range_move_to # Move the current range to the dest range. # # @param name workbook name # @param sheet_name worksheet name # @param dest_row The start row of the dest range. # @param dest_column The start column of the dest range. # @param [Hash] opts the optional parameters # @option opts [Range] :range range in worksheet # @option opts [String] :folder Workbook folder. # @option opts [String] :storage storage name. # @return [CellsCloudResponse] describe 'cells_ranges_post_worksheet_cells_range_move_to test' do it "should work" do name = $BOOK1 sheet_name = $SHEET1 dest_row = 1 dest_column = 1 range = AsposeCellsCloud::Range.new({:ColumnCount=>1,:ColumnWidth=>10.01,:FirstColumn=>1,:FirstRow=>1,:RowCount=>10}) folder = $TEMPFOLDER result = @instance.upload_file( folder+"/"+name, ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) }) expect(result.uploaded.size).to be > 0 result = @instance.cells_ranges_post_worksheet_cells_range_move_to(name, sheet_name, dest_row, dest_column, { :range=>range, :folder=>folder}) expect(result.code).to eql(200) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_ranges_post_worksheet_cells_range_outline_border # Sets outline border around a range of cells. # # @param name workbook name # @param sheet_name worksheet name # @param [Hash] opts the optional parameters # @option opts [RangeSetOutlineBorderRequest] :range_operate Range Set OutlineBorder Request # @option opts [String] :folder Workbook folder. # @option opts [String] :storage storage name. # @return [CellsCloudResponse] describe 'cells_ranges_post_worksheet_cells_range_outline_border test' do it "should work" do name = $BOOK1 sheet_name = $SHEET1 color = AsposeCellsCloud::Color.new({:A=>255}) range = AsposeCellsCloud::Range.new({:ColumnCount=>1,:FirstColumn=>1,:FirstRow=>1,:RowCount=>10}) range_operate = AsposeCellsCloud::RangeSetOutlineBorderRequest.new({:borderEdge=>'LeftBorder',:borderStyle=>'Dotted',:borderColor=>color,:Range=>range }) folder = $TEMPFOLDER result = @instance.upload_file( folder+"/"+name, ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) }) expect(result.uploaded.size).to be > 0 result = @instance.cells_ranges_post_worksheet_cells_range_outline_border(name, sheet_name, { :range_operate=>range_operate, :folder=>folder}) expect(result.code).to eql(200) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_ranges_post_worksheet_cells_range_row_height # set row height of range # # @param name # @param sheet_name # @param value # @param [Hash] opts the optional parameters # @option opts [Range] :range # @option opts [String] :folder # @option opts [String] :storage storage name. # @return [CellsCloudResponse] describe 'cells_ranges_post_worksheet_cells_range_row_height test' do it "should work" do name = $BOOK1 sheet_name = $SHEET1 value = 10.01 range = AsposeCellsCloud::Range.new({:ColumnCount=>1,:ColumnWidth=>10.01,:FirstColumn=>1,:FirstRow=>1,:RowCount=>10}) folder = $TEMPFOLDER result = @instance.upload_file( folder+"/"+name, ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) }) expect(result.uploaded.size).to be > 0 result = @instance.cells_ranges_post_worksheet_cells_range_row_height(name, sheet_name, value, { :range=>range, :folder=>folder}) expect(result.code).to eql(200) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_ranges_post_worksheet_cells_range_style # Sets the style of the range. # # @param name workbook name # @param sheet_name worksheet name # @param [Hash] opts the optional parameters # @option opts [RangeSetStyleRequest] :range_operate Range Set Style Request # @option opts [String] :folder Workbook folder. # @option opts [String] :storage storage name. # @return [CellsCloudResponse] describe 'cells_ranges_post_worksheet_cells_range_style test' do it "should work" do name = $BOOK1 sheet_name = $SHEET1 range_operate = AsposeCellsCloud::RangeSetStyleRequest.new({:Range=>AsposeCellsCloud::Range.new({:ColumnCount=>1,:FirstColumn=>1,:FirstRow=>1,:RowCount=>10} ), :Style=>AsposeCellsCloud::Style.new()}) folder = $TEMPFOLDER result = @instance.upload_file( folder+"/"+name, ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) }) expect(result.uploaded.size).to be > 0 result = @instance.cells_ranges_post_worksheet_cells_range_style(name, sheet_name, {:range_operate=>range_operate, :folder=>folder}) expect(result.code).to eql(200) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_ranges_post_worksheet_cells_range_unmerge # Unmerges merged cells of this range. # # @param name workbook name # @param sheet_name worksheet name # @param [Hash] opts the optional parameters # @option opts [Range] :range range in worksheet # @option opts [String] :folder Workbook folder. # @option opts [String] :storage storage name. # @return [CellsCloudResponse] describe 'cells_ranges_post_worksheet_cells_range_unmerge test' do it "should work" do name = $BOOK1 sheet_name = $SHEET1 range = AsposeCellsCloud::Range.new({:ColumnCount=>1,:ColumnWidth=>10.01,:FirstColumn=>1,:FirstRow=>1,:RowCount=>10}) folder = $TEMPFOLDER result = @instance.upload_file( folder+"/"+name, ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) }) expect(result.uploaded.size).to be > 0 result = @instance.cells_ranges_post_worksheet_cells_range_unmerge(name, sheet_name, {:range=>range, :folder=>folder}) expect(result.code).to eql(200) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_ranges_post_worksheet_cells_range_value # Puts a value into the range, if appropriate the value will be converted to other data type and cell's number format will be reset. # # @param name workbook name # @param sheet_name worksheet name # @param value Input value # @param [Hash] opts the optional parameters # @option opts [Range] :range range in worksheet # @option opts [BOOLEAN] :is_converted True: converted to other data type if appropriate. # @option opts [BOOLEAN] :set_style True: set the number format to cell's style when converting to other data type # @option opts [String] :folder Workbook folder. # @option opts [String] :storage storage name. # @return [CellsCloudResponse] describe 'cells_ranges_post_worksheet_cells_range_value test' do it "should work" do name = $BOOK1 sheet_name = $SHEET1 value = 10 range = AsposeCellsCloud::Range.new({:ColumnCount=>1,:ColumnWidth=>10.01,:FirstColumn=>1,:FirstRow=>1,:RowCount=>10}) is_converted = true set_style = true folder = $TEMPFOLDER result = @instance.upload_file( folder+"/"+name, ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) }) expect(result.uploaded.size).to be > 0 result = @instance.cells_ranges_post_worksheet_cells_range_value(name, sheet_name, value, {:range=>range, :is_converted=>is_converted, :set_style=>set_style, :folder=>folder}) expect(result.code).to eql(200) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_ranges_post_worksheet_cells_ranges # copy range in the worksheet # # @param name workbook name # @param sheet_name worksheet name # @param [Hash] opts the optional parameters # @option opts [RangeCopyRequest] :range_operate copydata,copystyle,copyto,copyvalue # @option opts [String] :folder Workbook folder. # @option opts [String] :storage storage name. # @return [CellsCloudResponse] describe 'cells_ranges_post_worksheet_cells_ranges test' do it "should work" do name = $BOOK1 sheet_name = $SHEET1 range_operate = AsposeCellsCloud::RangeCopyRequest.new({:Operate=>'copydata',:PasteOptions=>AsposeCellsCloud::PasteOptions.new({:OnlyVisibleCells=>true}),:Source=>AsposeCellsCloud::Range.new({:ColumnCount=>1,:FirstColumn=>1,:FirstRow=>1,:RowCount=>10}),:Target=>AsposeCellsCloud::Range.new({:ColumnCount=>1,:FirstColumn=>11,:FirstRow=>11,:RowCount=>10})}) folder = $TEMPFOLDER result = @instance.upload_file( folder+"/"+name, ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) }) expect(result.uploaded.size).to be > 0 result = @instance.cells_ranges_post_worksheet_cells_ranges(name, sheet_name, { :range_operate=>range_operate , :folder=>folder}) expect(result.code).to eql(200) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end end