Skip to content

Commit

Permalink
Add device Google Pixel 5 (#20389)
Browse files Browse the repository at this point in the history
  • Loading branch information
denrase committed Jun 25, 2022
1 parent 3f88926 commit b12c325
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions frameit/lib/frameit/device_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ module Color
MIDNIGHT ||= "Midnight"
STARLIGHT ||= "Starlight"
SIERRA ||= "Sierra"
SORTA_SAGE ||= "Sorta Sage"

def self.all_colors
Color.constants.map { |c| Color.const_get(c).upcase.gsub(' ', '_') }
Expand Down Expand Up @@ -85,6 +86,7 @@ module Devices
# Google Pixel 4's priority should be higher than Samsung Galaxy S10+ (priority 8):
GOOGLE_PIXEL_4 ||= Frameit::Device.new("google-pixel-4", "Google Pixel 4", 9, [[1080, 2280], [2280, 1080]], 444, Color::JUST_BLACK, Platform::ANDROID)
GOOGLE_PIXEL_4_XL ||= Frameit::Device.new("google-pixel-4-xl", "Google Pixel 4 XL", 9, [[1440, 3040], [3040, 1440]], 537, Color::JUST_BLACK, Platform::ANDROID)
GOOGLE_PIXEL_5 ||= Frameit::Device.new("google-pixel-5", "Google Pixel 5", 10, [[1080, 2340], [2340, 1080]], 432, Color::JUST_BLACK, Platform::ANDROID)
HTC_ONE_A9 ||= Frameit::Device.new("htc-one-a9", "HTC One A9", 6, [[1080, 1920], [1920, 1080]], 441, Color::BLACK, Platform::ANDROID)
HTC_ONE_M8 ||= Frameit::Device.new("htc-one-m8", "HTC One M8", 3, [[1080, 1920], [1920, 1080]], 441, Color::BLACK, Platform::ANDROID)
HUAWEI_P8 ||= Frameit::Device.new("huawei-p8", "Huawei P8", 5, [[1080, 1920], [1920, 1080]], 424, Color::BLACK, Platform::ANDROID)
Expand Down
6 changes: 6 additions & 0 deletions frameit/spec/device_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ def expect_forced_screen_size(value)
end

describe "valid Android screen sizes" do

it "should detect Google Pixel 5 in portrait and landscape based on priority" do
expect_screen_size_from_file("pixel-portrait{1080x2340}.png", Platform::ANDROID).to eq(Devices::GOOGLE_PIXEL_5)
expect_screen_size_from_file("pixel-landscape{2340x1080}.png", Platform::ANDROID).to eq(Devices::GOOGLE_PIXEL_5)
end

it "should detect Google Pixel 3 XL in portrait and landscape based on priority" do
expect_screen_size_from_file("pixel-portrait{1440x2960}.png", Platform::ANDROID).to eq(Devices::GOOGLE_PIXEL_3_XL)
expect_screen_size_from_file("pixel-landscape{2960x1440}.png", Platform::ANDROID).to eq(Devices::GOOGLE_PIXEL_3_XL)
Expand Down

0 comments on commit b12c325

Please sign in to comment.