Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Shiny examples testing automation #87

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
7 changes: 7 additions & 0 deletions 001-hello-new/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Title: Hello Shiny!
Author: RStudio, Inc.
AuthorUrl: http://www.rstudio.com/
License: MIT
DisplayMode: Showcase
Tags: getting-started
Type: Shiny
3 changes: 3 additions & 0 deletions 001-hello-new/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This small Shiny application demonstrates Shiny's automatic UI updates.

Move the *Number of bins* slider and notice how the `renderPlot` expression is automatically re-evaluated when its dependant, `input$bins`, changes, causing a histogram with a new number of bins to be rendered.
59 changes: 59 additions & 0 deletions 001-hello-new/app.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
library(shiny)

# Define UI for app that draws a histogram ----
ui <- fluidPage(

# App title ----
titlePanel("Hello Shiny!"),

# Sidebar layout with input and output definitions ----
sidebarLayout(

# Sidebar panel for inputs ----
sidebarPanel(

# Input: Slider for the number of bins ----
sliderInput(inputId = "bins",
label = "Number of bins:",
min = 1,
max = 50,
value = 30)

),

# Main panel for displaying outputs ----
mainPanel(

# Output: Histogram ----
plotOutput(outputId = "distPlot")

)
)
)

# Define server logic required to draw a histogram ----
server <- function(input, output) {

# Histogram of the Old Faithful Geyser Data ----
# with requested number of bins
# This expression that generates a histogram is wrapped in a call
# to renderPlot to indicate that:
#
# 1. It is "reactive" and therefore should be automatically
# re-executed when inputs (input$bins) change
# 2. Its output type is a plot
output$distPlot <- renderPlot({

x <- faithful$waiting
bins <- seq(min(x), max(x), length.out = input$bins + 1)

hist(x, breaks = bins, col = "#75AADB", border = "white",
xlab = "Waiting time to next eruption (in mins)",
main = "Histogram of waiting times")

})

}

# Create Shiny app ----
shinyApp(ui = ui, server = server)
44 changes: 44 additions & 0 deletions 001-hello-new/tests/mytest-current/001.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"input": {
"bins": 30
},
"output": {
"distPlot": {
"src": "[image data sha1: 62f07fdafae066c5a8e3a84fe6818264c35b29bf]",
"width": 628,
"height": 400,
"coordmap": {
"panels": [
{
"domain": {
"left": 40.88,
"right": 98.12,
"bottom": -1.08,
"top": 28.08
},
"range": {
"left": 59.04,
"right": 597.76,
"bottom": 325.56,
"top": 58.04
},
"log": {
"x": null,
"y": null
},
"mapping": {

}
}
],
"dims": {
"width": 628,
"height": 400
}
}
}
},
"export": {

}
}
Binary file added 001-hello-new/tests/mytest-current/001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions 001-hello-new/tests/mytest-current/002.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"input": {
"bins": 8
},
"output": {
"distPlot": {
"src": "[image data sha1: ccbab99b1f814c02c1b46553eda17b543ce4a923]",
"width": 628,
"height": 400,
"coordmap": {
"panels": [
{
"domain": {
"left": 40.88,
"right": 98.12,
"bottom": -2.8,
"top": 72.8
},
"range": {
"left": 59.04,
"right": 597.76,
"bottom": 325.56,
"top": 58.04
},
"log": {
"x": null,
"y": null
},
"mapping": {

}
}
],
"dims": {
"width": 628,
"height": 400
}
}
}
},
"export": {

}
}
Binary file added 001-hello-new/tests/mytest-current/002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions 001-hello-new/tests/mytest-current/003.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"input": {
"bins": 49
},
"output": {
"distPlot": {
"src": "[image data sha1: 3f341a0ffad911fe236eae66ae60b2dbc3efcbfc]",
"width": 628,
"height": 400,
"coordmap": {
"panels": [
{
"domain": {
"left": 40.88,
"right": 98.12,
"bottom": -1.04,
"top": 27.04
},
"range": {
"left": 59.04,
"right": 597.76,
"bottom": 325.56,
"top": 58.04
},
"log": {
"x": null,
"y": null
},
"mapping": {

}
}
],
"dims": {
"width": 628,
"height": 400
}
}
}
},
"export": {

}
}
Binary file added 001-hello-new/tests/mytest-current/003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions 001-hello-new/tests/mytest-current/004.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"input": {
"bins": 22
},
"output": {
"distPlot": {
"src": "[image data sha1: 5da305c2913cc811cd8a52d19898ad9b1f2a3da2]",
"width": 628,
"height": 400,
"coordmap": {
"panels": [
{
"domain": {
"left": 40.88,
"right": 98.12,
"bottom": -1.48,
"top": 38.48
},
"range": {
"left": 59.04,
"right": 597.76,
"bottom": 325.56,
"top": 58.04
},
"log": {
"x": null,
"y": null
},
"mapping": {

}
}
],
"dims": {
"width": 628,
"height": 400
}
}
}
},
"export": {

}
}
Binary file added 001-hello-new/tests/mytest-current/004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions 001-hello-new/tests/mytest-expected/001.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"input": {
"bins": 30
},
"output": {
"distPlot": {
"src": "[image data sha1: 62f07fdafae066c5a8e3a84fe6818264c35b29bf]",
"width": 628,
"height": 400,
"coordmap": {
"panels": [
{
"domain": {
"left": 40.88,
"right": 98.12,
"bottom": -1.08,
"top": 28.08
},
"range": {
"left": 59.04,
"right": 597.76,
"bottom": 325.56,
"top": 58.04
},
"log": {
"x": null,
"y": null
},
"mapping": {

}
}
],
"dims": {
"width": 628,
"height": 400
}
}
}
},
"export": {

}
}
Binary file added 001-hello-new/tests/mytest-expected/001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions 001-hello-new/tests/mytest-expected/002.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"input": {
"bins": 8
},
"output": {
"distPlot": {
"src": "[image data sha1: ccbab99b1f814c02c1b46553eda17b543ce4a923]",
"width": 628,
"height": 400,
"coordmap": {
"panels": [
{
"domain": {
"left": 40.88,
"right": 98.12,
"bottom": -2.8,
"top": 72.8
},
"range": {
"left": 59.04,
"right": 597.76,
"bottom": 325.56,
"top": 58.04
},
"log": {
"x": null,
"y": null
},
"mapping": {

}
}
],
"dims": {
"width": 628,
"height": 400
}
}
}
},
"export": {

}
}
Binary file added 001-hello-new/tests/mytest-expected/002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions 001-hello-new/tests/mytest-expected/003.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"input": {
"bins": 49
},
"output": {
"distPlot": {
"src": "[image data sha1: 3f341a0ffad911fe236eae66ae60b2dbc3efcbfc]",
"width": 628,
"height": 400,
"coordmap": {
"panels": [
{
"domain": {
"left": 40.88,
"right": 98.12,
"bottom": -1.04,
"top": 27.04
},
"range": {
"left": 59.04,
"right": 597.76,
"bottom": 325.56,
"top": 58.04
},
"log": {
"x": null,
"y": null
},
"mapping": {

}
}
],
"dims": {
"width": 628,
"height": 400
}
}
}
},
"export": {

}
}
Binary file added 001-hello-new/tests/mytest-expected/003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading