Skip to content

Commit

Permalink
Merge pull request #23 from BUAA-SE-Compiling/test-groups
Browse files Browse the repository at this point in the history
Test groups
  • Loading branch information
lynzrand authored Nov 2, 2020
2 parents adfc5cd + 426da22 commit 77a3f0c
Show file tree
Hide file tree
Showing 31 changed files with 418 additions and 164 deletions.
2 changes: 1 addition & 1 deletion judger/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion judger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = ["Rynco Maekawa <[email protected]>", "Rami3L Li <rami3l@>"]
edition = "2018"
name = "rurikawa-judger"
version = "0.2.0-beta.3"
version = "0.2.0-beta.4"

[[bin]]
name = "rurikawa"
Expand Down
9 changes: 3 additions & 6 deletions judger/src/tester/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,13 +417,10 @@ impl TestSuite {
let mut test_cases = futures::stream::iter(options.tests.clone().drain(..))
.map(|name| {
let public_cfg = &public_cfg;
let mut test_root = test_root.clone();
let mut container_test_root = container_test_root.clone();
let test_root = &test_root;
let container_test_root = &container_test_root;
let case = index.get(&name).unwrap();
async move {
test_root.push(&name);
container_test_root.push(&name);

let replacer: HashMap<String, _> = public_cfg
.vars
.iter()
Expand All @@ -436,7 +433,7 @@ impl TestSuite {
"$stdout" => test_root.clone(),
_ => container_test_root.clone(),
};
p.set_extension(ext);
p.push(format!("{}.{}", name, ext));
p.to_slash_lossy()
})
})
Expand Down
2 changes: 1 addition & 1 deletion web/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.styl", "src/styles/prism-ghcolors.css"],
"styles": ["src/styles.styl"],
"scripts": [
"node_modules/marked/lib/marked.js",
"node_modules/prismjs/prism.js",
Expand Down
4 changes: 4 additions & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,9 @@
"ts-node": "~9.0.0",
"tslint": "~6.1.0",
"typescript": "~4.0.2"
},
"resolutions": {
"marked": "^1.2.2",
"ngx-markdown/marked": "^1.2.2"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/src/assets/darkmode/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/src/assets/darkmode/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/src/assets/darkmode/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/src/assets/darkmode/favicon.ico
Binary file not shown.
3 changes: 3 additions & 0 deletions web/src/components/base-components/base-components.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { FileUploadAreaComponent } from './file-upload-area/file-upload-area.com
import { FormsModule } from '@angular/forms';
import { CollapseBoxComponent } from './collapse-box/collapse-box.component';
import { BackBtnComponent } from './back-btn/back-btn.component';
import { ToggleButtonComponent } from './toggle-button/toggle-button.component';

@NgModule({
declarations: [
Expand All @@ -18,6 +19,7 @@ import { BackBtnComponent } from './back-btn/back-btn.component';
FileUploadAreaComponent,
CollapseBoxComponent,
BackBtnComponent,
ToggleButtonComponent,
],
imports: [CommonModule, RouterModule, IconModule, FormsModule],
exports: [
Expand All @@ -27,6 +29,7 @@ import { BackBtnComponent } from './back-btn/back-btn.component';
FileUploadAreaComponent,
CollapseBoxComponent,
BackBtnComponent,
ToggleButtonComponent,
],
})
export class BaseComponentsModule {}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<div class="collapse-box">
<div class="title row text">
<h2>{{ title }}</h2>
<ng-content select="[title]"></ng-content>
<div class="row-spacer"></div>
<a class="expand-btn" (click)="toggle()">{{
collapsed ? "展开" : "折叠"
}}</a>
</div>
<div class="content" *ngIf="!collapsed">
<ng-content></ng-content>
<ng-content select="[body]"></ng-content>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div
class="toggle-btn btn"
[class.secondary]="!active"
[class.dark]="!active"
[class.info]="active"
(click)="toggle()"
>
<ng-content></ng-content>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ToggleButtonComponent } from './toggle-button.component';

