My stab at CI (#66)
This commit is contained in:
@@ -22,6 +22,7 @@ use itertools::Itertools;
|
||||
use parking_lot::RwLock;
|
||||
use slotmap::SlotMap;
|
||||
|
||||
use crate::http_client::{HttpClient, NullHttpClient};
|
||||
pub use async_context::*;
|
||||
use collections::{FxHashMap, FxHashSet, HashMap, VecDeque};
|
||||
pub use context::*;
|
||||
@@ -29,7 +30,6 @@ pub use entity_map::*;
|
||||
use gpui_util::{ResultExt, debug_panic};
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub use headless_app_context::*;
|
||||
use crate::http_client::{HttpClient, NullHttpClient};
|
||||
use smallvec::SmallVec;
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub use test_app::*;
|
||||
@@ -2710,8 +2710,6 @@ pub struct KeystrokeEvent {
|
||||
pub context_stack: Vec<KeyContext>,
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// A mutable reference to an entity owned by GPUI
|
||||
pub struct GpuiBorrow<'a, T> {
|
||||
inner: Option<Lease<T>>,
|
||||
|
||||
@@ -618,25 +618,24 @@ impl Asset for ImageAssetLoader {
|
||||
async move {
|
||||
let bytes = match source.clone() {
|
||||
Resource::Path(uri) => fs::read(uri.as_ref())?,
|
||||
Resource::Uri(uri) => {
|
||||
use anyhow::Context as _;
|
||||
Resource::Uri(uri) => {
|
||||
use anyhow::Context as _;
|
||||
|
||||
let response = client
|
||||
.get(uri.as_ref(), true)
|
||||
.await
|
||||
.with_context(|| format!("loading image asset from {uri:?}"))?;
|
||||
if !response.status.is_success() {
|
||||
let mut error_body =
|
||||
String::from_utf8_lossy(&response.body).into_owned();
|
||||
let first_line = error_body.lines().next().unwrap_or("").trim_end();
|
||||
error_body.truncate(first_line.len());
|
||||
return Err(ImageCacheError::BadStatus {
|
||||
uri,
|
||||
status: response.status,
|
||||
body: error_body,
|
||||
});
|
||||
}
|
||||
response.body
|
||||
let response = client
|
||||
.get(uri.as_ref(), true)
|
||||
.await
|
||||
.with_context(|| format!("loading image asset from {uri:?}"))?;
|
||||
if !response.status.is_success() {
|
||||
let mut error_body = String::from_utf8_lossy(&response.body).into_owned();
|
||||
let first_line = error_body.lines().next().unwrap_or("").trim_end();
|
||||
error_body.truncate(first_line.len());
|
||||
return Err(ImageCacheError::BadStatus {
|
||||
uri,
|
||||
status: response.status,
|
||||
body: error_body,
|
||||
});
|
||||
}
|
||||
response.body
|
||||
}
|
||||
Resource::Embedded(path) => {
|
||||
let data = asset_source.load(&path).ok().flatten();
|
||||
|
||||
@@ -40,12 +40,12 @@ impl Clone for SurfaceSource {
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for SurfaceSource {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match *self {
|
||||
#[cfg(target_os = "macos")]
|
||||
SurfaceSource::Surface(ref buf) => f.debug_tuple("Surface").field(buf).finish(),
|
||||
SurfaceSource::Surface(ref buf) => _f.debug_tuple("Surface").field(buf).finish(),
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||
SurfaceSource::Texture { size, .. } => f
|
||||
SurfaceSource::Texture { size, .. } => _f
|
||||
.debug_struct("Texture")
|
||||
.field("size", &size)
|
||||
.finish_non_exhaustive(),
|
||||
@@ -124,27 +124,27 @@ impl Element for Surface {
|
||||
&mut self,
|
||||
_global_id: Option<&GlobalElementId>,
|
||||
_inspector_id: Option<&InspectorElementId>,
|
||||
bounds: Bounds<Pixels>,
|
||||
_bounds: Bounds<Pixels>,
|
||||
_: &mut Self::RequestLayoutState,
|
||||
_: &mut Self::PrepaintState,
|
||||
window: &mut Window,
|
||||
_window: &mut Window,
|
||||
_: &mut App,
|
||||
) {
|
||||
match self.source {
|
||||
#[cfg(target_os = "macos")]
|
||||
SurfaceSource::Surface(ref surface) => {
|
||||
let size = crate::size(surface.get_width().into(), surface.get_height().into());
|
||||
let new_bounds = self.object_fit.get_bounds(bounds, size);
|
||||
let new_bounds = self.object_fit.get_bounds(_bounds, size);
|
||||
// TODO: Add support for corner_radii
|
||||
window.paint_surface(new_bounds, surface.clone());
|
||||
_window.paint_surface(new_bounds, surface.clone());
|
||||
}
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||
SurfaceSource::Texture {
|
||||
ref texture,
|
||||
ref size,
|
||||
} => {
|
||||
let new_bounds = self.object_fit.get_bounds(bounds, *size);
|
||||
window.paint_surface(new_bounds, Arc::clone(texture), *size);
|
||||
let new_bounds = self.object_fit.get_bounds(_bounds, *size);
|
||||
_window.paint_surface(new_bounds, Arc::clone(texture), *size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,7 @@ use crate::{
|
||||
CornersRefinement, CursorStyle, DefiniteLength, DevicePixels, Edges, EdgesRefinement, Font,
|
||||
FontFallbacks, FontFeatures, FontStyle, FontWeight, GridLocation, Hsla, Length, Pixels, Point,
|
||||
PointRefinement, Rgba, ScaledPixels, SharedString, Size, SizeRefinement, Styled, TextRun,
|
||||
Window, black, phi,
|
||||
point, quad, rems, size,
|
||||
Window, black, phi, point, quad, rems, size,
|
||||
};
|
||||
use collections::HashSet;
|
||||
use refineable::Refineable;
|
||||
|
||||
@@ -702,7 +702,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_state_with_point() {
|
||||
let initial: Point<f32> = Point { x: 10.0, y: 20.0 };
|
||||
let state = TransitionState::new(initial.clone());
|
||||
let state = TransitionState::new(initial);
|
||||
|
||||
assert_eq!(state.initial_goal.x, 10.0);
|
||||
assert_eq!(state.initial_goal.y, 20.0);
|
||||
|
||||
@@ -13,13 +13,12 @@ use crate::{
|
||||
PolychromeSprite, Priority, PromptButton, PromptLevel, Quad, Render, RenderGlyphParams,
|
||||
RenderImage, RenderImageParams, RenderSvgParams, Replay, ResizeEdge, SMOOTH_SVG_SCALE_FACTOR,
|
||||
SUBPIXEL_VARIANTS_X, SUBPIXEL_VARIANTS_Y, ScaledFilter, ScaledPixels, Scene, Shadow,
|
||||
SharedString, Size,
|
||||
StrikethroughStyle, Style, SubpixelSprite, SubscriberSet, Subscription, SystemWindowTab,
|
||||
SystemWindowTabController, TabStopMap, TaffyLayoutEngine, Task, TextRenderingMode, TextStyle,
|
||||
TextStyleRefinement, ThermalState, TransformationMatrix, Transition, TransitionState,
|
||||
Underline, UnderlineStyle, WindowAppearance, WindowBackgroundAppearance, WindowBounds,
|
||||
WindowControls, WindowDecorations, WindowOptions, WindowParams, WindowTextSystem, point,
|
||||
prelude::*, px, rems, size, transparent_black,
|
||||
SharedString, Size, StrikethroughStyle, Style, SubpixelSprite, SubscriberSet, Subscription,
|
||||
SystemWindowTab, SystemWindowTabController, TabStopMap, TaffyLayoutEngine, Task,
|
||||
TextRenderingMode, TextStyle, TextStyleRefinement, ThermalState, TransformationMatrix,
|
||||
Transition, TransitionState, Underline, UnderlineStyle, WindowAppearance,
|
||||
WindowBackgroundAppearance, WindowBounds, WindowControls, WindowDecorations, WindowOptions,
|
||||
WindowParams, WindowTextSystem, point, prelude::*, px, rems, size, transparent_black,
|
||||
};
|
||||
use anyhow::{Context as _, Result, anyhow};
|
||||
use collections::{FxHashMap, FxHashSet};
|
||||
|
||||
Reference in New Issue
Block a user