describe('ToggleButtonComponent', () => {
let component: ToggleButtonComponent;
let fixture: ComponentFixture<ToggleButtonComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ToggleButtonComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(ToggleButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';

@Component({
selector: 'app-toggle-button',
templateUrl: './toggle-button.component.html',
styleUrls: ['./toggle-button.component.styl'],
})
export class ToggleButtonComponent implements OnInit {
constructor() {}

@Input()
active: boolean = false;
@Output() activeChanged = new EventEmitter<boolean>();

toggle() {
this.active = !this.active;
this.activeChanged.emit(this.active);
}

ngOnInit(): void {}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.wrapper {
padding: var(--space-2)
color: var(--pal-base-00)
color: var(--pal-text-over-highlight)
font-weight: bold
display: flex
flex-direction: row
Expand Down
10 changes: 9 additions & 1 deletion web/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,31 @@
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
id="apple-touch-icon"
rel="apple-touch-icon"
sizes="180x180"
href="assets/apple-touch-icon.png"
/>
<link
id="icon-32"
rel="icon"
type="image/png"
sizes="32x32"
href="assets/favicon-32x32.png"
/>
<link
id="icon-16"
rel="icon"
type="image/png"
sizes="16x16"
href="assets/favicon-16x16.png"
/>
<link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
<link
icon="icon-ico"
rel="icon"
type="image/x-icon"
href="assets/favicon.ico"
/>
<link rel="manifest" href="assets/site.webmanifest" />
<link
href="https://fonts.loli.net/css2?family=Work+Sans:ital,wght@0,300;0,400;0,500;0,700;0,900;1,300;1,400;1,500;1,700&display=swap"
Expand Down
3 changes: 3 additions & 0 deletions web/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import dayjs from 'dayjs';
import * as utc from 'dayjs/plugin/utc';
import { startWatchingDarkMode } from './services/dark_mode_watcher';

dayjs.extend(utc);

Expand All @@ -15,3 +16,5 @@ if (environment.production) {
platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch((err) => console.error(err));

startWatchingDarkMode();
1 change: 0 additions & 1 deletion web/src/services/account_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ export class LoginInformationInterceptor implements HttpInterceptor {
req: HttpRequest<any>,
next: HttpHandler
): Observable<HttpEvent<any>> {
console.error(req.url);
if (
req.headers.get('bypass-login') !== null ||
!req.url.startsWith(environment.endpointBase())
Expand Down
70 changes: 70 additions & 0 deletions web/src/services/dark_mode_watcher.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { Injectable } from '@angular/core';

export function startWatchingDarkMode() {
if (
window.matchMedia &&
window.matchMedia('(prefers-color-scheme: dark)').matches
) {
onDarkMode();
} else {
onLightMode();
}
window
.matchMedia('(prefers-color-scheme: dark)')
.addEventListener('change', (event) => {
if (event.matches) {
onDarkMode();
} else {
onLightMode();
}
});
}

export let darkModeWatcherInstance: DarkModeWatcher;

@Injectable({ providedIn: 'root' })
export class DarkModeWatcher {
constructor() {
darkModeWatcherInstance = this;
}
}

const lightModeAssets = {
appleTouchIcon: 'assets/apple-touch-icon.png',
icon32: 'assets/favicon-32x32.png',
icon16: 'assets/favicon-16x16.png',
iconIco: 'assets/favicon.ico',
};

const darkModeAssets = {
appleTouchIcon: 'assets/darkmode/apple-touch-icon.png',
icon32: 'assets/darkmode/favicon-32x32.png',
icon16: 'assets/darkmode/favicon-16x16.png',
iconIco: 'assets/darkmode/favicon.ico',
};

function onLightMode() {
document.getElementsByTagName('body')[0].classList.add('default-palette');
document.getElementsByTagName('body')[0].classList.remove('inverted-palette');
(document.getElementById('apple-touch-icon') as HTMLLinkElement).href =
lightModeAssets.appleTouchIcon;
(document.getElementById('icon-32') as HTMLLinkElement).href =
lightModeAssets['icon32'];
(document.getElementById('icon-16') as HTMLLinkElement).href =
lightModeAssets['icon16'];
(document.getElementById('icon-ico') as HTMLLinkElement).href =
lightModeAssets['iconIco'];
}

function onDarkMode() {
document.getElementsByTagName('body')[0].classList.remove('default-palette');
document.getElementsByTagName('body')[0].classList.add('inverted-palette');
(document.getElementById('apple-touch-icon') as HTMLLinkElement).href =
darkModeAssets.appleTouchIcon;
(document.getElementById('icon-32') as HTMLLinkElement).href =
darkModeAssets['icon32'];
(document.getElementById('icon-16') as HTMLLinkElement).href =
darkModeAssets['icon16'];
(document.getElementById('icon-ico') as HTMLLinkElement).href =
darkModeAssets['iconIco'];
}
Loading

0 comments on commit 77a3f0c

Please sign in to comment.